├── core
├── __init__.py
├── ranger.py
├── prompt.py
├── config.py
├── colors.py
├── requester.py
├── datanize.py
├── evaluate.py
├── tweaker.py
├── zetanize.py
├── photon.py
├── utils.py
└── entropy.py
├── requirements.txt
├── .travis.yml
├── README.md
├── bolt.py
├── db
└── hashes.json
└── LICENSE
/core/__init__.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy
2 | scipy
3 | requests
4 | fuzzywuzzy
5 | python-Levenshtein
6 |
--------------------------------------------------------------------------------
/core/ranger.py:
--------------------------------------------------------------------------------
1 | def ranger(tokens):
2 | digits = set()
3 | alphabets = set()
4 | for token in tokens:
5 | for char in token:
6 | if char in '0123456789':
7 | digits.add(char)
8 | elif char in 'abcdefghijklmnopqrstuvwxyz':
9 | alphabets.add(char)
10 | return [list(digits), list(alphabets)]
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 |
2 | language: python
3 | os:
4 | - linux
5 | python:
6 | - 3.6
7 | install:
8 | - pip install flake8
9 | before_script:
10 | - pip install -r requirements.txt
11 | # stop the build if there are Python syntax errors
12 | - flake8 . --count --select=E901,E999,F401,F701,F702,F706,F822,F823 --show-source --statistics
13 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
14 | - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
15 | script:
16 | - python bolt.py -u https://github.com -l 1
17 |
--------------------------------------------------------------------------------
/core/prompt.py:
--------------------------------------------------------------------------------
1 | import os
2 | import tempfile
3 |
4 |
5 | def prompt(default=None):
6 | editor = 'nano'
7 | with tempfile.NamedTemporaryFile(mode='r+') as tmpfile:
8 | if default:
9 | tmpfile.write(default)
10 | tmpfile.flush()
11 |
12 | child_pid = os.fork()
13 | is_child = child_pid == 0
14 |
15 | if is_child:
16 | os.execvp(editor, [editor, tmpfile.name])
17 | else:
18 | os.waitpid(child_pid, 0)
19 | tmpfile.seek(0)
20 | return tmpfile.read().strip()
21 |
--------------------------------------------------------------------------------
/core/config.py:
--------------------------------------------------------------------------------
1 | password = 'xXx!69!xXx'
2 | email = 'testing@gmail.com'
3 | strings = ['red', 'bob', 'admin', 'alex', 'testing',
4 | 'test', 'lol', 'yes', 'dragon', 'bad']
5 | commonNames = ['csrf', 'auth', 'token', 'verify', 'hash']
6 | tokenPattern = r'^[\w\-_+=/]{14,256}$'
7 |
8 | headers = { # default headers
9 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
10 | 'Accept-Language': 'en-US,en;q=0.5',
11 | 'Accept-Encoding': 'gzip,deflate',
12 | 'Connection': 'close',
13 | 'DNT': '1',
14 | 'Upgrade-Insecure-Requests': '1',
15 | }
16 |
--------------------------------------------------------------------------------
/core/colors.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | colors = True # Output should be colored
4 | machine = sys.platform # Detecting the os of current system
5 | if machine.lower().startswith(('os', 'win', 'darwin', 'ios')):
6 | colors = False # Colors shouldn't be displayed in mac & windows
7 | if not colors:
8 | end = red = white = green = yellow = run = bad = good = info = que = ''
9 | lightning = '⚡'
10 | else:
11 | white = '\033[97m'
12 | green = '\033[92m'
13 | red = '\033[91m'
14 | yellow = '\033[93m'
15 | end = '\033[0m'
16 | back = '\033[7;91m'
17 | info = '\033[93m[!]\033[0m'
18 | que = '\033[94m[?]\033[0m'
19 | bad = '\033[91m[-]\033[0m'
20 | good = '\033[92m[+]\033[0m'
21 | run = '\033[97m[~]\033[0m'
22 | lightning = '\033[93;5m⚡\033[0m'
23 |
--------------------------------------------------------------------------------
/core/requester.py:
--------------------------------------------------------------------------------
1 | import time
2 | import random
3 | import warnings
4 | import requests
5 |
6 | warnings.filterwarnings('ignore') # Disable SSL related warnings
7 |
8 |
9 | def requester(url, data, headers, GET, delay):
10 | time.sleep(delay)
11 | user_agents = ['Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0',
12 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'
13 | 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.991']
14 | if headers:
15 | if 'User-Agent' not in headers:
16 | headers['User-Agent'] = random.choice(user_agents)
17 | if GET:
18 | response = requests.get(
19 | url, params=data, headers=headers, verify=False)
20 | else:
21 | response = requests.post(url, data=data, headers=headers, verify=False)
22 | return response
23 |
--------------------------------------------------------------------------------
/core/datanize.py:
--------------------------------------------------------------------------------
1 | import random
2 | import re
3 |
4 | from core.config import password, email, tokenPattern, strings
5 |
6 |
7 | def datanize(forms, tolerate=False):
8 | parsedForms = list(forms.values())
9 | for oneForm in parsedForms:
10 | data = {}
11 | login = False
12 | protected = False
13 | action = oneForm['action']
14 | method = oneForm['method']
15 | inputs = oneForm['inputs']
16 | for inp in inputs:
17 | name = inp['name']
18 | kind = inp['type']
19 | value = inp['value']
20 | if re.match(tokenPattern, value):
21 | protected = True
22 | if kind == 'password':
23 | data[name] = password
24 | login = True
25 | if kind == 'email':
26 | data[name] = email
27 | if kind == 'text':
28 | data[name] = random.choice(strings)
29 | else:
30 | data[name] = value
31 | if method == 'GET':
32 | GET = True
33 | else:
34 | GET = False
35 | if protected:
36 | if not login or tolerate:
37 | return [GET, action, data]
38 | return None
39 |
--------------------------------------------------------------------------------
/core/evaluate.py:
--------------------------------------------------------------------------------
1 | from re import match
2 | from core.utils import strength
3 | from core.config import commonNames
4 |
5 |
6 | def evaluate(dataset, weakTokens, tokenDatabase, allTokens, insecureForms):
7 | done = []
8 | for i in dataset:
9 | for url, page in i.items():
10 | localTokens = set()
11 | for each in page.values():
12 | protected = False
13 | action = each['action']
14 | method = each['method']
15 | inputs = each['inputs']
16 | for inp in inputs:
17 | name = inp['name']
18 | value = inp['value']
19 | if value and match(r'^[\w\-_]+$', value):
20 | if strength(value) > 10:
21 | localTokens.add(value)
22 | protected = True
23 | break
24 | elif name.lower() in commonNames:
25 | weakTokens.append({url: {name: value}})
26 | if not protected and action not in done:
27 | done.append(done)
28 | insecureForms.append({url: each})
29 | for token in localTokens:
30 | allTokens.append(token)
31 | tokenDatabase.append({url: localTokens})
32 |
--------------------------------------------------------------------------------
/core/tweaker.py:
--------------------------------------------------------------------------------
1 | from core.config import tokenPattern
2 | import random
3 | import re
4 |
5 |
6 | def tweaker(data, strategy, index=0, seeds=[None, None]):
7 | digits = seeds[0]
8 | alphabets = seeds[1]
9 | newData = {}
10 | if strategy == 'clear':
11 | for name, value in data.items():
12 | if re.match(tokenPattern, value):
13 | value = ''
14 | newData[name] = value
15 | return newData
16 | elif strategy == 'remove':
17 | for name, value in data.items():
18 | if not re.match(tokenPattern, value):
19 | newData[name] = value
20 | elif strategy == 'break':
21 | for name, value in data.items():
22 | if re.match(tokenPattern, value):
23 | value = value[:index]
24 | for i in index:
25 | value += random.choice(digits + alphabets)
26 | newData[name] = value
27 | elif strategy == 'generate':
28 | for name, value in data.items():
29 | if re.match(tokenPattern, value):
30 | newToken = ''
31 | for char in list(value):
32 | if char in digits:
33 | newToken += random.choice(digits)
34 | elif char in alphabets:
35 | newToken += random.choice(alphabets)
36 | else:
37 | newToken += char
38 | newData[name] = newToken
39 | else:
40 | newData[name] = value
41 | elif strategy == 'replace':
42 | for name, value in data.items():
43 | if re.match(tokenPattern, value):
44 | value
45 | return newData
46 |
--------------------------------------------------------------------------------
/core/zetanize.py:
--------------------------------------------------------------------------------
1 | import re
2 | from urllib.parse import urlparse
3 |
4 |
5 | def zetanize(url, response):
6 | parsedUrl = urlparse(url)
7 | mainUrl = parsedUrl.scheme + '://' + parsedUrl.netloc
8 |
9 | def e(string):
10 | return string.encode('utf-8')
11 |
12 | def d(string):
13 | return string.decode('utf-8')
14 |
15 | response = re.sub(r'(?s)', '', response)
16 | forms = {}
17 | matches = re.findall(r'(?i)(?s)
', response)
18 | num = 0
19 | for match in matches:
20 | page = re.search(r'(?i)action=[\'"](.*?)[\'"]', match)
21 | method = re.search(r'(?i)method=[\'"](.*?)[\'"]', match)
22 | forms[num] = {}
23 | action = d(e(page.group(1)))
24 | if not action.startswith('http'):
25 | if action.startswith('/'):
26 | action = mainUrl + action
27 | else:
28 | action = mainUrl + '/' + action
29 | forms[num]['action'] = action.replace('&', '&') if page else ''
30 | forms[num]['method'] = d(
31 | e(method.group(1)).lower()) if method else 'get'
32 | forms[num]['inputs'] = []
33 | inputs = re.findall(r'(?i)(?s)', response)
34 | for inp in inputs:
35 | inpName = re.search(r'(?i)name=[\'"](.*?)[\'"]', inp)
36 | if inpName:
37 | inpType = re.search(r'(?i)type=[\'"](.*?)[\'"]', inp)
38 | inpValue = re.search(r'(?i)value=[\'"](.*?)[\'"]', inp)
39 | inpName = d(e(inpName.group(1)))
40 | inpType = d(e(inpType.group(1)))if inpType else ''
41 | inpValue = d(e(inpValue.group(1))) if inpValue else ''
42 | if inpType.lower() == 'submit' and inpValue == '':
43 | inpValue = 'Submit Query'
44 | inpDict = {
45 | 'name': inpName,
46 | 'type': inpType,
47 | 'value': inpValue
48 | }
49 | forms[num]['inputs'].append(inpDict)
50 | num += 1
51 | return forms
52 |
--------------------------------------------------------------------------------
/core/photon.py:
--------------------------------------------------------------------------------
1 | # Let's import what we need
2 | from re import findall
3 | import concurrent.futures
4 | from urllib.parse import urlparse # for python3
5 |
6 | from core.colors import run
7 | from core.zetanize import zetanize
8 | from core.requester import requester
9 | from core.utils import getUrl, getParams, remove_file
10 |
11 |
12 | def photon(seedUrl, headers, depth, threadCount):
13 | forms = [] # web forms
14 | processed = set() # urls that have been crawled
15 | storage = set() # urls that belong to the target i.e. in-scope
16 | scheme = urlparse(seedUrl).scheme
17 | host = urlparse(seedUrl).netloc
18 | main_url = scheme + '://' + host
19 | storage.add(seedUrl)
20 |
21 | def rec(url):
22 | processed.add(url)
23 | urlPrint = (url + (' ' * 60))[:60]
24 | print ('%s Parsing %-40s' % (run, urlPrint), end='\r')
25 | url = getUrl(url, '', True)
26 | params = getParams(url, '', True)
27 | if '=' in url:
28 | inps = []
29 | for name, value in params.items():
30 | inps.append({'name': name, 'value': value})
31 | forms.append(
32 | {url: {0: {'action': url, 'method': 'get', 'inputs': inps}}})
33 | response = requester(url, params, headers, True, 0).text
34 | forms.append({url: zetanize(url, response)})
35 | matches = findall(
36 | r'<[aA][^>]*?(href|HREF)=["\']{0,1}(.*?)["\']', response)
37 | for link in matches: # iterate over the matches
38 | # remove everything after a "#" to deal with in-page anchors
39 | link = link[1].split('#')[0].lstrip(' ')
40 | if link[:4] == 'http':
41 | if link.startswith(main_url):
42 | storage.add(link)
43 | elif link[:2] == '//':
44 | if link.split('/')[2].startswith(host):
45 | storage.add(scheme + '://' + link)
46 | elif link[:1] == '/':
47 | storage.add(remove_file(url) + link)
48 | else:
49 | usable_url = remove_file(url)
50 | if usable_url.endswith('/'):
51 | storage.add(usable_url + link)
52 | elif link.startswith('/'):
53 | storage.add(usable_url + link)
54 | else:
55 | storage.add(usable_url + '/' + link)
56 | for x in range(depth):
57 | urls = storage - processed
58 | threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=10)
59 | futures = (threadpool.submit(rec, url) for url in urls)
60 | for i in concurrent.futures.as_completed(futures):
61 | pass
62 | return [forms, len(processed)]
63 |
--------------------------------------------------------------------------------
/core/utils.py:
--------------------------------------------------------------------------------
1 | import re
2 | from core.config import tokenPattern
3 |
4 |
5 | def longestCommonSubstring(s1, s2):
6 | m = [[0] * (1 + len(s2)) for i in range(1 + len(s1))]
7 | longest, x_longest = 0, 0
8 | for x in range(1, 1 + len(s1)):
9 | for y in range(1, 1 + len(s2)):
10 | if s1[x - 1] == s2[y - 1]:
11 | m[x][y] = m[x - 1][y - 1] + 1
12 | if m[x][y] > longest:
13 | longest = m[x][y]
14 | x_longest = x
15 | else:
16 | m[x][y] = 0
17 | return s1[x_longest - longest: x_longest]
18 |
19 |
20 | def stringToBinary(string):
21 | return ''.join(format(ord(x), 'b') for x in string)
22 |
23 |
24 | def strength(string):
25 | digits = re.findall(r'\d', string)
26 | lowerAlphas = re.findall(r'[a-z]', string)
27 | upperAlphas = re.findall(r'[A-Z]', string)
28 | entropy = len(set(digits + lowerAlphas + upperAlphas))
29 | if not digits:
30 | entropy = entropy/2
31 | return entropy
32 |
33 |
34 | def isProtected(parsed):
35 | protected = False
36 | parsedForms = list(parsed.values())
37 | for oneForm in parsedForms:
38 | inputs = oneForm['inputs']
39 | for inp in inputs:
40 | name = inp['name']
41 | kind = inp['type']
42 | value = inp['value']
43 | if re.match(tokenPattern, value):
44 | protected = True
45 | return protected
46 |
47 |
48 | def extractHeaders(headers):
49 | headers = headers.replace('\\n', '\n')
50 | sorted_headers = {}
51 | matches = re.findall(r'(.*):\s(.*)', headers)
52 | for match in matches:
53 | header = match[0]
54 | value = match[1]
55 | try:
56 | if value[-1] == ',':
57 | value = value[:-1]
58 | sorted_headers[header] = value
59 | except IndexError:
60 | pass
61 | return sorted_headers
62 |
63 |
64 | def getUrl(url, data, GET):
65 | if GET:
66 | return url.split('?')[0]
67 | else:
68 | return url
69 |
70 |
71 | def getParams(url, data, GET):
72 | params = {}
73 | if GET:
74 | if '=' in url:
75 | data = url.split('?')[1]
76 | if data[:1] == '?':
77 | data = data[1:]
78 | else:
79 | data = ''
80 | parts = data.split('&')
81 | for part in parts:
82 | each = part.split('=')
83 | try:
84 | params[each[0]] = each[1]
85 | except IndexError:
86 | params = None
87 | return params
88 |
89 |
90 | def remove_file(url):
91 | if url.count('/') > 2:
92 | replacable = re.search(r'/[^/]*?$', url).group()
93 | if replacable != '/':
94 | return url.replace(replacable, '')
95 | else:
96 | return url
97 | else:
98 | return url
99 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Bolt
6 |
7 |
8 |
9 | A dumb CSRF scanner
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | 
24 |
25 | ### Important
26 | Bolt is in beta phase of development which means there can be bugs. Any production use of this tool discouraged.
27 | Pull requests and issues are welcome. I also suggest you to put this repo on watch if you are interested in it.
28 |
29 | ### Workflow
30 |
31 | #### Crawling
32 | Bolt crawls the target website to the specified depth and stores all the HTML forms found in a database for further processing.
33 |
34 | #### Evaluating
35 | In this phase, Bolt finds out the tokens which aren't strong enough and the forms which aren't protected.
36 |
37 | ##### Comparing
38 | This phase focuses on detection on replay attack scenarios and hence checks if a token has been issued more than one time.
39 | It also calculates the average [levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between all the tokens to see if they are similar.\
40 | Tokens are also compared against a database of 250+ hash patterns.
41 |
42 | ##### Observing
43 | In this phase, 100 simultaneous requests are made to a single webpage to see if same tokens are generated for the requests.
44 |
45 | ##### Testing
46 | This phase is dedicated to active testing of the CSRF protection mechanism. It includes but not limited to checking if protection exsists for moblie browsers, submitting requests with self-generated token and testing if token is being checked to a certain length.
47 |
48 | ##### Analysing
49 | Various statistical checks are performed in this phase to see if the token is really random.
50 | Following tests are performed during this phase
51 | - Monobit frequency test
52 | - Block frequency test
53 | - Runs test
54 | - Spectral test
55 | - Non-overlapping template matching test
56 | - Overlapping template matching test
57 | - Serial test
58 | - Cumultative sums test
59 | - Aproximate entropy test
60 | - Random excursions variant test
61 | - Linear complexity test
62 | - Longest runs test
63 | - Maurers universal statistic test
64 | - Random excursions test
65 |
66 | ### Usage
67 |
68 | Scanning a website for CSRF using Bolt is as easy as doing
69 | ```
70 | python3 bolt.py -u https://github.com -l 2
71 | ```
72 | Where `-u` is used to supply the URL and `-l` is used to specify the depth of crawling.
73 |
74 | Other options and switches:
75 |
76 | - `-t` number of threads
77 | - `--delay` delay between requests
78 | - `--timeout` http request timeout
79 | - `--headers` supply http headers
80 |
81 | #### Credits
82 | Regular Expressions for detecting hashes are taken from [hashID](https://github.com/psypanda/hashID).\
83 | Bit level entropy tests are taken from [highfestiva](https://github.com/highfestiva)'s python implementation of statistical tests.
84 |
--------------------------------------------------------------------------------
/bolt.py:
--------------------------------------------------------------------------------
1 | from core.colors import green, yellow, end, run, good, info, bad, white, red
2 |
3 | lightning = '\033[93;5m⚡\033[0m'
4 |
5 |
6 | def banner():
7 | print ('''
8 | %s⚡ %sBOLT%s ⚡%s
9 | ''' % (yellow, white, yellow, end))
10 |
11 |
12 | banner()
13 |
14 | try:
15 | import concurrent.futures
16 | from pathlib import Path
17 | except:
18 | print ('%s Bolt is not compatible with python 2. Please run it with python 3.' % bad)
19 |
20 | try:
21 | from fuzzywuzzy import fuzz, process
22 | except:
23 | import os
24 | print ('%s fuzzywuzzy library is not installed, installing now.' % info)
25 | os.system('pip3 install fuzzywuzzy')
26 | print ('%s fuzzywuzzy has been installed, please restart Bolt.' % info)
27 | quit()
28 |
29 | import argparse
30 | import json
31 | import random
32 | import re
33 | import statistics
34 |
35 | from core.entropy import isRandom
36 | from core.datanize import datanize
37 | from core.prompt import prompt
38 | from core.photon import photon
39 | from core.tweaker import tweaker
40 | from core.evaluate import evaluate
41 | from core.ranger import ranger
42 | from core.zetanize import zetanize
43 | from core.requester import requester
44 | from core.utils import extractHeaders, strength, isProtected, stringToBinary, longestCommonSubstring
45 |
46 | parser = argparse.ArgumentParser()
47 | parser.add_argument('-u', help='target url', dest='target')
48 | parser.add_argument('-t', help='number of threads', dest='threads', type=int)
49 | parser.add_argument('-l', help='levels to crawl', dest='level', type=int)
50 | parser.add_argument('--delay', help='delay between requests',
51 | dest='delay', type=int)
52 | parser.add_argument('--timeout', help='http request timeout',
53 | dest='timeout', type=int)
54 | parser.add_argument('--headers', help='http headers',
55 | dest='add_headers', nargs='?', const=True)
56 | args = parser.parse_args()
57 |
58 | if not args.target:
59 | print('\n' + parser.format_help().lower())
60 | quit()
61 |
62 | if type(args.add_headers) == bool:
63 | headers = extractHeaders(prompt())
64 | elif type(args.add_headers) == str:
65 | headers = extractHeaders(args.add_headers)
66 | else:
67 | from core.config import headers
68 |
69 | target = args.target
70 | delay = args.delay or 0
71 | level = args.level or 2
72 | timeout = args.timeout or 20
73 | threadCount = args.threads or 2
74 |
75 | allTokens = []
76 | weakTokens = []
77 | tokenDatabase = []
78 | insecureForms = []
79 |
80 | print (' %s Phase: Crawling %s[%s1/6%s]%s' %
81 | (lightning, green, end, green, end))
82 | dataset = photon(target, headers, level, threadCount)
83 | allForms = dataset[0]
84 | print ('\r%s Crawled %i URL(s) and found %i form(s).%-10s' %
85 | (info, dataset[1], len(allForms), ' '))
86 | print (' %s Phase: Evaluating %s[%s2/6%s]%s' %
87 | (lightning, green, end, green, end))
88 |
89 | evaluate(allForms, weakTokens, tokenDatabase, allTokens, insecureForms)
90 |
91 | if weakTokens:
92 | print ('%s Weak token(s) found' % good)
93 | for weakToken in weakTokens:
94 | url = list(weakToken.keys())[0]
95 | token = list(weakToken.values())[0]
96 | print ('%s %s %s' % (info, url, token))
97 |
98 | if insecureForms:
99 | print ('%s Insecure form(s) found' % good)
100 | for insecureForm in insecureForms:
101 | url = list(insecureForm.keys())[0]
102 | action = list(insecureForm.values())[0]['action']
103 | form = action.replace(target, '')
104 | if form:
105 | print ('%s %s %s[%s%s%s]%s' %
106 | (bad, url, green, end, form, green, end))
107 |
108 | print (' %s Phase: Comparing %s[%s3/6%s]%s' %
109 | (lightning, green, end, green, end))
110 | uniqueTokens = set(allTokens)
111 | if len(uniqueTokens) < len(allTokens):
112 | print ('%s Potential Replay Attack condition found' % good)
113 | print ('%s Verifying and looking for the cause' % run)
114 | replay = False
115 | for each in tokenDatabase:
116 | url, token = next(iter(each.keys())), next(iter(each.values()))
117 | for each2 in tokenDatabase:
118 | url2, token2 = next(iter(each2.keys())), next(iter(each2.values()))
119 | if token == token2 and url != url2:
120 | print ('%s The same token was used on %s%s%s and %s%s%s' %
121 | (good, green, url, end, green, url2, end))
122 | replay = True
123 | if not replay:
124 | print ('%s Further investigation shows that it was a false positive.')
125 |
126 | p = Path(__file__).parent.joinpath('db/hashes.json')
127 | with p.open('r') as f:
128 | hashPatterns = json.load(f)
129 |
130 | if not allTokens:
131 | print ('%s No CSRF protection to test' % bad)
132 | quit()
133 |
134 | aToken = allTokens[0]
135 | matches = []
136 | for element in hashPatterns:
137 | pattern = element['regex']
138 | if re.match(pattern, aToken):
139 | for name in element['matches']:
140 | matches.append(name)
141 | if matches:
142 | print ('%s Token matches the pattern of following hash type(s):' % info)
143 | for name in matches:
144 | print (' %s>%s %s' % (yellow, end, name))
145 |
146 |
147 | def fuzzy(tokens):
148 | averages = []
149 | for token in tokens:
150 | sameTokenRemoved = False
151 | result = process.extract(token, tokens, scorer=fuzz.partial_ratio)
152 | scores = []
153 | for each in result:
154 | score = each[1]
155 | if score == 100 and not sameTokenRemoved:
156 | sameTokenRemoved = True
157 | continue
158 | scores.append(score)
159 | average = statistics.mean(scores)
160 | averages.append(average)
161 | return statistics.mean(averages)
162 |
163 |
164 | try:
165 | similarity = fuzzy(allTokens)
166 | print ('%s Tokens are %s%i%%%s similar to each other on an average' %
167 | (info, green, similarity, end))
168 | except statistics.StatisticsError:
169 | print ('%s No CSRF protection to test' % bad)
170 | quit()
171 |
172 |
173 | def staticParts(allTokens):
174 | strings = list(set(allTokens.copy()))
175 | commonSubstrings = {}
176 | for theString in strings:
177 | strings.remove(theString)
178 | for string in strings:
179 | commonSubstring = longestCommonSubstring(theString, string)
180 | if commonSubstring not in commonSubstrings:
181 | commonSubstrings[commonSubstring] = []
182 | if len(commonSubstring) > 2:
183 | if theString not in commonSubstrings[commonSubstring]:
184 | commonSubstrings[commonSubstring].append(theString)
185 | if string not in commonSubstrings[commonSubstring]:
186 | commonSubstrings[commonSubstring].append(string)
187 | return commonSubstrings
188 |
189 |
190 | result = {k: v for k, v in staticParts(allTokens).items() if v}
191 |
192 | if result:
193 | print ('%s Common substring found' % info)
194 | print (json.dumps(result, indent=4))
195 |
196 | simTokens = []
197 |
198 | print (' %s Phase: Observing %s[%s4/6%s]%s' %
199 | (lightning, green, end, green, end))
200 | print ('%s 100 simultaneous requests are being made, please wait.' % info)
201 |
202 |
203 | def extractForms(url):
204 | response = requester(url, {}, headers, True, 0).text
205 | forms = zetanize(url, response)
206 | for each in forms.values():
207 | localTokens = set()
208 | inputs = each['inputs']
209 | for inp in inputs:
210 | value = inp['value']
211 | if value and re.match(r'^[\w\-_]+$', value):
212 | if strength(value) > 10:
213 | simTokens.append(value)
214 |
215 |
216 | while True:
217 | sample = random.choice(tokenDatabase)
218 | goodToken = list(sample.values())[0]
219 | if len(goodToken) > 0:
220 | goodCandidate = list(sample.keys())[0]
221 | break
222 |
223 | threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=30)
224 | futures = (threadpool.submit(extractForms, goodCandidate)
225 | for goodCandidate in [goodCandidate] * 30)
226 | for i in concurrent.futures.as_completed(futures):
227 | pass
228 |
229 | if simTokens:
230 | if len(set(simTokens)) < len(simTokens):
231 | print ('%s Same tokens were issued for simultaneous requests.' % good)
232 | else:
233 | print (simTokens)
234 | else:
235 | print ('%s Different tokens were issued for simultaneous requests.' % info)
236 |
237 | print (' %s Phase: Testing %s[%s5/6%s]%s' %
238 | (lightning, green, end, green, end))
239 |
240 | parsed = ''
241 | found = False
242 | print ('%s Finding a suitable form for further testing. It may take a while.' % run)
243 | for form_dict in allForms:
244 | for url, forms in form_dict.items():
245 | parsed = datanize(forms, tolerate=True)
246 | if parsed:
247 | found = True
248 | break
249 | if found:
250 | break
251 |
252 | if not parsed:
253 | quit('%s No suitable form found for testing.' % bad)
254 |
255 | origGET = parsed[0]
256 | origUrl = parsed[1]
257 | origData = parsed[2]
258 |
259 | print ('%s Making a request with CSRF token for comparison.' % run)
260 | response = requester(origUrl, origData, headers, origGET, 0)
261 | originalCode = response.status_code
262 | originalLength = len(response.text)
263 | print ('%s Status Code: %s' % (info, originalCode))
264 | print ('%s Content Length: %i' % (info, originalLength))
265 | print ('%s Checking if the resonse is dynamic.' % run)
266 | response = requester(origUrl, origData, headers, origGET, 0)
267 | secondLength = len(response.text)
268 | if originalLength != secondLength:
269 | print ('%s Response is dynamic.' % info)
270 | tolerableDifference = abs(originalLength - secondLength)
271 | else:
272 | print ('%s Response isn\'t dynamic.' % info)
273 | tolerableDifference = 0
274 |
275 | print ('%s Emulating a mobile browser' % run)
276 | print ('%s Making a request with mobile browser' % run)
277 | headers['User-Agent'] = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows CE; PPC; 240x320)'
278 | response = requester(origUrl, {}, headers, True, 0).text
279 | parsed = zetanize(origUrl, response)
280 | if isProtected(parsed):
281 | print ('%s CSRF protection is enabled for mobile browsers as well.' % bad)
282 | else:
283 | print ('%s CSRF protection isn\'t enabled for mobile browsers.' % good)
284 |
285 | print ('%s Making a request without CSRF token parameter.' % run)
286 |
287 | data = tweaker(origData, 'remove')
288 | response = requester(origUrl, data, headers, origGET, 0)
289 | if response.status_code == originalCode:
290 | if str(originalCode)[0] in ['4', '5']:
291 | print ('%s It didn\'t work' % bad)
292 | else:
293 | difference = abs(originalLength - len(response.text))
294 | if difference <= tolerableDifference:
295 | print ('%s It worked!' % good)
296 | else:
297 | print ('%s It didn\'t work' % bad)
298 |
299 | print ('%s Making a request without CSRF token parameter value.' % run)
300 | data = tweaker(origData, 'clear')
301 |
302 | response = requester(origUrl, data, headers, origGET, 0)
303 | if response.status_code == originalCode:
304 | if str(originalCode)[0] in ['4', '5']:
305 | print ('%s It didn\'t work' % bad)
306 | else:
307 | difference = abs(originalLength - len(response.text))
308 | if difference <= tolerableDifference:
309 | print ('%s It worked!' % good)
310 | else:
311 | print ('%s It didn\'t work' % bad)
312 |
313 |
314 | seeds = ranger(allTokens)
315 |
316 | print ('%s Checking if tokens are checked to a specific length' % run)
317 |
318 | for index in range(len(allTokens[0])):
319 | data = tweaker(origData, 'replace', index=index, seeds=seeds)
320 | response = requester(origUrl, data, headers, origGET, 0)
321 | if response.status_code == originalCode:
322 | if str(originalCode)[0] in ['4', '5']:
323 | break
324 | else:
325 | difference = abs(originalLength - len(response.text))
326 | if difference <= tolerableDifference:
327 | print ('%s Last %i chars of token aren\'t being checked' %
328 | (good, index + 1))
329 | else:
330 | break
331 |
332 | print ('%s Generating a fake token.' % run)
333 |
334 | data = tweaker(origData, 'generate', seeds=seeds)
335 | print ('%s Making a request with the self generated token.' % run)
336 |
337 | response = requester(origUrl, data, headers, origGET, 0)
338 | if response.status_code == originalCode:
339 | if str(originalCode)[0] in ['4', '5']:
340 | print ('%s It didn\'t work' % bad)
341 | else:
342 | difference = abs(originalLength - len(response.text))
343 | if difference <= tolerableDifference:
344 | print ('%s It worked!' % good)
345 | else:
346 | print ('%s It didn\'t work' % bad)
347 |
348 | print (' %s Phase: Analysing %s[%s6/6%s]%s' %
349 | (lightning, green, end, green, end))
350 |
351 | binary = stringToBinary(''.join(allTokens))
352 | result = isRandom(binary)
353 | for name, result in result.items():
354 | if not result:
355 | print ('%s %s : %s%s%s' % (good, name, green, 'non-random', end))
356 | else:
357 | print ('%s %s : %s%s%s' % (bad, name, red, 'random', end))
358 |
--------------------------------------------------------------------------------
/core/entropy.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import numpy as np
4 | from math import floor, log
5 | import scipy.special as spc
6 | import scipy.fftpack as sff
7 | import scipy.stats as sst
8 | from functools import reduce
9 |
10 |
11 | def sumi(x): return 2 * x - 1
12 |
13 |
14 | def su(x, y): return x + y
15 |
16 |
17 | def sus(x): return (x - 0.5) ** 2
18 |
19 |
20 | def sq(x): return int(x) ** 2
21 |
22 |
23 | def logo(x): return x * np.log(x)
24 |
25 |
26 | def pr(u, x):
27 | if u == 0:
28 | out = 1.0 * np.exp(-x)
29 | else:
30 | out = 1.0 * x * np.exp(2*-x) * (2**-u) * spc.hyp1f1(u + 1, 2, x)
31 | return out
32 |
33 |
34 | def stringpart(binin, num):
35 | blocks = [binin[xs * num:num + xs * num:]
36 | for xs in range(floor(len(binin) / num))]
37 | return blocks
38 |
39 |
40 | def randgen(num):
41 | '''Spits out a stream of random numbers like '1001001' with the length num'''
42 |
43 | rn = open('/dev/urandom', 'r')
44 | random_chars = rn.read(num / 2)
45 | stream = ''
46 | for char in random_chars:
47 | c = ord(char)
48 | for i in range(0, 2):
49 | stream += str(c >> i & 1)
50 | return stream
51 |
52 |
53 | def monobitfrequencytest(binin):
54 | ''' The focus of the test is the proportion of zeroes and ones for the entire sequence. The purpose of this test is to determine whether that number of ones and zeros in a sequence are approximately the same as would be expected for a truly random sequence. The test assesses the closeness of the fraction of ones to 1/2, that is, the number of ones and zeroes in a sequence should be about the same.'''
55 |
56 | ss = [int(el) for el in binin]
57 | sc = list(map(sumi, ss))
58 | sn = reduce(su, sc)
59 | sobs = np.abs(sn) / np.sqrt(len(binin))
60 | pval = spc.erfc(sobs / np.sqrt(2))
61 | return pval
62 |
63 |
64 | def blockfrequencytest(binin, nu=20):
65 | ''' The focus of the test is the proportion of zeroes and ones within M-bit blocks. The purpose of this test is to determine whether the frequency of ones is an M-bit block is approximately M/2.'''
66 | ss = [int(el) for el in binin]
67 | tt = [1.0 * sum(ss[xs * nu:nu + xs * nu:]) /
68 | nu for xs in range(floor(len(ss) / nu))]
69 | uu = list(map(sus, tt))
70 | chisqr = 4 * nu * reduce(su, uu, 0)
71 | pval = spc.gammaincc(len(tt) / 2.0, chisqr / 2.0)
72 | return pval
73 |
74 |
75 | def runstest(binin):
76 | ''' The focus of this test is the total number of zero and one runs in the entire sequence, where a run is an uninterrupted sequence of identical bits. A run of length k means that a run consists of exactly k identical bits and is bounded before and after with a bit of the opposite value. The purpose of the runs test is to determine whether the number of runs of ones and zeros of various lengths is as expected for a random sequence. In particular, this test determines whether the oscillation between such substrings is too fast or too slow.'''
77 | ss = [int(el) for el in binin]
78 | n = len(binin)
79 | pi = 1.0 * reduce(su, ss) / n
80 | vobs = len(binin.replace('0', ' ').split()) + \
81 | len(binin.replace('1', ' ').split())
82 | pval = spc.erfc(abs(vobs-2*n*pi*(1-pi)) /
83 | (2 * pi * (1 - pi) * np.sqrt(2*n)))
84 | return pval
85 |
86 |
87 | def longestrunones8(binin):
88 | ''' The focus of the test is the longest run of ones within M-bit blocks. The purpose of this test is to determine whether the length of the longest run of ones within the tested sequence is consistent with the length of the longest run of ones that would be expected in a random sequence. Note that an irregularity in the expected length of the longest run of ones implies that there is also an irregularity in the expected length of the longest run of zeroes. Long runs of zeroes were not evaluated separately due to a concern about statistical independence among the tests.'''
89 | m = 8
90 | k = 3
91 | pik = [0.2148, 0.3672, 0.2305, 0.1875]
92 | blocks = [binin[xs*m:m+xs*m:] for xs in range(len(binin) / m)]
93 | n = len(blocks)
94 | # append the string 01 to guarantee the length of 1
95 | counts1 = [xs+'01' for xs in blocks]
96 | counts = [xs.replace('0', ' ').split()
97 | for xs in counts1] # split into all parts
98 | counts2 = [list(map(len, xx)) for xx in counts]
99 | counts4 = [(4 if xx > 4 else xx) for xx in map(max, counts2)]
100 | freqs = [counts4.count(spi) for spi in [1, 2, 3, 4]]
101 | chisqr1 = [(freqs[xx]-n*pik[xx])**2/(n*pik[xx]) for xx in range(4)]
102 | chisqr = reduce(su, chisqr1)
103 | pval = spc.gammaincc(k / 2.0, chisqr / 2.0)
104 | return pval
105 |
106 |
107 | def longestrunones128(binin): # not well tested yet
108 | if len(binin) > 128:
109 | m = 128
110 | k = 5
111 | n = len(binin)
112 | pik = [0.1174, 0.2430, 0.2493, 0.1752, 0.1027, 0.1124]
113 | blocks = [binin[xs * m:m + xs * m:] for xs in range(len(binin) / m)]
114 | n = len(blocks)
115 | counts = [xs.replace('0', ' ').split() for xs in blocks]
116 | counts2 = [list(map(len, xx)) for xx in counts]
117 | counts3 = [(1 if xx < 1 else xx) for xx in map(max, counts2)]
118 | counts4 = [(4 if xx > 4 else xx) for xx in counts3]
119 | chisqr1 = [(counts4[xx] - n * pik[xx]) ** 2 / (n * pik[xx])
120 | for xx in range(len(counts4))]
121 | chisqr = reduce(su, chisqr1)
122 | pval = spc.gammaincc(k / 2.0, chisqr / 2.0)
123 | else:
124 | print('longestrunones128 failed, too few bits:', len(binin))
125 | pval = 0
126 | return pval
127 |
128 |
129 | def longestrunones10000(binin): # not well tested yet
130 | ''' The focus of the test is the longest run of ones within M-bit blocks. The purpose of this test is to determine whether the length of the longest run of ones within the tested sequence is consistent with the length of the longest run of ones that would be expected in a random sequence. Note that an irregularity in the expected length of the longest run of ones implies that there is also an irregularity in the expected length of the longest run of zeroes. Long runs of zeroes were not evaluated separately due to a concern about statistical independence among the tests.'''
131 | if len(binin) > 128:
132 | m = 10000
133 | k = 6
134 | pik = [0.0882, 0.2092, 0.2483, 0.1933, 0.1208, 0.0675, 0.0727]
135 | blocks = [binin[xs * m:m + xs * m:]
136 | for xs in range(floor(len(binin) / m))]
137 | n = len(blocks)
138 | counts = [xs.replace('0', ' ').split() for xs in blocks]
139 | counts2 = [list(map(len, xx)) for xx in counts]
140 | counts3 = [(10 if xx < 10 else xx) for xx in map(max, counts2)]
141 | counts4 = [(16 if xx > 16 else xx) for xx in counts3]
142 | freqs = [counts4.count(spi) for spi in [10, 11, 12, 13, 14, 15, 16]]
143 | chisqr1 = [(freqs[xx] - n * pik[xx]) ** 2 / (n * pik[xx])
144 | for xx in range(len(freqs))]
145 | chisqr = reduce(su, chisqr1)
146 | pval = spc.gammaincc(k / 2.0, chisqr / 2.0)
147 | else:
148 | print('longestrunones10000 failed, too few bits:', len(binin))
149 | pval = 0
150 | return pval
151 |
152 | # test 2.06
153 |
154 |
155 | def spectraltest(binin):
156 | '''The focus of this test is the peak heights in the discrete Fast Fourier Transform. The purpose of this test is to detect periodic features (i.e., repetitive patterns that are near each other) in the tested sequence that would indicate a deviation from the assumption of randomness. '''
157 |
158 | n = len(binin)
159 | ss = [int(el) for el in binin]
160 | sc = list(map(sumi, ss))
161 | ft = sff.fft(sc)
162 | af = abs(ft)[1:floor(n/2)+1:]
163 | t = np.sqrt(np.log(1/0.05)*n)
164 | n0 = 0.95*n/2
165 | n1 = len(np.where(af < t)[0])
166 | d = (n1 - n0)/np.sqrt(n*0.95*0.05/4)
167 | pval = spc.erfc(abs(d)/np.sqrt(2))
168 | return pval
169 |
170 |
171 | def nonoverlappingtemplatematchingtest(binin, mat="000000001", num=9):
172 | ''' The focus of this test is the number of occurrences of pre-defined target substrings. The purpose of this test is to reject sequences that exhibit too many occurrences of a given non-periodic (aperiodic) pattern. For this test and for the Overlapping Template Matching test, an m-bit window is used to search for a specific m-bit pattern. If the pattern is not found, the window slides one bit position. For this test, when the pattern is found, the window is reset to the bit after the found pattern, and the search resumes.'''
173 | n = len(binin)
174 | m = len(mat)
175 | M = floor(n/num)
176 | blocks = [binin[xs*M:M+xs*M:] for xs in range(floor(n/M))]
177 | counts = [xx.count(mat) for xx in blocks]
178 | avg = 1.0 * (M-m+1)/2 ** m
179 | var = M*(2**-m - (2*m-1)*2**(-2*m))
180 | chisqr = reduce(su, [(xs - avg) ** 2 for xs in counts]) / var
181 | pval = spc.gammaincc(1.0 * len(blocks) / 2, chisqr / 2)
182 | return pval
183 |
184 |
185 | def occurances(string, sub):
186 | count = start = 0
187 | while True:
188 | start = string.find(sub, start)+1
189 | if start > 0:
190 | count += 1
191 | else:
192 | return count
193 |
194 |
195 | def overlappingtemplatematchingtest(binin, mat="111111111", num=1032, numi=9):
196 | ''' The focus of this test is the number of pre-defined target substrings. The purpose of this test is to reject sequences that show deviations from the expected number of runs of ones of a given length. Note that when there is a deviation from the expected number of ones of a given length, there is also a deviation in the runs of zeroes. Runs of zeroes were not evaluated separately due to a concern about statistical independence among the tests. For this test and for the Non-overlapping Template Matching test, an m-bit window is used to search for a specific m-bit pattern. If the pattern is not found, the window slides one bit position. For this test, when the pattern is found, the window again slides one bit, and the search is resumed.'''
197 | n = len(binin)
198 | bign = int(n / num)
199 | m = len(mat)
200 | lamda = 1.0 * (num - m + 1) / 2 ** m
201 | eta = 0.5 * lamda
202 | pi = [pr(i, eta) for i in range(numi)]
203 | pi.append(1 - reduce(su, pi))
204 | v = [0 for x in range(numi + 1)]
205 | blocks = stringpart(binin, num)
206 | blocklen = len(blocks[0])
207 | counts = [occurances(i, mat) for i in blocks]
208 | counts2 = [(numi if xx > numi else xx) for xx in counts]
209 | for i in counts2:
210 | v[i] = v[i] + 1
211 | chisqr = reduce(su, [(v[i]-bign*pi[i]) ** 2 / (bign*pi[i])
212 | for i in range(numi + 1)])
213 | pval = spc.gammaincc(0.5*numi, 0.5*chisqr)
214 | return pval
215 |
216 |
217 | def maurersuniversalstatistictest(binin, l=6, q=640):
218 | ''' The focus of this test is the number of bits between matching patterns. The purpose of the test is to detect whether or not the sequence can be significantly compressed without loss of information. An overly compressible sequence is considered to be non-random.'''
219 | ru = [
220 | [0.7326495, 0.690],
221 | [1.5374383, 1.338],
222 | [2.4016068, 1.901],
223 | [3.3112247, 2.358],
224 | [4.2534266, 2.705],
225 | [5.2177052, 2.954],
226 | [6.1962507, 3.125],
227 | [7.1836656, 3.238],
228 | [8.1764248, 3.311],
229 | [9.1723243, 3.356],
230 | [10.170032, 3.384],
231 | [11.168765, 3.401],
232 | [12.168070, 3.410],
233 | [13.167693, 3.416],
234 | [14.167488, 3.419],
235 | [15.167379, 3.421],
236 | ]
237 | blocks = [int(li, 2) + 1 for li in stringpart(binin, l)]
238 | k = len(blocks) - q
239 | states = [0 for x in range(2**l)]
240 | for x in range(q):
241 | states[blocks[x]-1] = x+1
242 | sumi = 0.0
243 | for x in range(q, len(blocks)):
244 | sumi += np.log2((x+1)-states[blocks[x]-1])
245 | states[blocks[x]-1] = x+1
246 | fn = sumi / k
247 | c = 0.7-(0.8/l)+(4+(32.0/l))*((k**(-3.0/l))/15)
248 | sigma = c*np.sqrt((ru[l-1][1])/k)
249 | pval = spc.erfc(abs(fn-ru[l-1][0]) / (np.sqrt(2)*sigma))
250 | return pval
251 |
252 |
253 | def lempelzivcompressiontest1(binin):
254 | ''' The focus of this test is the number of cumulatively distinct patterns (words) in the sequence. The purpose of the test is to determine how far the tested sequence can be compressed. The sequence is considered to be non-random if it can be significantly compressed. A random sequence will have a characteristic number of distinct patterns.'''
255 | i = 1
256 | j = 0
257 | n = len(binin)
258 | mu = 69586.25
259 | sigma = 70.448718
260 | words = []
261 | while (i+j) <= n:
262 | tmp = binin[i:i+j:]
263 | if words.count(tmp) > 0:
264 | j += 1
265 | else:
266 | words.append(tmp)
267 | i += j+1
268 | j = 0
269 | wobs = len(words)
270 | pval = 0.5*spc.erfc((mu-wobs)/np.sqrt(2.0*sigma))
271 | return pval
272 |
273 | # test 2.11
274 |
275 |
276 | def serialtest(binin):
277 | m = int(log(len(binin), 2) - 3)
278 | ''' The focus of this test is the frequency of each and every overlapping m-bit pattern across the entire sequence. The purpose of this test is to determine whether the number of occurrences of the 2m m-bit overlapping patterns is approximately the same as would be expected for a random sequence. The pattern can overlap.'''
279 | n = len(binin)
280 | hbin = binin+binin[0:m-1:]
281 | f1a = [hbin[xs:m+xs:] for xs in range(n)]
282 | oo = set(f1a)
283 | f1 = [f1a.count(xs)**2 for xs in oo]
284 | f1 = list(map(f1a.count, oo))
285 | cou = f1a.count
286 | f2a = [hbin[xs:m-1+xs:] for xs in range(n)]
287 | f2 = [f2a.count(xs)**2 for xs in set(f2a)]
288 | f3a = [hbin[xs:m-2+xs:] for xs in range(n)]
289 | f3 = [f3a.count(xs)**2 for xs in set(f3a)]
290 | psim1 = 0
291 | psim2 = 0
292 | psim3 = 0
293 | if m >= 0:
294 | suss = reduce(su, f1)
295 | psim1 = 1.0 * 2 ** m * suss / n - n
296 | if m >= 1:
297 | suss = reduce(su, f2)
298 | psim2 = 1.0 * 2 ** (m - 1) * suss / n - n
299 | if m >= 2:
300 | suss = reduce(su, f3)
301 | psim3 = 1.0 * 2 ** (m - 2) * suss / n - n
302 | d1 = psim1-psim2
303 | d2 = psim1-2 * psim2 + psim3
304 | pval1 = spc.gammaincc(2 ** (m - 2), d1 / 2.0)
305 | pval2 = spc.gammaincc(2 ** (m - 3), d2 / 2.0)
306 | return [pval1, pval2]
307 |
308 |
309 | def cumultativesumstest(binin):
310 | ''' The focus of this test is the maximal excursion (from zero) of the random walk defined by the cumulative sum of adjusted (-1, +1) digits in the sequence. The purpose of the test is to determine whether the cumulative sum of the partial sequences occurring in the tested sequence is too large or too small relative to the expected behavior of that cumulative sum for random sequences. This cumulative sum may be considered as a random walk. For a random sequence, the random walk should be near zero. For non-random sequences, the excursions of this random walk away from zero will be too large.'''
311 | n = len(binin)
312 | ss = [int(el) for el in binin]
313 | sc = list(map(sumi, ss))
314 | cs = np.cumsum(sc)
315 | z = max(abs(cs))
316 | ra = 0
317 | start = int(np.floor(0.25 * np.floor(-n / z) + 1))
318 | stop = int(np.floor(0.25 * np.floor(n / z) - 1))
319 | pv1 = []
320 | for k in range(start, stop + 1):
321 | pv1.append(sst.norm.cdf((4 * k + 1) * z / np.sqrt(n)) -
322 | sst.norm.cdf((4 * k - 1) * z / np.sqrt(n)))
323 | start = int(np.floor(0.25 * np.floor(-n / z - 3)))
324 | stop = int(np.floor(0.25 * np.floor(n / z) - 1))
325 | pv2 = []
326 | for k in range(start, stop + 1):
327 | pv2.append(sst.norm.cdf((4 * k + 3) * z / np.sqrt(n)) -
328 | sst.norm.cdf((4 * k + 1) * z / np.sqrt(n)))
329 | pval = 1
330 | pval -= reduce(su, pv1)
331 | pval += reduce(su, pv2)
332 |
333 | return pval
334 |
335 |
336 | def cumultativesumstestreverse(binin):
337 | '''The focus of this test is the maximal excursion (from zero) of the random walk defined by the cumulative sum of adjusted (-1, +1) digits in the sequence. The purpose of the test is to determine whether the cumulative sum of the partial sequences occurring in the tested sequence is too large or too small relative to the expected behavior of that cumulative sum for random sequences. This cumulative sum may be considered as a random walk. For a random sequence, the random walk should be near zero. For non-random sequences, the excursions of this random walk away from zero will be too large. '''
338 | pval = cumultativesumstest(binin[::-1])
339 | return pval
340 |
341 |
342 | def pik(k, x):
343 | if k == 0:
344 | out = 1-1.0/(2*np.abs(x))
345 | elif k >= 5:
346 | out = (1.0/(2*np.abs(x)))*(1-1.0/(2*np.abs(x)))**4
347 | else:
348 | out = (1.0/(4*x*x))*(1-1.0/(2*np.abs(x)))**(k-1)
349 | return out
350 |
351 |
352 | def randomexcursionstest(binin):
353 | ''' The focus of this test is the number of cycles having exactly K visits in a cumulative sum random walk. The cumulative sum random walk is found if partial sums of the (0,1) sequence are adjusted to (-1, +1). A random excursion of a random walk consists of a sequence of n steps of unit length taken at random that begin at and return to the origin. The purpose of this test is to determine if the number of visits to a state within a random walk exceeds what one would expect for a random sequence.'''
354 | xvals = [-4, -3, -2, -1, 1, 2, 3, 4]
355 | ss = [int(el) for el in binin]
356 | sc = list(map(sumi, ss))
357 | cumsum = np.cumsum(sc)
358 | cumsum = np.append(cumsum, 0)
359 | cumsum = np.append(0, cumsum)
360 | posi = np.where(cumsum == 0)[0]
361 | cycles = ([cumsum[posi[x]:posi[x+1]+1] for x in range(len(posi)-1)])
362 | j = len(cycles)
363 | sct = []
364 | for ii in cycles:
365 | sct.append(([len(np.where(ii == xx)[0]) for xx in xvals]))
366 | sct = np.transpose(np.clip(sct, 0, 5))
367 | su = []
368 | for ii in range(6):
369 | su.append([(xx == ii).sum() for xx in sct])
370 | su = np.transpose(su)
371 | pikt = ([([pik(uu, xx) for uu in range(6)]) for xx in xvals])
372 | # chitab=1.0*((su-j*pikt)**2)/(j*pikt)
373 | chitab = np.sum(1.0*(np.array(su)-j*np.array(pikt))
374 | ** 2/(j*np.array(pikt)), axis=1)
375 | pval = ([spc.gammaincc(2.5, cs/2.0) for cs in chitab])
376 | return pval
377 |
378 |
379 | def getfreq(linn, nu):
380 | val = 0
381 | for (x, y) in linn:
382 | if x == nu:
383 | val = y
384 | return val
385 |
386 |
387 | def randomexcursionsvarianttest(binin):
388 | ''' The focus of this test is the number of times that a particular state occurs in a cumulative sum random walk. The purpose of this test is to detect deviations from the expected number of occurrences of various states in the random walk.'''
389 | ss = [int(el) for el in binin]
390 | sc = list(map(sumi, ss))
391 | cs = np.cumsum(sc)
392 | li = []
393 | for xs in sorted(set(cs)):
394 | if np.abs(xs) <= 9:
395 | li.append([xs, len(np.where(cs == xs)[0])])
396 | j = getfreq(li, 0) + 1
397 | pval = []
398 | for xs in range(-9, 9 + 1):
399 | if not xs == 0:
400 | # pval.append([xs, spc.erfc(np.abs(getfreq(li, xs) - j) / np.sqrt(2 * j * (4 * np.abs(xs) - 2)))])
401 | pval.append(spc.erfc(np.abs(getfreq(li, xs) - j) /
402 | np.sqrt(2 * j * (4 * np.abs(xs) - 2))))
403 | return pval
404 |
405 |
406 | def aproximateentropytest(binin, m=5):
407 | ''' The focus of this test is the frequency of each and every overlapping m-bit pattern. The purpose of the test is to compare the frequency of overlapping blocks of two consecutive/adjacent lengths (m and m+1) against the expected result for a random sequence.'''
408 | n = len(binin)
409 | f1a = [(binin + binin[0:m - 1:])[xs:m + xs:] for xs in range(n)]
410 | f1 = [[xs, f1a.count(xs)] for xs in sorted(set(f1a))]
411 | f2a = [(binin + binin[0:m:])[xs:m + 1 + xs:] for xs in range(n)]
412 | f2 = [[xs, f2a.count(xs)] for xs in sorted(set(f2a))]
413 | c1 = [1.0 * f1[xs][1] / n for xs in range(len(f1))]
414 | c2 = [1.0 * f2[xs][1] / n for xs in range(len(f2))]
415 | phi1 = reduce(su, list(map(logo, c1)))
416 | phi2 = reduce(su, list(map(logo, c2)))
417 | apen = phi1 - phi2
418 | chisqr = 2.0 * n * (np.log(2) - apen)
419 | pval = spc.gammaincc(2 ** (m - 1), chisqr / 2.0)
420 | return pval
421 |
422 |
423 | def matrank(mat): # old function, does not work as advertized - gives the matrix rank, but not binary
424 | u, s, v = np.linalg.svd(mat)
425 | rank = np.sum(s > 1e-10)
426 | return rank
427 |
428 |
429 | def mrank(matrix): # matrix rank as defined in the NIST specification
430 | m = len(matrix)
431 | leni = len(matrix[0])
432 |
433 | def proc(mat):
434 | for i in range(m):
435 | if mat[i][i] == 0:
436 | for j in range(i+1, m):
437 | if mat[j][i] == 1:
438 | mat[j], mat[i] = mat[i], mat[j]
439 | break
440 | if mat[i][i] == 1:
441 | for j in range(i+1, m):
442 | if mat[j][i] == 1:
443 | mat[j] = [mat[i][x] ^ mat[j][x] for x in range(leni)]
444 | return mat
445 | maa = proc(matrix)
446 | maa.reverse()
447 | mu = [i[::-1] for i in maa]
448 | muu = proc(mu)
449 | ra = np.sum(np.sign([xx.sum() for xx in np.array(mu)]))
450 | return ra
451 |
452 |
453 | def binarymatrixranktest(binin, m=32, q=32):
454 | ''' The focus of the test is the rank of disjoint sub-matrices of the entire sequence. The purpose of this test is to check for linear dependence among fixed length substrings of the original sequence.'''
455 | p1 = 1.0
456 | for x in range(1, 50):
457 | p1 *= 1-(1.0/(2**x))
458 | p2 = 2*p1
459 | p3 = 1-p1-p2
460 | n = len(binin)
461 | # the input string as numbers, to generate the dot product
462 | u = [int(el) for el in binin]
463 | f1a = [u[xs*m:xs*m+m:] for xs in range(floor(n/m))]
464 | n = len(f1a)
465 | f2a = [f1a[xs*q:xs*q+q:] for xs in range(floor(n/q))]
466 | # r=map(matrank,f2a)
467 | r = list(map(mrank, f2a))
468 | n = len(r)
469 | fm = r.count(m)
470 | fm1 = r.count(m-1)
471 | chisqr = ((fm-p1*n)**2)/(p1*n)+((fm1-p2*n)**2) / \
472 | (p2*n)+((n-fm-fm1-p3*n)**2)/(p3*n)
473 | pval = np.exp(-0.5*chisqr)
474 | return pval
475 |
476 |
477 | def lincomplex(binin):
478 | lenn = len(binin)
479 | c = b = np.zeros(lenn)
480 | c[0] = b[0] = 1
481 | l = 0
482 | m = -1
483 | n = 0
484 | # the input string as numbers, to generate the dot product
485 | u = [int(el) for el in binin]
486 | p = 99
487 | while n < lenn:
488 | v = u[(n-l):n] # was n-l..n-1
489 | v.reverse()
490 | cc = c[1:l+1] # was 2..l+1
491 | d = (u[n]+np.dot(v, cc)) % 2
492 | if d == 1:
493 | tmp = c
494 | p = np.zeros(lenn)
495 | for i in range(0, l): # was 1..l+1
496 | if b[i] == 1:
497 | p[i+n-m] = 1
498 | c = (c+p) % 2
499 | if l <= 0.5*n: # was if 2l <= n
500 | l = n+1-l
501 | m = n
502 | b = tmp
503 | n += 1
504 | return l
505 |
506 | # test 2.10
507 |
508 |
509 | def linearcomplexitytest(binin, m=500):
510 | ''' The focus of this test is the length of a generating feedback register. The purpose of this test is to determine whether or not the sequence is complex enough to be considered random. Random sequences are characterized by a longer feedback register. A short feedback register implies non-randomness.'''
511 | k = 6
512 | pi = [0.01047, 0.03125, 0.125, 0.5, 0.25, 0.0625, 0.020833]
513 | avg = 0.5*m + (1.0/36)*(9 + (-1)**(m + 1)) - (m/3.0 + 2.0/9)/2**m
514 | blocks = stringpart(binin, m)
515 | bign = len(blocks)
516 | lc = ([lincomplex(chunk) for chunk in blocks])
517 | t = ([-1.0*(((-1)**m)*(chunk-avg)+2.0/9) for chunk in lc])
518 | vg = np.histogram(t, bins=[-9999999999, -2.5, -
519 | 1.5, -0.5, 0.5, 1.5, 2.5, 9999999999])[0][::-1]
520 | im = ([((vg[ii]-bign*pi[ii])**2)/(bign*pi[ii]) for ii in range(7)])
521 | chisqr = reduce(su, im)
522 | pval = spc.gammaincc(k/2.0, chisqr/2.0)
523 | return pval
524 |
525 |
526 | def isRandom(bits):
527 | result = {}
528 |
529 | def adder(name, p):
530 | if 'list' in str(type(p)):
531 | count = 0
532 | for i in p:
533 | if 'nan' in str(i):
534 | pass
535 | elif 'e' in str(i):
536 | pass
537 | elif i > 0.01:
538 | pass
539 | else:
540 | count += 1
541 | if count >= (len(p)/2):
542 | result[name] = False
543 | else:
544 | result[name] = True
545 | elif 'e' in str(p):
546 | pass
547 | elif p > 0.01:
548 | result[name] = True
549 | else:
550 | result[name] = False
551 | try:
552 | adder('Monobit frequency test', monobitfrequencytest(bits[:100]))
553 | except:
554 | pass
555 | try:
556 | adder('Block frequency test', blockfrequencytest(bits[:2000]))
557 | except:
558 | pass
559 | try:
560 | adder('Runs test', runstest(bits))
561 | except:
562 | pass
563 | try:
564 | adder('Spectral test', spectraltest(bits[:1024]))
565 | except:
566 | pass
567 | try:
568 | adder('Non-overlapping template matching test',
569 | nonoverlappingtemplatematchingtest(bits[:1048576], '11111', 8))
570 | except:
571 | pass
572 | try:
573 | adder('Overlapping template matching test',
574 | overlappingtemplatematchingtest(bits[:998976], '0000001', 12, 5))
575 | except:
576 | pass
577 | try:
578 | adder('Serial test', serialtest(bits[:500]))
579 | except:
580 | pass
581 | try:
582 | adder('Cumultative sums test', cumultativesumstest(bits[:100]))
583 | except:
584 | pass
585 | try:
586 | adder('Aproximate entropy test', aproximateentropytest(bits[:500], 5))
587 | except:
588 | pass
589 | try:
590 | adder('Random excursions variant test',
591 | randomexcursionsvarianttest(bits[:1000000]))
592 | except:
593 | pass
594 | try:
595 | adder('Linear complexity test',
596 | linearcomplexitytest(bits[:1000000], 10))
597 | except:
598 | pass
599 | try:
600 | adder('Longest runs test', longestrunones10000(bits))
601 | except:
602 | pass
603 | try:
604 | adder('Maurers universal statistic test',
605 | maurersuniversalstatistictest(bits[:387840], 6, 640))
606 | except:
607 | pass
608 | try:
609 | adder('Random excursions test', randomexcursionstest(bits[:1000000]))
610 | except:
611 | pass
612 | return result
613 |
--------------------------------------------------------------------------------
/db/hashes.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "regex": "^[a-f0-9]{4}$",
4 | "matches": [
5 | "CRC-16",
6 | "CRC-16-CCITT",
7 | "FCS-16"
8 | ]
9 | },
10 | {
11 | "regex": "^[a-f0-9]{8}$",
12 | "matches": [
13 | "Adler-32",
14 | "CRC-32B",
15 | "FCS-32",
16 | "GHash-32-3",
17 | "GHash-32-5",
18 | "FNV-132",
19 | "Fletcher-32",
20 | "Joaat",
21 | "ELF-32",
22 | "XOR-32"
23 | ]
24 | },
25 | {
26 | "regex": "^[a-f0-9]{6}$",
27 | "matches": [
28 | "CRC-24"
29 | ]
30 | },
31 | {
32 | "regex": "^(\\$crc32\\$[a-f0-9]{8}.)?[a-f0-9]{8}$",
33 | "matches": [
34 | "CRC-32"
35 | ]
36 | },
37 | {
38 | "regex": "^\\+[a-z0-9\\/.]{12}$",
39 | "matches": [
40 | "Eggdrop IRC Bot"
41 | ]
42 | },
43 | {
44 | "regex": "^[a-z0-9\\/.]{13}$",
45 | "matches": [
46 | "DES(Unix)",
47 | "Traditional DES",
48 | "DEScrypt"
49 | ]
50 | },
51 | {
52 | "regex": "^[a-f0-9]{16}$",
53 | "matches": [
54 | "MySQL323",
55 | "DES(Oracle)",
56 | "Half MD5",
57 | "Oracle 7-10g",
58 | "FNV-164",
59 | "CRC-64"
60 | ]
61 | },
62 | {
63 | "regex": "^[a-z0-9\\/.]{16}$",
64 | "matches": [
65 | "Cisco-PIX(MD5)"
66 | ]
67 | },
68 | {
69 | "regex": "^\\([a-z0-9\\/+]{20}\\)$",
70 | "matches": [
71 | "Lotus Notes/Domino 6"
72 | ]
73 | },
74 | {
75 | "regex": "^_[a-z0-9\\/.]{19}$",
76 | "matches": [
77 | "BSDi Crypt"
78 | ]
79 | },
80 | {
81 | "regex": "^[a-f0-9]{24}$",
82 | "matches": [
83 | "CRC-96(ZIP)"
84 | ]
85 | },
86 | {
87 | "regex": "^[a-z0-9\\/.]{24}$",
88 | "matches": [
89 | "Crypt16"
90 | ]
91 | },
92 | {
93 | "regex": "^(\\$md2\\$)?[a-f0-9]{32}$",
94 | "matches": [
95 | "MD2"
96 | ]
97 | },
98 | {
99 | "regex": "^[a-f0-9]{32}(:.+)?$",
100 | "matches": [
101 | "MD5",
102 | "MD4",
103 | "Double MD5",
104 | "LM",
105 | "RIPEMD-128",
106 | "Haval-128",
107 | "Tiger-128",
108 | "Skein-256(128)",
109 | "Skein-512(128)",
110 | "Lotus Notes/Domino 5",
111 | "Skype",
112 | "ZipMonster",
113 | "PrestaShop",
114 | "md5(md5(md5($pass)))",
115 | "md5(strtoupper(md5($pass)))",
116 | "md5(sha1($pass))",
117 | "md5($pass.$salt)",
118 | "md5($salt.$pass)",
119 | "md5(unicode($pass).$salt)",
120 | "md5($salt.unicode($pass))",
121 | "HMAC-MD5 (key = $pass)",
122 | "HMAC-MD5 (key = $salt)",
123 | "md5(md5($salt).$pass)",
124 | "md5($salt.md5($pass))",
125 | "md5($pass.md5($salt))",
126 | "md5($salt.$pass.$salt)",
127 | "md5(md5($pass).md5($salt))",
128 | "md5($salt.md5($salt.$pass))",
129 | "md5($salt.md5($pass.$salt))",
130 | "md5($username.0.$pass)"
131 | ]
132 | },
133 | {
134 | "regex": "^(\\$snefru\\$)?[a-f0-9]{32}$",
135 | "matches": [
136 | "Snefru-128"
137 | ]
138 | },
139 | {
140 | "regex": "^(\\$NT\\$)?[a-f0-9]{32}$",
141 | "matches": [
142 | "NTLM"
143 | ]
144 | },
145 | {
146 | "regex": "^([^\\\\\\/:*?\"<>|]{1,20}:)?[a-f0-9]{32}(:[^\\\\\\/:*?\"<>|]{1,20})?$",
147 | "matches": [
148 | "Domain Cached Credentials"
149 | ]
150 | },
151 | {
152 | "regex": "^([^\\\\\\/:*?\"<>|]{1,20}:)?(\\$DCC2\\$10240#[^\\\\\\/:*?\"<>|]{1,20}#)?[a-f0-9]{32}$",
153 | "matches": [
154 | "Domain Cached Credentials 2"
155 | ]
156 | },
157 | {
158 | "regex": "^{SHA}[a-z0-9\\/+]{27}=$",
159 | "matches": [
160 | "SHA-1(Base64)",
161 | "Netscape LDAP SHA"
162 | ]
163 | },
164 | {
165 | "regex": "^\\$1\\$[a-z0-9\\/.]{0,8}\\$[a-z0-9\\/.]{22}(:.*)?$",
166 | "matches": [
167 | "MD5 Crypt",
168 | "Cisco-IOS(MD5)",
169 | "FreeBSD MD5"
170 | ]
171 | },
172 | {
173 | "regex": "^0x[a-f0-9]{32}$",
174 | "matches": [
175 | "Lineage II C4"
176 | ]
177 | },
178 | {
179 | "regex": "^\\$H\\$[a-z0-9\\/.]{31}$",
180 | "matches": [
181 | "phpBB v3.x",
182 | "Wordpress v2.6.0/2.6.1",
183 | "PHPass' Portable Hash"
184 | ]
185 | },
186 | {
187 | "regex": "^\\$P\\$[a-z0-9\\/.]{31}$",
188 | "matches": [
189 | "Wordpress \u2265 v2.6.2",
190 | "Joomla \u2265 v2.5.18",
191 | "PHPass' Portable Hash"
192 | ]
193 | },
194 | {
195 | "regex": "^[a-f0-9]{32}:[a-z0-9]{2}$",
196 | "matches": [
197 | "osCommerce",
198 | "xt:Commerce"
199 | ]
200 | },
201 | {
202 | "regex": "^\\$apr1\\$[a-z0-9\\/.]{0,8}\\$[a-z0-9\\/.]{22}$",
203 | "matches": [
204 | "MD5(APR)",
205 | "Apache MD5",
206 | "md5apr1"
207 | ]
208 | },
209 | {
210 | "regex": "^{smd5}[a-z0-9$\\/.]{31}$",
211 | "matches": [
212 | "AIX(smd5)"
213 | ]
214 | },
215 | {
216 | "regex": "^[a-f0-9]{32}:[a-f0-9]{32}$",
217 | "matches": [
218 | "WebEdition CMS"
219 | ]
220 | },
221 | {
222 | "regex": "^[a-f0-9]{32}:.{5}$",
223 | "matches": [
224 | "IP.Board \u2265 v2+"
225 | ]
226 | },
227 | {
228 | "regex": "^[a-f0-9]{32}:.{8}$",
229 | "matches": [
230 | "MyBB \u2265 v1.2+"
231 | ]
232 | },
233 | {
234 | "regex": "^[a-z0-9]{34}$",
235 | "matches": [
236 | "CryptoCurrency(Adress)"
237 | ]
238 | },
239 | {
240 | "regex": "^[a-f0-9]{40}(:.+)?$",
241 | "matches": [
242 | "SHA-1",
243 | "Double SHA-1",
244 | "RIPEMD-160",
245 | "Haval-160",
246 | "Tiger-160",
247 | "HAS-160",
248 | "LinkedIn",
249 | "Skein-256(160)",
250 | "Skein-512(160)",
251 | "MangosWeb Enhanced CMS",
252 | "sha1(sha1(sha1($pass)))",
253 | "sha1(md5($pass))",
254 | "sha1($pass.$salt)",
255 | "sha1($salt.$pass)",
256 | "sha1(unicode($pass).$salt)",
257 | "sha1($salt.unicode($pass))",
258 | "HMAC-SHA1 (key = $pass)",
259 | "HMAC-SHA1 (key = $salt)",
260 | "sha1($salt.$pass.$salt)"
261 | ]
262 | },
263 | {
264 | "regex": "^\\*[a-f0-9]{40}$",
265 | "matches": [
266 | "MySQL5.x",
267 | "MySQL4.1"
268 | ]
269 | },
270 | {
271 | "regex": "^[a-z0-9]{43}$",
272 | "matches": [
273 | "Cisco-IOS(SHA-256)"
274 | ]
275 | },
276 | {
277 | "regex": "^{SSHA}[a-z0-9\\/+]{38}==$",
278 | "matches": [
279 | "SSHA-1(Base64)",
280 | "Netscape LDAP SSHA",
281 | "nsldaps"
282 | ]
283 | },
284 | {
285 | "regex": "^[a-z0-9=]{47}$",
286 | "matches": [
287 | "Fortigate(FortiOS)"
288 | ]
289 | },
290 | {
291 | "regex": "^[a-f0-9]{48}$",
292 | "matches": [
293 | "Haval-192",
294 | "Tiger-192",
295 | "SHA-1(Oracle)",
296 | "OSX v10.4",
297 | "OSX v10.5",
298 | "OSX v10.6"
299 | ]
300 | },
301 | {
302 | "regex": "^[a-f0-9]{51}$",
303 | "matches": [
304 | "Palshop CMS"
305 | ]
306 | },
307 | {
308 | "regex": "^[a-z0-9]{51}$",
309 | "matches": [
310 | "CryptoCurrency(PrivateKey)"
311 | ]
312 | },
313 | {
314 | "regex": "^{ssha1}[0-9]{2}\\$[a-z0-9$\\/.]{44}$",
315 | "matches": [
316 | "AIX(ssha1)"
317 | ]
318 | },
319 | {
320 | "regex": "^0x0100[a-f0-9]{48}$",
321 | "matches": [
322 | "MSSQL(2005)",
323 | "MSSQL(2008)"
324 | ]
325 | },
326 | {
327 | "regex": "^(\\$md5,rounds=[0-9]+\\$|\\$md5\\$rounds=[0-9]+\\$|\\$md5\\$)[a-z0-9\\/.]{0,16}(\\$|\\$\\$)[a-z0-9\\/.]{22}$",
328 | "matches": [
329 | "Sun MD5 Crypt"
330 | ]
331 | },
332 | {
333 | "regex": "^[a-f0-9]{56}$",
334 | "matches": [
335 | "SHA-224",
336 | "Haval-224",
337 | "SHA3-224",
338 | "Skein-256(224)",
339 | "Skein-512(224)"
340 | ]
341 | },
342 | {
343 | "regex": "^(\\$2[axy]|\\$2)\\$[0-9]{2}\\$[a-z0-9\\/.]{53}$",
344 | "matches": [
345 | "Blowfish(OpenBSD)",
346 | "Woltlab Burning Board 4.x",
347 | "bcrypt"
348 | ]
349 | },
350 | {
351 | "regex": "^[a-f0-9]{40}:[a-f0-9]{16}$",
352 | "matches": [
353 | "Android PIN"
354 | ]
355 | },
356 | {
357 | "regex": "^(S:)?[a-f0-9]{40}(:)?[a-f0-9]{20}$",
358 | "matches": [
359 | "Oracle 11g/12c"
360 | ]
361 | },
362 | {
363 | "regex": "^\\$bcrypt-sha256\\$(2[axy]|2)\\,[0-9]+\\$[a-z0-9\\/.]{22}\\$[a-z0-9\\/.]{31}$",
364 | "matches": [
365 | "bcrypt(SHA-256)"
366 | ]
367 | },
368 | {
369 | "regex": "^[a-f0-9]{32}:.{3}$",
370 | "matches": [
371 | "vBulletin < v3.8.5"
372 | ]
373 | },
374 | {
375 | "regex": "^[a-f0-9]{32}:.{30}$",
376 | "matches": [
377 | "vBulletin \u2265 v3.8.5"
378 | ]
379 | },
380 | {
381 | "regex": "^(\\$snefru\\$)?[a-f0-9]{64}$",
382 | "matches": [
383 | "Snefru-256"
384 | ]
385 | },
386 | {
387 | "regex": "^[a-f0-9]{64}(:.+)?$",
388 | "matches": [
389 | "SHA-256",
390 | "RIPEMD-256",
391 | "Haval-256",
392 | "GOST R 34.11-94",
393 | "GOST CryptoPro S-Box",
394 | "SHA3-256",
395 | "Skein-256",
396 | "Skein-512(256)",
397 | "Ventrilo",
398 | "sha256($pass.$salt)",
399 | "sha256($salt.$pass)",
400 | "sha256(unicode($pass).$salt)",
401 | "sha256($salt.unicode($pass))",
402 | "HMAC-SHA256 (key = $pass)",
403 | "HMAC-SHA256 (key = $salt)"
404 | ]
405 | },
406 | {
407 | "regex": "^[a-f0-9]{32}:[a-z0-9]{32}$",
408 | "matches": [
409 | "Joomla < v2.5.18"
410 | ]
411 | },
412 | {
413 | "regex": "^[a-f-0-9]{32}:[a-f-0-9]{32}$",
414 | "matches": [
415 | "SAM(LM_Hash:NT_Hash)"
416 | ]
417 | },
418 | {
419 | "regex": "^(\\$chap\\$0\\*)?[a-f0-9]{32}[\\*:][a-f0-9]{32}(:[0-9]{2})?$",
420 | "matches": [
421 | "MD5(Chap)",
422 | "iSCSI CHAP Authentication"
423 | ]
424 | },
425 | {
426 | "regex": "^\\$episerver\\$\\*0\\*[a-z0-9\\/=+]+\\*[a-z0-9\\/=+]{27,28}$",
427 | "matches": [
428 | "EPiServer 6.x < v4"
429 | ]
430 | },
431 | {
432 | "regex": "^{ssha256}[0-9]{2}\\$[a-z0-9$\\/.]{60}$",
433 | "matches": [
434 | "AIX(ssha256)"
435 | ]
436 | },
437 | {
438 | "regex": "^[a-f0-9]{80}$",
439 | "matches": [
440 | "RIPEMD-320"
441 | ]
442 | },
443 | {
444 | "regex": "^\\$episerver\\$\\*1\\*[a-z0-9\\/=+]+\\*[a-z0-9\\/=+]{42,43}$",
445 | "matches": [
446 | "EPiServer 6.x \u2265 v4"
447 | ]
448 | },
449 | {
450 | "regex": "^0x0100[a-f0-9]{88}$",
451 | "matches": [
452 | "MSSQL(2000)"
453 | ]
454 | },
455 | {
456 | "regex": "^[a-f0-9]{96}$",
457 | "matches": [
458 | "SHA-384",
459 | "SHA3-384",
460 | "Skein-512(384)",
461 | "Skein-1024(384)"
462 | ]
463 | },
464 | {
465 | "regex": "^{SSHA512}[a-z0-9\\/+]{96}$",
466 | "matches": [
467 | "SSHA-512(Base64)",
468 | "LDAP(SSHA-512)"
469 | ]
470 | },
471 | {
472 | "regex": "^{ssha512}[0-9]{2}\\$[a-z0-9\\/.]{16,48}\\$[a-z0-9\\/.]{86}$",
473 | "matches": [
474 | "AIX(ssha512)"
475 | ]
476 | },
477 | {
478 | "regex": "^[a-f0-9]{128}(:.+)?$",
479 | "matches": [
480 | "SHA-512",
481 | "Whirlpool",
482 | "Salsa10",
483 | "Salsa20",
484 | "SHA3-512",
485 | "Skein-512",
486 | "Skein-1024(512)",
487 | "sha512($pass.$salt)",
488 | "sha512($salt.$pass)",
489 | "sha512(unicode($pass).$salt)",
490 | "sha512($salt.unicode($pass))",
491 | "HMAC-SHA512 (key = $pass)",
492 | "HMAC-SHA512 (key = $salt)"
493 | ]
494 | },
495 | {
496 | "regex": "^[a-f0-9]{136}$",
497 | "matches": [
498 | "OSX v10.7"
499 | ]
500 | },
501 | {
502 | "regex": "^0x0200[a-f0-9]{136}$",
503 | "matches": [
504 | "MSSQL(2012)",
505 | "MSSQL(2014)"
506 | ]
507 | },
508 | {
509 | "regex": "^\\$ml\\$[0-9]+\\$[a-f0-9]{64}\\$[a-f0-9]{128}$",
510 | "matches": [
511 | "OSX v10.8",
512 | "OSX v10.9"
513 | ]
514 | },
515 | {
516 | "regex": "^[a-f0-9]{256}$",
517 | "matches": [
518 | "Skein-1024"
519 | ]
520 | },
521 | {
522 | "regex": "^grub\\.pbkdf2\\.sha512\\.[0-9]+\\.([a-f0-9]{128,2048}\\.|[0-9]+\\.)?[a-f0-9]{128}$",
523 | "matches": [
524 | "GRUB 2"
525 | ]
526 | },
527 | {
528 | "regex": "^sha1\\$[a-z0-9]+\\$[a-f0-9]{40}$",
529 | "matches": [
530 | "Django(SHA-1)"
531 | ]
532 | },
533 | {
534 | "regex": "^[a-f0-9]{49}$",
535 | "matches": [
536 | "Citrix Netscaler"
537 | ]
538 | },
539 | {
540 | "regex": "^\\$S\\$[a-z0-9\\/.]{52}$",
541 | "matches": [
542 | "Drupal > v7.x"
543 | ]
544 | },
545 | {
546 | "regex": "^\\$5\\$(rounds=[0-9]+\\$)?[a-z0-9\\/.]{0,16}\\$[a-z0-9\\/.]{43}$",
547 | "matches": [
548 | "SHA-256 Crypt"
549 | ]
550 | },
551 | {
552 | "regex": "^0x[a-f0-9]{4}[a-f0-9]{16}[a-f0-9]{64}$",
553 | "matches": [
554 | "Sybase ASE"
555 | ]
556 | },
557 | {
558 | "regex": "^\\$6\\$(rounds=[0-9]+\\$)?[a-z0-9\\/.]{0,16}\\$[a-z0-9\\/.]{86}$",
559 | "matches": [
560 | "SHA-512 Crypt"
561 | ]
562 | },
563 | {
564 | "regex": "^\\$sha\\$[a-z0-9]{1,16}\\$([a-f0-9]{32}|[a-f0-9]{40}|[a-f0-9]{64}|[a-f0-9]{128}|[a-f0-9]{140})$",
565 | "matches": [
566 | "Minecraft(AuthMe Reloaded)"
567 | ]
568 | },
569 | {
570 | "regex": "^sha256\\$[a-z0-9]+\\$[a-f0-9]{64}$",
571 | "matches": [
572 | "Django(SHA-256)"
573 | ]
574 | },
575 | {
576 | "regex": "^sha384\\$[a-z0-9]+\\$[a-f0-9]{96}$",
577 | "matches": [
578 | "Django(SHA-384)"
579 | ]
580 | },
581 | {
582 | "regex": "^crypt1:[a-z0-9+=]{12}:[a-z0-9+=]{12}$",
583 | "matches": [
584 | "Clavister Secure Gateway"
585 | ]
586 | },
587 | {
588 | "regex": "^[a-f0-9]{112}$",
589 | "matches": [
590 | "Cisco VPN Client(PCF-File)"
591 | ]
592 | },
593 | {
594 | "regex": "^[a-f0-9]{1329}$",
595 | "matches": [
596 | "Microsoft MSTSC(RDP-File)"
597 | ]
598 | },
599 | {
600 | "regex": "^[^\\\\\\/:*?\"<>|]{1,20}[:]{2,3}([^\\\\\\/:*?\"<>|]{1,20})?:[a-f0-9]{48}:[a-f0-9]{48}:[a-f0-9]{16}$",
601 | "matches": [
602 | "NetNTLMv1-VANILLA / NetNTLMv1+ESS"
603 | ]
604 | },
605 | {
606 | "regex": "^([^\\\\\\/:*?\"<>|]{1,20}\\\\)?[^\\\\\\/:*?\"<>|]{1,20}[:]{2,3}([^\\\\\\/:*?\"<>|]{1,20}:)?[^\\\\\\/:*?\"<>|]{1,20}:[a-f0-9]{32}:[a-f0-9]+$",
607 | "matches": [
608 | "NetNTLMv2"
609 | ]
610 | },
611 | {
612 | "regex": "^\\$(krb5pa|mskrb5)\\$([0-9]{2})?\\$.+\\$[a-f0-9]{1,}$",
613 | "matches": [
614 | "Kerberos 5 AS-REQ Pre-Auth"
615 | ]
616 | },
617 | {
618 | "regex": "^\\$scram\\$[0-9]+\\$[a-z0-9\\/.]{16}\\$sha-1=[a-z0-9\\/.]{27},sha-256=[a-z0-9\\/.]{43},sha-512=[a-z0-9\\/.]{86}$",
619 | "matches": [
620 | "SCRAM Hash"
621 | ]
622 | },
623 | {
624 | "regex": "^[a-f0-9]{40}:[a-f0-9]{0,32}$",
625 | "matches": [
626 | "Redmine Project Management Web App"
627 | ]
628 | },
629 | {
630 | "regex": "^(.+)?\\$[a-f0-9]{16}$",
631 | "matches": [
632 | "SAP CODVN B (BCODE)"
633 | ]
634 | },
635 | {
636 | "regex": "^(.+)?\\$[a-f0-9]{40}$",
637 | "matches": [
638 | "SAP CODVN F/G (PASSCODE)"
639 | ]
640 | },
641 | {
642 | "regex": "^(.+\\$)?[a-z0-9\\/.+]{30}(:.+)?$",
643 | "matches": [
644 | "Juniper Netscreen/SSG(ScreenOS)"
645 | ]
646 | },
647 | {
648 | "regex": "^0x[a-f0-9]{60}\\s0x[a-f0-9]{40}$",
649 | "matches": [
650 | "EPi"
651 | ]
652 | },
653 | {
654 | "regex": "^[a-f0-9]{40}:[^*]{1,25}$",
655 | "matches": [
656 | "SMF \u2265 v1.1"
657 | ]
658 | },
659 | {
660 | "regex": "^(\\$wbb3\\$\\*1\\*)?[a-f0-9]{40}[:*][a-f0-9]{40}$",
661 | "matches": [
662 | "Woltlab Burning Board 3.x"
663 | ]
664 | },
665 | {
666 | "regex": "^[a-f0-9]{130}(:[a-f0-9]{40})?$",
667 | "matches": [
668 | "IPMI2 RAKP HMAC-SHA1"
669 | ]
670 | },
671 | {
672 | "regex": "^[a-f0-9]{32}:[0-9]+:[a-z0-9_.+-]+@[a-z0-9-]+\\.[a-z0-9-.]+$",
673 | "matches": [
674 | "Lastpass"
675 | ]
676 | },
677 | {
678 | "regex": "^[a-z0-9\\/.]{16}([:$].{1,})?$",
679 | "matches": [
680 | "Cisco-ASA(MD5)"
681 | ]
682 | },
683 | {
684 | "regex": "^\\$vnc\\$\\*[a-f0-9]{32}\\*[a-f0-9]{32}$",
685 | "matches": [
686 | "VNC"
687 | ]
688 | },
689 | {
690 | "regex": "^[a-z0-9]{32}(:([a-z0-9-]+\\.)?[a-z0-9-.]+\\.[a-z]{2,7}:.+:[0-9]+)?$",
691 | "matches": [
692 | "DNSSEC(NSEC3)"
693 | ]
694 | },
695 | {
696 | "regex": "^(user-.+:)?\\$racf\\$\\*.+\\*[a-f0-9]{16}$",
697 | "matches": [
698 | "RACF"
699 | ]
700 | },
701 | {
702 | "regex": "^\\$3\\$\\$[a-f0-9]{32}$",
703 | "matches": [
704 | "NTHash(FreeBSD Variant)"
705 | ]
706 | },
707 | {
708 | "regex": "^\\$sha1\\$[0-9]+\\$[a-z0-9\\/.]{0,64}\\$[a-z0-9\\/.]{28}$",
709 | "matches": [
710 | "SHA-1 Crypt"
711 | ]
712 | },
713 | {
714 | "regex": "^[a-f0-9]{70}$",
715 | "matches": [
716 | "hMailServer"
717 | ]
718 | },
719 | {
720 | "regex": "^[:\\$][AB][:\\$]([a-f0-9]{1,8}[:\\$])?[a-f0-9]{32}$",
721 | "matches": [
722 | "MediaWiki"
723 | ]
724 | },
725 | {
726 | "regex": "^[a-f0-9]{140}$",
727 | "matches": [
728 | "Minecraft(xAuth)"
729 | ]
730 | },
731 | {
732 | "regex": "^\\$pbkdf2(-sha1)?\\$[0-9]+\\$[a-z0-9\\/.]+\\$[a-z0-9\\/.]{27}$",
733 | "matches": [
734 | "PBKDF2-SHA1(Generic)"
735 | ]
736 | },
737 | {
738 | "regex": "^\\$pbkdf2-sha256\\$[0-9]+\\$[a-z0-9\\/.]+\\$[a-z0-9\\/.]{43}$",
739 | "matches": [
740 | "PBKDF2-SHA256(Generic)"
741 | ]
742 | },
743 | {
744 | "regex": "^\\$pbkdf2-sha512\\$[0-9]+\\$[a-z0-9\\/.]+\\$[a-z0-9\\/.]{86}$",
745 | "matches": [
746 | "PBKDF2-SHA512(Generic)"
747 | ]
748 | },
749 | {
750 | "regex": "^\\$p5k2\\$[0-9]+\\$[a-z0-9\\/+=-]+\\$[a-z0-9\\/+-]{27}=$",
751 | "matches": [
752 | "PBKDF2(Cryptacular)"
753 | ]
754 | },
755 | {
756 | "regex": "^\\$p5k2\\$[0-9]+\\$[a-z0-9\\/.]+\\$[a-z0-9\\/.]{32}$",
757 | "matches": [
758 | "PBKDF2(Dwayne Litzenberger)"
759 | ]
760 | },
761 | {
762 | "regex": "^{FSHP[0123]\\|[0-9]+\\|[0-9]+}[a-z0-9\\/+=]+$",
763 | "matches": [
764 | "Fairly Secure Hashed Password"
765 | ]
766 | },
767 | {
768 | "regex": "^\\$PHPS\\$.+\\$[a-f0-9]{32}$",
769 | "matches": [
770 | "PHPS"
771 | ]
772 | },
773 | {
774 | "regex": "^[0-9]{4}:[a-f0-9]{16}:[a-f0-9]{2080}$",
775 | "matches": [
776 | "1Password(Agile Keychain)"
777 | ]
778 | },
779 | {
780 | "regex": "^[a-f0-9]{64}:[a-f0-9]{32}:[0-9]{5}:[a-f0-9]{608}$",
781 | "matches": [
782 | "1Password(Cloud Keychain)"
783 | ]
784 | },
785 | {
786 | "regex": "^[a-f0-9]{256}:[a-f0-9]{256}:[a-f0-9]{16}:[a-f0-9]{16}:[a-f0-9]{320}:[a-f0-9]{16}:[a-f0-9]{40}:[a-f0-9]{40}:[a-f0-9]{32}$",
787 | "matches": [
788 | "IKE-PSK MD5"
789 | ]
790 | },
791 | {
792 | "regex": "^[a-f0-9]{256}:[a-f0-9]{256}:[a-f0-9]{16}:[a-f0-9]{16}:[a-f0-9]{320}:[a-f0-9]{16}:[a-f0-9]{40}:[a-f0-9]{40}:[a-f0-9]{40}$",
793 | "matches": [
794 | "IKE-PSK SHA1"
795 | ]
796 | },
797 | {
798 | "regex": "^[a-z0-9\\/+]{27}=$",
799 | "matches": [
800 | "PeopleSoft"
801 | ]
802 | },
803 | {
804 | "regex": "^crypt\\$[a-f0-9]{5}\\$[a-z0-9\\/.]{13}$",
805 | "matches": [
806 | "Django(DES Crypt Wrapper)"
807 | ]
808 | },
809 | {
810 | "regex": "^(\\$django\\$\\*1\\*)?pbkdf2_sha256\\$[0-9]+\\$[a-z0-9]+\\$[a-z0-9\\/+=]{44}$",
811 | "matches": [
812 | "Django(PBKDF2-HMAC-SHA256)"
813 | ]
814 | },
815 | {
816 | "regex": "^pbkdf2_sha1\\$[0-9]+\\$[a-z0-9]+\\$[a-z0-9\\/+=]{28}$",
817 | "matches": [
818 | "Django(PBKDF2-HMAC-SHA1)"
819 | ]
820 | },
821 | {
822 | "regex": "^bcrypt(\\$2[axy]|\\$2)\\$[0-9]{2}\\$[a-z0-9\\/.]{53}$",
823 | "matches": [
824 | "Django(bcrypt)"
825 | ]
826 | },
827 | {
828 | "regex": "^md5\\$[a-f0-9]+\\$[a-f0-9]{32}$",
829 | "matches": [
830 | "Django(MD5)"
831 | ]
832 | },
833 | {
834 | "regex": "^\\{PKCS5S2\\}[a-z0-9\\/+]{64}$",
835 | "matches": [
836 | "PBKDF2(Atlassian)"
837 | ]
838 | },
839 | {
840 | "regex": "^md5[a-f0-9]{32}$",
841 | "matches": [
842 | "PostgreSQL MD5"
843 | ]
844 | },
845 | {
846 | "regex": "^\\([a-z0-9\\/+]{49}\\)$",
847 | "matches": [
848 | "Lotus Notes/Domino 8"
849 | ]
850 | },
851 | {
852 | "regex": "^SCRYPT:[0-9]{1,}:[0-9]{1}:[0-9]{1}:[a-z0-9:\\/+=]{1,}$",
853 | "matches": [
854 | "scrypt"
855 | ]
856 | },
857 | {
858 | "regex": "^\\$8\\$[a-z0-9\\/.]{14}\\$[a-z0-9\\/.]{43}$",
859 | "matches": [
860 | "Cisco Type 8"
861 | ]
862 | },
863 | {
864 | "regex": "^\\$9\\$[a-z0-9\\/.]{14}\\$[a-z0-9\\/.]{43}$",
865 | "matches": [
866 | "Cisco Type 9"
867 | ]
868 | },
869 | {
870 | "regex": "^\\$office\\$\\*2007\\*[0-9]{2}\\*[0-9]{3}\\*[0-9]{2}\\*[a-z0-9]{32}\\*[a-z0-9]{32}\\*[a-z0-9]{40}$",
871 | "matches": [
872 | "Microsoft Office 2007"
873 | ]
874 | },
875 | {
876 | "regex": "^\\$office\\$\\*2010\\*[0-9]{6}\\*[0-9]{3}\\*[0-9]{2}\\*[a-z0-9]{32}\\*[a-z0-9]{32}\\*[a-z0-9]{64}$",
877 | "matches": [
878 | "Microsoft Office 2010"
879 | ]
880 | },
881 | {
882 | "regex": "^\\$office\\$\\*2013\\*[0-9]{6}\\*[0-9]{3}\\*[0-9]{2}\\*[a-z0-9]{32}\\*[a-z0-9]{32}\\*[a-z0-9]{64}$",
883 | "matches": [
884 | "Microsoft Office 2013"
885 | ]
886 | },
887 | {
888 | "regex": "^\\$fde\\$[0-9]{2}\\$[a-f0-9]{32}\\$[0-9]{2}\\$[a-f0-9]{32}\\$[a-f0-9]{3072}$",
889 | "matches": [
890 | "Android FDE \u2264 4.3"
891 | ]
892 | },
893 | {
894 | "regex": "^\\$oldoffice\\$[01]\\*[a-f0-9]{32}\\*[a-f0-9]{32}\\*[a-f0-9]{32}$",
895 | "matches": [
896 | "Microsoft Office \u2264 2003 (MD5+RC4)",
897 | "Microsoft Office \u2264 2003 (MD5+RC4) collider-mode #1",
898 | "Microsoft Office \u2264 2003 (MD5+RC4) collider-mode #2"
899 | ]
900 | },
901 | {
902 | "regex": "^\\$oldoffice\\$[34]\\*[a-f0-9]{32}\\*[a-f0-9]{32}\\*[a-f0-9]{40}$",
903 | "matches": [
904 | "Microsoft Office \u2264 2003 (SHA1+RC4)",
905 | "Microsoft Office \u2264 2003 (SHA1+RC4) collider-mode #1",
906 | "Microsoft Office \u2264 2003 (SHA1+RC4) collider-mode #2"
907 | ]
908 | },
909 | {
910 | "regex": "^(\\$radmin2\\$)?[a-f0-9]{32}$",
911 | "matches": [
912 | "RAdmin v2.x"
913 | ]
914 | },
915 | {
916 | "regex": "^{x-issha,\\s[0-9]{4}}[a-z0-9\\/+=]+$",
917 | "matches": [
918 | "SAP CODVN H (PWDSALTEDHASH) iSSHA-1"
919 | ]
920 | },
921 | {
922 | "regex": "^\\$cram_md5\\$[a-z0-9\\/+=-]+\\$[a-z0-9\\/+=-]{52}$",
923 | "matches": [
924 | "CRAM-MD5"
925 | ]
926 | },
927 | {
928 | "regex": "^[a-f0-9]{16}:2:4:[a-f0-9]{32}$",
929 | "matches": [
930 | "SipHash"
931 | ]
932 | },
933 | {
934 | "regex": "^[a-f0-9]{4,}$",
935 | "matches": [
936 | "Cisco Type 7"
937 | ]
938 | },
939 | {
940 | "regex": "^[a-z0-9\\/.]{13,}$",
941 | "matches": [
942 | "BigCrypt"
943 | ]
944 | },
945 | {
946 | "regex": "^(\\$cisco4\\$)?[a-z0-9\\/.]{43}$",
947 | "matches": [
948 | "Cisco Type 4"
949 | ]
950 | },
951 | {
952 | "regex": "^bcrypt_sha256\\$\\$(2[axy]|2)\\$[0-9]+\\$[a-z0-9\\/.]{53}$",
953 | "matches": [
954 | "Django(bcrypt-SHA256)"
955 | ]
956 | },
957 | {
958 | "regex": "^\\$postgres\\$.[^\\*]+[*:][a-f0-9]{1,32}[*:][a-f0-9]{32}$",
959 | "matches": [
960 | "PostgreSQL Challenge-Response Authentication (MD5)"
961 | ]
962 | },
963 | {
964 | "regex": "^\\$siemens-s7\\$[0-9]{1}\\$[a-f0-9]{40}\\$[a-f0-9]{40}$",
965 | "matches": [
966 | "Siemens-S7"
967 | ]
968 | },
969 | {
970 | "regex": "^(\\$pst\\$)?[a-f0-9]{8}$",
971 | "matches": [
972 | "Microsoft Outlook PST"
973 | ]
974 | },
975 | {
976 | "regex": "^sha256[:$][0-9]+[:$][a-z0-9\\/+]+[:$][a-z0-9\\/+]{32,128}$",
977 | "matches": [
978 | "PBKDF2-HMAC-SHA256(PHP)"
979 | ]
980 | },
981 | {
982 | "regex": "^(\\$dahua\\$)?[a-z0-9]{8}$",
983 | "matches": [
984 | "Dahua"
985 | ]
986 | },
987 | {
988 | "regex": "^\\$mysqlna\\$[a-f0-9]{40}[:*][a-f0-9]{40}$",
989 | "matches": [
990 | "MySQL Challenge-Response Authentication (SHA1)"
991 | ]
992 | },
993 | {
994 | "regex": "^\\$pdf\\$[24]\\*[34]\\*128\\*[0-9-]{1,5}\\*1\\*(16|32)\\*[a-f0-9]{32,64}\\*32\\*[a-f0-9]{64}\\*(8|16|32)\\*[a-f0-9]{16,64}$",
995 | "matches": [
996 | "PDF 1.4 - 1.6 (Acrobat 5 - 8)"
997 | ]
998 | }
999 | ]
1000 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------