
Arjun是一款专业的HTTP参数发现工具,能够快速识别URL端点中的查询参数。Web应用程序使用参数(或查询)来接受用户输入,例如:
http://api.example.com/v1/userinfo?id=751634589这个URL似乎为特定用户ID加载用户信息,但如果存在一个名为admin的参数,当设置为True时,端点会提供更多用户信息呢?Arjun就是用来发现这类有效HTTP参数的工具,它拥有包含25,890个参数名的庞大默认字典。
最棒的是?完成这个庞大列表的扫描只需不到10秒,同时仅向目标发送50-60个请求。
推荐使用以下方式安装Arjun:
pipx install arjun注意:如果使用旧版本Python,请使用pip代替pipx
系统要求:

扫描单个URL:
arjun -u https://example.com/api/user导入多个目标:
arjun -i targets.txt保存输出到文件:
arjun -u https://example.com -o results.json使用自定义HTTP头:
arjun -u https://example.com --headers "Authorization: Bearer token"# 设置请求方法arjun -u https://example.com -m POST# 设置并发线程数arjun -u https://example.com -t 10# 设置请求延迟arjun -u https://example.com -d 1.5# 设置块大小arjun -u https://example.com -c 100# 启用安静模式arjun -u https://example.com -q# 禁用重定向arjun -u https://example.com --disable-redirects
异常检测模块
def define(response_1, response_2, param, value, wordlist):
"""
通过比较两个HTTP响应定义异常检测规则
返回字典
"""
factors = {
'same_code': None, # 如果HTTP状态码相同,包含该状态码
'same_body': None, # 如果HTTP正文相同,包含该正文
'same_plaintext': None, # 如果HTTP正文不同但去除HTML后相同,包含非HTML文本
'lines_num': None, # 如果HTTP正文行数相同,包含该数字
'lines_diff': None, # 如果HTTP正文或纯文本不同且超过两行,包含哪些行相同
'same_headers': None, # 如果头部相同,包含这些头部
'same_redirect': None, # 如果两个请求以类似方式重定向,包含该重定向
'param_missing': None, # 如果参数名从正文中缺失,包含已存在的单词
'value_missing': None # 包含参数值是否从正文中缺失
}请求处理模块
@sleep_and_retry
@limits(calls=mem.var['rate_limit'], period=1)
def requester(request, payload={}):
"""
用于发起HTTP请求的核心函数
出错时返回字符串,否则返回requests库的响应对象
"""
if request.get('include') and len(request.get('include', '')) != 0:
payload.update(request['include'])
if mem.var['stable']:
mem.var['delay'] = random.choice(range(3, 10))
time.sleep(mem.var['delay'])
try:
if request['method'] == 'GET':
response = requests.get(url,
params=payload,
headers=request['headers'],
verify=False,
allow_redirects=False,
timeout=mem.var['timeout'],
)
# 处理JSON、XML和POST请求...
return response
except Exception as e:
return str(e)启发式扫描模块
def heuristic(raw_response, wordlist):
"""
启发式扫描函数,从响应中提取潜在参数
返回发现的参数列表和是否存在单词的标志
"""
words_exist = False
potential_params = []
headers, response = raw_response.headers, raw_response.text
# 解析输入字段
input_names = re_inputs.findall(response)
potential_params += input_names
# 解析脚本
for script in extract_js(response):
empty_vars = re_empty_vars.findall(script)
potential_params += empty_vars
map_keys = re_map_keys.findall(script)
potential_params += map_keys
return list(found), words_exist参数大小写转换
def covert_to_case(string, delimiter, casing):
"""
处理输入字符串并转换为指定大小写风格
返回转换后的字符串
"""
parts = handle(string)
return transform(parts, delimiter, casing)
def detect_casing(string):
"""
检测给定字符串的大小写风格和分隔符
返回分隔符和大小写风格
"""
delimiter = ""
casing = ""
if string.islower():
casing = "l"
elif string.isupper():
casing = "u"
else:
casing = casing = "c" if string[0].islower() else "p"
return delimiter, casingArjun采用先进的异常检测算法,通过9个因素比较HTTP响应来识别有效参数。
其智能的速率限制处理和错误重试机制确保在复杂网络环境下的稳定运行。
工具还具备被动参数收集功能,可从CommonCrawl、Wayback Machine和AlienVault OTX等外部源获取参数信息。
参数名称词表是通过从CommonCrawl数据集中提取顶级参数名,并将SecLists和param-miner词表中的最佳单词合并而成,确保了扫描的全面性和准确性。
如下所示,检测下面两个url的endpoint可能带的查询参数,发现带有参数id:

