Files
XSStrike/core/arjun.py

40 lines
1.7 KiB
Python
Raw Normal View History

2018-10-27 18:58:52 +05:30
import concurrent.futures
import re
2018-10-27 18:58:52 +05:30
from core.colors import good, info, green, end
from core.config import blindParams, xsschecker, threadCount
from core.requester import requester
2018-10-27 18:58:52 +05:30
2018-11-16 21:13:45 +05:30
2018-11-10 17:54:23 +05:30
def checky(param, paraNames, url, headers, GET, delay, timeout):
2018-10-27 18:58:52 +05:30
if param not in paraNames:
2018-11-16 21:13:45 +05:30
response = requester(url, {param: xsschecker},
headers, GET, delay, timeout).text
2018-10-27 18:58:52 +05:30
if '\'%s\'' % xsschecker in response or '"%s"' % xsschecker in response or ' %s ' % xsschecker in response:
paraNames[param] = ''
2018-11-16 21:13:45 +05:30
print('%s Valid parameter found : %s%s%s' %
(good, green, param, end))
2018-10-27 18:58:52 +05:30
2018-11-10 17:54:23 +05:30
def arjun(url, GET, headers, delay, timeout):
2018-10-27 18:58:52 +05:30
paraNames = {}
2018-11-10 17:54:23 +05:30
response = requester(url, {}, headers, GET, delay, timeout).text
2018-11-16 21:13:45 +05:30
matches = re.findall(
r'<input.*?name=\'(.*?)\'.*?>|<input.*?name="(.*?)".*?>', response)
2018-10-27 18:58:52 +05:30
for match in matches:
try:
foundParam = match[1]
except UnicodeDecodeError:
continue
2018-11-16 21:13:45 +05:30
print('%s Heuristics found a potentially valid parameter: %s%s%s. Priortizing it.' % (
good, green, foundParam, end))
if foundParam not in blindParams:
2018-10-29 18:04:15 +05:30
blindParams.insert(0, foundParam)
2018-10-29 18:02:19 +05:30
threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=threadCount)
2018-11-16 21:13:45 +05:30
futures = (threadpool.submit(checky, param, paraNames, url,
headers, GET, delay, timeout) for param in blindParams)
2018-10-27 18:58:52 +05:30
for i, _ in enumerate(concurrent.futures.as_completed(futures)):
if i + 1 == len(blindParams) or (i + 1) % threadCount == 0:
print('%s Progress: %i/%i' % (info, i + 1, len(blindParams)), end='\r')
2018-10-29 18:02:19 +05:30
return paraNames