├── README.md
└── bashgf
/README.md:
--------------------------------------------------------------------------------
1 | # bashgf
2 |
3 | Bash version for Tomnomnom's gf tool. This version doesn't need any previous configuration
4 |
5 | How to install:
6 |
7 | ````bash
8 | cd /opt && git clone https://github.com/e1abrador/bashgf
9 | cd bashgf
10 | chmod +x bashgf && cp bashgf $(echo $PATH | tr ':' ' ' | awk '{print $1}')
11 | ````
12 |
13 | # How to use it
14 |
15 | ````bash
16 | bashgf --help
17 | Options:
18 | > Read from stdin file
19 | cat file_with_urls | bashgf
20 | Values: lfi rce open-redirect sqli ssrf ssti xss
21 | > Grep recursively on directory files
22 | bashgf /path/to/directory
23 | Values: jsvars urls upload-fields sub-takeover servers keys aws-buckets
24 | php-sources php-serialized php-errors php-curl json-sec http-auth software
25 | firebase debug-page cors base64-important-value aws-keys
26 | ````
27 |
28 | Use it from stdin
29 |
30 | ````bash
31 | cat file_with_urls | bashgf lfi
32 | https://example.com/?file=https://google.com
33 | ...
34 |
35 | cat file_with_urls | bashgf open-redirect
36 | https://example.com/?image_url=https://google.com/image.png
37 | ...
38 | ````
39 |
40 | Use it to scan a directory
41 |
42 | ````bash
43 | bashgf jsvars .
44 | ./file-with-vars:1:var myName = 'e1abrador';
45 | ...
46 | ````
47 |
48 | # Thanks
49 | Thanks to Tomnomnom for the great tool idea.
50 |
51 |
52 |
--------------------------------------------------------------------------------
/bashgf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Colours
4 | greenColour="\e[0;32m\033[1m"
5 | endColour="\033[0m\e[0m"
6 | redColour="\e[0;31m\033[1m"
7 | blueColour="\e[0;34m\033[1m"
8 | yellowColour="\e[0;33m\033[1m"
9 | purpleColour="\e[0;35m\033[1m"
10 | turquoiseColour="\e[0;36m\033[1m"
11 | grayColour="\e[0;37m\033[1m"
12 |
13 | #gf in bash
14 |
15 | pathh=$2
16 |
17 | function xss(){
18 | grep -iE "q=|s=|search=|lang=|keyword=|query=|page=|keywords=|year=|view=|email=|type=|name=|p=|callback=|jsonp=|api_key=|api=|password=|email=|emailto=|token=|username=|csrf_token=|unsubscribe_token=|id=|item=|page_id=|month=|immagine=|list_type=|url=|terms=|categoryid=|key=|l=|begindate=|enddate="
19 | }
20 |
21 | function ssti(){
22 | grep -iE "template=|preview=|id=|view=|activity=|name=|content=|redirect="
23 | }
24 |
25 | function ssrf(){
26 | grep -iE "access=|admin=|dbg=|debug=|edit=|grant=|test=|alter=|clone=|create=|delete=|disable=|enable=|exec=|execute=|load=|make=|modify=|rename=|reset=|shell=|toggle=|adm=|root=|cfg=|dest=|redirect=|uri=|path=|continue=|url=|window=|next=|data=|reference=|site=|html=|val=|validate=|domain=|callback=|return=|page=|feed=|host=|port=|to=|out=|view=|dir=|show=|navigation=|open=|file=|document=|folder=|pg=|php_path=|style=|doc=|img=|filename="
27 | }
28 |
29 | function sqli(){
30 | grep -iE "id=|select=|report=|role=|update=|query=|user=|name=|sort=|where=|search=|params=|process=|row=|view=|table=|from=|sel=|results=|sleep=|fetch=|order=|keyword=|column=|field=|delete=|string=|number=|filter="
31 | }
32 |
33 | function open-redirect(){
34 | grep -iE "image_url=|Open=|callback=|cgi-bin/redirect.cgi|cgi-bin/redirect.cgi?|checkout=|checkout_url=|continue=|data=|dest=|destination=|dir=|domain=|feed=|file=|file_name=|file_url=|folder=|folder_url=|forward=|from_url=|go=|goto=|host=|html=|image_url=|img_url=|load_file=|load_url=|login?to=|login_url=|logout=|navigation=|next=|next_page=|out=|page=|page_url=|path=|port=|redir=|redirect=|redirect_to=|redirect_uri=|redirect_url=|reference=|return=|returnTo=|return_path=|return_to=|return_url=|rt=|rurl=|show=|site=|target=|to=|uri=|url=|val=|validate=|view=|window="
35 | }
36 |
37 | function rce(){
38 | grep -iE "daemon=|upload=|dir=|download=|log=|ip=|cli=|cmd=|exec=|command=|execute=|ping=|query=|jump=|code=|reg=|do=|func=|arg=|option=|load=|process=|step=|read=|function|req=|feature=|exe=|module=|payload=|run=|print="
39 | }
40 |
41 | function lfi(){
42 | grep -iE "file=|document=|folder=|root=|path=|pg=|style=|pdf=|template=|php_path=|doc=|page=|name=|cat=|dir=|action=|board=|date=|detail=|download=|prefix=|include=|inc=|locate=|show=|site=|type=|view=|content=|layout=|mod=|conf=|url="
43 | }
44 |
45 | function jsvars(){
46 | grep -HnriE "var [a-z0-9]+\s+=" $pathh
47 | }
48 |
49 | function urls(){
50 | grep -HnriE "https?://[^\"\\'> ]+" $pathh
51 | }
52 |
53 | function upload-fields(){
54 | grep -Hnri "|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]" $pathh
127 | }
128 |
129 | function grep_stdin(){
130 | while read lines
131 | do
132 | echo $lines
133 | done < "${1:-/dev/stdin}"
134 | }
135 |
136 | function helpPanel(){
137 | echo -e "\tOptions:"
138 | echo -e "\t\t${redColour}>${endColour} ${grayColour}Read from stdin file${endColour}"
139 | echo -e "\t\t${purpleColour}cat file_with_urls | bashgf ${endColour}${yellowColour}${endColour}"
140 | echo -e "\t\t${blueColour}Values:${endColour} ${yellowColour}lfi rce open-redirect sqli ssrf ssti xss${endColour}"
141 | echo -e "\t\t${redColour}>${endColour} ${grayColour}Grep recursively on directory files${endColour}"
142 | echo -e "\t\t${purpleColour}bashgf ${endColour}${yellowColour}${endColour} ${purpleColour} /path/to/directory${endColour}"
143 | echo -e "\t\t${blueColour}Values:${endColour} ${yellowColour}jsvars urls upload-fields sub-takeover servers keys aws-buckets\n\t\tphp-sources php-serialized php-errors php-curl json-sec http-auth software\n\t\tfirebase debug-page cors base64-important-value aws-keys dom-xss general-api${endColour}"
144 | }
145 |
146 | if [ $1 == $(echo -e xss) 2>/dev/null ]; then
147 | grep_stdin | xss 2>/dev/null
148 | elif [ $1 == $(echo -e ssti) 2>/dev/null ]; then
149 | grep_stdin | ssti 2>/dev/null
150 | elif [ $1 == $(echo -e ssrf) 2>/dev/null ]; then
151 | grep_stdin | ssrf 2>/dev/null
152 | elif [ $1 == $(echo -e sqli) 2>/dev/null ]; then
153 | grep_stdin | sqli 2>/dev/null
154 | elif [ $1 == $(echo -e open-redirect) 2>/dev/null ]; then
155 | grep_stdin | open-redirect 2>/dev/null
156 | elif [ $1 == $(echo -e rce) 2>/dev/null ]; then
157 | grep_stdin | rce 2>/dev/null
158 | elif [ $1 == $(echo -e lfi) 2>/dev/null ]; then
159 | grep_stdin | lfi 2>/dev/null
160 | elif [ $1 == $(echo -e jsvars) 2>/dev/null ]; then
161 | jsvars 2>/dev/null
162 | elif [ $1 == $(echo -e urls) 2>/dev/null ]; then
163 | urls 2>/dev/null
164 | elif [ $1 == $(echo -e upload-fields) 2>/dev/null ]; then
165 | upload-fields 2>/dev/null
166 | elif [ $1 == $(echo -e sub-takeover) 2>/dev/null ]; then
167 | sub-takeover 2>/dev/null
168 | elif [ $1 == $(echo -e servers) 2>/dev/null ]; then
169 | servers 2>/dev/null
170 | elif [ $1 == $(echo -e keys) 2>/dev/null ]; then
171 | keys 2>/dev/null
172 | elif [ $1 == $(echo -e aws-buckets) 2>/dev/null ]; then
173 | aws-buckets 2>/dev/null
174 | elif [ $1 == $(echo -e php-sources) 2>/dev/null ]; then
175 | php-sources 2>/dev/null
176 | elif [ $1 == $(echo -e php-serialized) 2>/dev/null ]; then
177 | php-serialized 2>/dev/null
178 | elif [ $1 == $(echo -e php-errors) 2>/dev/null ]; then
179 | php-errors 2>/dev/null
180 | elif [ $1 == $(echo -e php-curl) 2>/dev/null ]; then
181 | php-curl 2>/dev/null
182 | elif [ $1 == $(echo -e json-sec) 2>/dev/null ]; then
183 | json-sec 2>/dev/null
184 | elif [ $1 == $(echo -e http-auth) 2>/dev/null ]; then
185 | http-auth 2>/dev/null
186 | elif [ $1 == $(echo -e software) 2>/dev/null ]; then
187 | software 2>/dev/null
188 | elif [ $1 == $(echo -e firebase) 2>/dev/null ]; then
189 | firebase 2>/dev/null
190 | elif [ $1 == $(echo -e debug-page) 2>/dev/null ]; then
191 | debug-page 2>/dev/null
192 | elif [ $1 == $(echo -e cors) 2>/dev/null ]; then
193 | cors 2>/dev/null
194 | elif [ $1 == $(echo -e base64-important-value) 2>/dev/null ]; then
195 | base64-important-value 2>/dev/null
196 | elif [ $1 == $(echo -e aws-keys) 2>/dev/null ]; then
197 | aws-keys 2>/dev/null
198 | elif [ $1 == $(echo -e dom-xss) 2>/dev/null ]; then
199 | dom-xss 2>/dev/null
200 | elif [ $1 == $(echo -e general-api) 2>/dev/null ]; then
201 | general-api 2>/dev/null
202 | else
203 | helpPanel
204 | fi
205 |
--------------------------------------------------------------------------------