Qsinject
qsinject (Query String Inject) is a tool that allows you to quickly substitute query string values with regex matches, one-at-a-time.
Install / Use
/learn @ameenmaali/QsinjectREADME
qsinject
qsinject (Query String Inject) is a tool that allows you to quickly substitute query string values with regex matches, one-at-a-time.
Injections are done one-at-a-time for URLs with multiple query strings to ensure requests aren't broken if certain
parameters are relied on. URLs that don't have query strings will be ignored. Much of this logic is ported over from qsfuzz
to qsinject as a standalone tool.
qsinject has 2 modes, "dumb" mode, and "regex" mode.
- Dumb mode will allow you to pass in a simple comma separated list of injections that will inject each query string value, one-at-a-time
- Regex mode will allow you to define rules and only replace a query string value if it matches the defined regex
As a side-benefit, qsinject does deduplication to remove duplicates of the same URL and query string keys (with only differing values)
Installation
go get github.com/ameenmaali/qsinject
Usage
inject takes URLs (with query strings) from stdin, of which you will most likely want in a file such as:
$ cat urls.txt
https://www.google.com/reflectedXss?param=123
https://test.com
http://hello.com/sqli?qs=444&dd=22
https://redir.auth.com/redir?url=https://test.com&redirect_to=http://domain.gov
https://xD.com/redirect?url=https://evil.com
Optionally, you can supply qsinject with a rule/config file (see rule-example.yaml for an example) to perform multiple
regex match/replacements in a given run. If you do not use a config file, you'll be limited to replacing against a single rule.
$ cat rules.yaml
rules:
UrlUpdate:
regex: '^http(s)?:\/\/.+'
replacement: 'https://example.net/home'
append: false
XSS:
regex: '^[a-zA-Z0-9]+$'
replacement: '"><h2>asd</h2>'
append: true
SqlInjection:
regex: '^[a-zA-Z0-9]+$'
replacement: "'"
append: true
Important Notes for Config files
You can have as many rules as you'd like. These are the currently supported fields, annotated with comments above the field:
# This should never change, and indicates the start of the rules list
rules:
# This should be set to the rule's name you are defining
ruleName:
# This is the regex (string) value you'd like to match query string values against. Be careful with escaping, recommended to insert in single quotes
regex:
# This is a (string) value for the injection you'd like to insert for the matched regex
replacement:
# This is a (boolean) value for whether you want to append the injection after the original value (true), or replace all together (false)
append:
Help
$ qsinject -h
Usage of qsinject:
-a
Append injections to the original query string value (i.e. q=1 > q=1injection
-append
Append injections to the original query string value (i.e. q=1 > q=1injection
-c string
Pass a regex rules config file instead of flags, which also supports multiple rules per run
-config string
Pass a regex rules config file instead of flags, which also supports multiple rules per run
-d
Inject with URL decoded params (default is encoded)
-decode
Inject with URL decoded params (default is encoded)
-debug
Debug/verbose mode to print more info for failed/malformed URLs
-i string
Injections (comma separated) to inject for all query strings
-injections string
Injections (comma separated) to inject for all query strings
-iu
Included unaltered URLs in results (for when match and replace doesn't affect that URL)
-include-unaltered
Included unaltered URLs in results (for when match and replace doesn't affect that URL)
-m string
Regex string to match query string values to be replaced
-match string
Regex string to match query string values to be replaced
-r string
Replacement values (injection) for the matched regex value
-replace string
Replacement values (injection) for the matched regex value
-v
Get the current version of qsinject
-version
Get the current version of qsinject
-w int
Set the concurrency/worker count (default 15)
-workers int
Set the concurrency/worker count (default 15)
Examples
Replace URLs in query string values with your Burp Collaborator instance
cat urls.txt | qsinject -m "^http(s)?:\/\/.+" -r "https://myinstance.burpcollaborator.net"
Using a rule config file, match and replace against multiple rules:
cat urls.txt | qsinject -c rules.yaml
Replace URLs in "Dumb" mode, injecting a list of query strings one-at-a-time in each query string value:
cat urls.txt | qsinject -i "val1,val2,val3,val4"
Replace URLs with a rule config file, include all results (even if unaltered), and include values decoded:
cat urls.txt | qsinject -c rules.yaml -iu -decode
Get unique URLs and query string combinations (i.e. remove duplicates with differing param values), simply pass in a non-existent match and replace rule with -iu flag
cat urls.txt | qsinject -iu -m "12312312312312" -r "12321312312213"
Thanks
- Some of this code, particularly the deduplication logic, was inspired by Tomnomnom's qsreplace
Related Skills
node-connect
351.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
