https://github.com/chainreactors/spray
https://chainreactors.github.io/wiki/spray/detail/#_2 .
- 超强的性能, 在本地测试极限性能的场景下, 能超过ffuf与feroxbruster的性能50%以上.
- 基于掩码的字典生成
- 基于规则的字典生成
- 动态智能过滤
- 全量gogo的指纹识别
- 自定义信息提取, 如ip,js, title, hash以及自定义的正则表达式
- 自定义无效页面过滤策略
- 自定义输出格式
- *nix的命令行设计, 轻松与其他工具联动
- 多角度的自动被ban,被waf判断
- 断点续传
- 通用文件, 备份文件, 单个文件备份, 爬虫, 主动指纹识别的完美结合
Usage¶
spray -h
将暂时完整的参数说明
Usage:
./spray
Input Options:
--resume=
-u, --url= Strings, input baseurl, e.g.: http://google.com
-l, --list= File, input filename
-p, --port= String, input port range, e.g.: 80,8080-8090,db
-c, --cidr= String, input cidr, e.g.: 1.1.1.1/24
--raw= File, input raw request filename, todo
-d, --dict= Files, Multi,dict files, e.g.: -d 1.txt -d 2.txt
--offset= Int, wordlist offset
--limit= Int, wordlist limit, start with offset. e.g.: --offset 1000 --limit 100
-w, --word= String, word generate dsl, e.g.: -w test{?ld#4}
-r, --rules= Files, rule files, e.g.: -r rule1.txt -r rule2.txt
--append-rule= Files, when found valid path , use append rule generator new word with current path
--filter-rule= String, filter rule, e.g.: --rule-filter '>8 <4'
Function Options:
-e, --extension= String, add extensions (separated by commas), e.g.: -e jsp,jspx
--exclude-extension= String, exclude extensions (separated by commas), e.g.: --exclude-extension jsp,jspx
--remove-extension= String, remove extensions (separated by commas), e.g.: --remove-extension jsp,jspx
-U, --uppercase Bool, upper wordlist, e.g.: --uppercase
-L, --lowercase Bool, lower wordlist, e.g.: --lowercase
--prefix= Strings, add prefix, e.g.: --prefix aaa --prefix bbb
--suffix= Strings, add suffix, e.g.: --suffix aaa --suffix bbb
--replace= Strings, replace string, e.g.: --replace aaa:bbb --replace ccc:ddd
Output Options:
--match= String, custom match function, e.g.: --match 'current.Status != 200'
--filter= String, custom filter function, e.g.: --filter 'current.Body contains "hello"'
-f, --file= String, output filename
-F, --format= String, output format, e.g.: --format 1.json
--fuzzy-file= String, fuzzy output filename
--dump-file= String, dump all request, and write to filename
--dump Bool, dump all request
--auto-file Bool, auto generator output and fuzzy filename
--fuzzy String, open fuzzy output
-o, --probe= String, output format
Plugin Options:
-a, --advance Bool, enable crawl and active
--extract= Strings, extract response, e.g.: --extract js --extract ip --extract version:(.*?)
--recon Bool, enable recon
--active Bool, enable active finger detect
--bak Bool, enable bak found
--file-bak Bool, enable valid result bak found, equal --append-rule rule/filebak.txt
--common Bool, enable common file found
--crawl Bool, enable crawl
--crawl-depth= Int, crawl depth (default: 3)
Request Options:
--header= Strings, custom headers, e.g.: --headers 'Auth: example_auth'
--user-agent= String, custom user-agent, e.g.: --user-agent Custom
--random-agent Bool, use random with default user-agent
--cookie= Strings, custom cookie
--read-all Bool, read all response body
--max-length= Int, max response body length (kb), default 100k, e.g. -max-length 1000 (default:
100)
Modify Options:
--rate-limit= Int, request rate limit (rate/s), e.g.: --rate-limit 100 (default: 0)
--force Bool, skip error break
--check-only Bool, check only
--no-scope Bool, no scope
--scope= String, custom scope, e.g.: --scope *.example.com
--recursive= String,custom recursive rule, e.g.: --recursive current.IsDir() (default:
current.IsDir())
--depth= Int, recursive depth (default: 0)
--check-period= Int, check period when request (default: 200)
--error-period= Int, check period when error (default: 10)
--error-threshold= Int, break when the error exceeds the threshold (default: 20)
--black-status= Strings (comma split),custom black status, (default: 400,410)
--white-status= Strings (comma split), custom white status (default: 200)
--fuzzy-status= Strings (comma split), custom fuzzy status (default: 404,403,500,501,502,503)
--unique-status= Strings (comma split), custom unique status (default: 403)
--unique Bool, unique response
--retry= Int, retry count (default: 1)
--distance=
Miscellaneous Options:
--deadline= Int, deadline (seconds) (default: 999999)
--timeout= Int, timeout with request (seconds) (default: 5)
-P, --pool= Int, Pool size (default: 5)
-t, --thread= Int, number of threads per pool (default: 20)
--debug Bool, output debug info
-v, --version Bool, show version
-q, --quiet Bool, Quiet
--no-color Bool, no color
--no-bar Bool, No progress bar
-m, --mod=[path|host] String, path/host spray (default: path)
-C, --client=[fast|standard|auto] String, Client type (default: auto)
Help Options:
-h, --help Show this help message
QuickStart¶
基本使用, 从字典中读取目录进行爆破
spray -u http://example.com -d wordlist1.txt -d wordlist2.txt
通过掩码生成字典进行爆破
spray -u http://example.com -w "/aaa/bbb{?l#4}/ccc"
通过规则生成字典爆破. 规则文件格式参考hashcat的字典生成规则
spray -u http://example.com -r rule.txt -d 1.txt
批量爆破
spray -l url.txt -r rule.txt -d 1.txt
断点续传
spray --resume stat.json
字典生成¶
基于掩码的字典生成¶
为了实现这个功能, 编写了一门名为mask的模板语言. 代码位于: mask.
一些使用案例
spray -u http://example.com -w '/{?l#3}/{?ud#3}
含义为, /全部三位小写字母/全部三位大写字母+数字组成的字典.
所有的mask生成器都需要通过{}包裹, 并且括号内的第一个字符必须为?, $, @其中之一. #后的数字表示重复次数, 可留空, 例如{?lu} , 表示"全部小写字母+全部大写字母"组成的字典.
?表示普通的笛卡尔积. 例如{?l#3}表示生成三位小写字母的所有可能组合$表示贪婪模式, 例如{$l#3}表示3位小写字母的所有可能组合+2位小写字母的所有可能组合+1位小写字母的所有可能组合@表示关键字模式, 例如{@year}, 表示年份, 1970-2030年.
掩码的定义参考了hashcat, 但是并不完全相同. 目前可用的关键字如下表:
"l": Lowercase, // 26个小写字母
"u": Uppercase, // 26个大写字母
"w": Letter, // 52大写+小写字母
"d": Digit, // 数字0-9
"h": LowercaseHex, // 小写hex字符, 0-9 + a-f
"H": UppercaseHex, // 大写hex字符, 0-9 + A-F
"x": Hex, // 大写+小写hex字符, 0-9 + a-f + A-F
"p": Punctuation, // 特殊字符 !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~
"P": Printable, // 可见的ascii字符
"s": Whitespace, // 空字符 \t\n\r\x0b\x0c
还支持通过数字表示命令行输入的字典序号, 例如
spray -u http://example.com -w '/{?0u#2}/{?01}' -d word0.txt -d word1.txt
其中{?0u#2}表示word0.txt的所有内容+所有大写字母笛卡尔积两次, {?01} 表示word0.txt + word1.txt的所有内容.
关键字目前还在不断完善中, 欢迎提供需求.
基于规则的字典生成¶
实现rule-base的字典生成器同样编写了一门模板语言, 代码在 rule
规则语法请参考 hashcat_rule_base
目前除了M(Memorize)的规则已经全部实现. 并且去掉了hashcat的一些限制, 比如最多支持5个规则, 字符串长度不能大于10等.
目前实现的规则如下表, 来自hashcat文档