Skip to content

Commit 675cf0a

Browse files
authored
Ready for a stable release
On The Way to XSRFProbe v2 (Stable)
2 parents 53b620e + 3c0d175 commit 675cf0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1345
-469
lines changed

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ before_script:
1515
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
1616
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --quiet
1717
script:
18+
# Help message.
1819
- python xsrfprobe.py --help
19-
- python xsrfprobe.py -u http://www.webscantest.com --timeout 5 --max-chars 3 --quiet
20+
# Crawl entire www.webscantest.com and submit forms.
21+
- python xsrfprobe.py -u http://www.webscantest.com --crawl --timeout 5 --max-chars 3 --quiet
22+
# Test only a single endpoint vulnerability.
23+
- python xsrfprobe.py -u http://www.webscantest.com/csrf/csrfpost.php
2024
notifications:
2125
on_success: change
2226
on_failure: change # `always` will be the setting once code changes slow down

core/banner.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# XSRF Probe #
66
#-:-:-:-:-:-:-::-:-:#
77

8-
#Author: 0xInfection (@_tID)
8+
#Author: 0xInfection
99
#This module requires XSRF-Probe
1010
#https://github.com/0xInfection/XSRF-Probe
1111

@@ -17,31 +17,31 @@
1717
def banner():
1818

1919
print('\n\n')
20-
time.sleep(0.1)
20+
time.sleep(0.05)
2121
print(color.ORANGE+' _____ _____ _____ _____ _____ ')
22-
time.sleep(0.1)
22+
time.sleep(0.05)
2323
print(color.RED+' __'+color.ORANGE+'|'+color.RED+'__ '+color.ORANGE+' |_ '+color.RED+'__'+color.ORANGE+'|'+color.RED+'___ '+color.ORANGE+' |_ '+color.RED+'__'+color.ORANGE+'|'+color.RED+'___ '+color.ORANGE+'|_ '+color.RED+'_'+color.ORANGE+'|'+color.RED+'____ '+color.ORANGE+'|_'+color.RED+' _'+color.ORANGE+'|'+color.RED+'____ '+color.ORANGE+'|_ '+color.RED+' _____ _____ ______ ______ ')
24-
time.sleep(0.1)
24+
time.sleep(0.05)
2525
print(color.RED+" \ ` / "+color.ORANGE+'|'+color.RED+'| ___| '+color.ORANGE+'|'+color.RED+'| _ _| '+color.ORANGE+'|'+color.RED+'| ___| '+color.ORANGE+'| '+color.RED+'| _ | '+color.ORANGE+"|"+color.RED+"| _ ,' / \| _ )| ___| ")
26-
time.sleep(0.1)
26+
time.sleep(0.05)
2727
print(color.RED+' > < '+color.ORANGE+'|'+color.RED+' `-.`-. '+color.ORANGE+'|'+color.RED+'| \ '+color.ORANGE+'|'+color.RED+'| ___| '+color.ORANGE+'|'+color.RED+' | __| '+color.ORANGE+'|'+color.RED+'| \ | - || |_ { | ___| ')
28-
time.sleep(0.1)
28+
time.sleep(0.05)
2929
print(color.RED+' /__/__\ '+color.ORANGE+'_|'+color.RED+'|______| '+color.ORANGE+'_|'+color.RED+'|__|\__\ '+color.ORANGE+' _|'+color.RED+'|___| '+color.ORANGE+' _|'+color.RED+' |___| '+color.ORANGE+' _|'+color.RED+'|__|\__\\____/|______)|______| ')
30-
time.sleep(0.1)
30+
time.sleep(0.05)
3131
print(color.ORANGE+' |_____| |_____| |_____| |_____| |_____| \n\n')
32-
time.sleep(0.1)
32+
time.sleep(0.05)
3333

3434
def banabout(): # some fancy banner stuff :p
3535

36-
print(color.BLUE+' [---] '+color.GREY+'XSRF Probe |'+color.RED+' A'+color.ORANGE+' Cross Site Request Forgery '+color.RED+'Audit Toolkit '+color.BLUE+'[---]')
37-
time.sleep(0.2)
36+
print(color.BLUE+' [---] '+color.GREY+'XSRF Probe,'+color.RED+' A'+color.ORANGE+' Cross Site Request Forgery '+color.RED+'Audit Toolkit '+color.BLUE+'[---]')
37+
time.sleep(0.1)
3838
print(color.BLUE+' [---] [---]')
39-
time.sleep(0.2)
39+
time.sleep(0.1)
4040
print(color.BLUE+' [---] '+color.PURPLE+' '+color.GREEN+'~ Author : '+color.CYAN+'The Infected Drake ~ '+color.BLUE+' [---]')
41-
time.sleep(0.2)
41+
time.sleep(0.1)
4242
print(color.BLUE+' [---] '+color.CYAN+' ~ github.com / '+color.GREY+'0xInfection ~ '+color.BLUE+' [---]')
43-
time.sleep(0.2)
43+
time.sleep(0.1)
4444
print(color.BLUE+' [---] [---]')
45-
time.sleep(0.2)
46-
print(color.BLUE+' [---] '+color.ORANGE+' ~ Version '+color.RED+open('files/VersionNum').read().strip()+color.ORANGE+' ~ '+color.BLUE+' [---]\n')
47-
time.sleep(0.2)
45+
time.sleep(0.1)
46+
print(color.BLUE+' [---] '+color.ORANGE+' ~ Version '+color.RED+open('files/VersionNum').read().strip()+color.ORANGE+' ~ '+color.BLUE+' [---]\n')
47+
time.sleep(0.1)

core/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# XSRF Probe #
66
#-:-:-:-:-:-:-::-:-:#
77

8-
# Author: @_tID
8+
# Author: 0xInfection
99
# This module requires XSRFProbe
1010
# https://github.com/0xInfection/XSRFProbe
1111

core/forms.py

+28-28
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,42 @@
99
#This module requires XSRF-Probe
1010
#https://github.com/0xInfection/XSRF-Probe
1111

12-
def form10(): # an example form to make sure the stuff works properly ;)
12+
def testFormx1(): # an example xsrfprobe-test-form to make sure the stuff works properly ;)
1313

14-
form0x01 = """<form action="/drupal/?q=node&amp;destination=node" accept-charset="UTF-8" method="post" id="user-login-form">
15-
<div><div class="form-item" id="edit-name-wrapper">
16-
<label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
17-
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="test1" class="form-text required" />
14+
test_form_0x01 = """<form action="/somendpoint" method="post" id="xsrfprobe-xsrfprobe-test-form">
15+
<div><div class="xsrfprobe-test-form-item" id="edit-name-wrapper">
16+
<label for="edit-name">Username: <span class="xsrfprobe-test-form-required" title="This field is required.">*</span></label>
17+
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="test1" class="xsrfprobe-test-form-text required" />
1818
</div>
19-
<div class="form-item" id="edit-pass-wrapper">
20-
<label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
21-
<input type="password" value="a9z8e7" name="pass" id="edit-pass" maxlength="60" size="15" class="form-text required" />
19+
<div class="xsrfprobe-test-form-item" id="edit-pass-wrapper">
20+
<label for="edit-pass">Password: <span class="xsrfprobe-test-form-required" title="This field is required.">*</span></label>
21+
<input type="password" value="a9z8e7" name="pass" id="edit-pass" maxlength="60" class="xsrfprobe-test-form-text required" />
2222
</div>
23-
<input type="submit" name="op" id="edit-submit" value="Log in" class="form-submit" />
24-
<div class="item-list"><ul><li class="first"><a href="/drupal/?q=user/register" title="Create a new user account.">Create new account</a></li>
25-
<li class="last"><a href="/drupal/?q=user/password" title="Request new password via e-mail.">Request new password</a></li>
26-
</ul></div><input type="hidden" name="form_build_id" id="form-6a060c0861888b7321fab4f5ac6cb908" value="form-6a060c0861888b7321fab4f5ac6cb908" />
27-
<input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block" />
23+
<input type="submit" name="op" id="edit-submit" value="Log in" class="xsrfprobe-test-form-submit" />
24+
<div class="item-list"><ul><li class="first"><a href="/somednpoint/register" title="Create a new user account.">Create new account</a></li>
25+
<li class="last"><a href="/somendpoint/tho" title="Request new password via e-mail.">Request new password</a></li>
26+
</ul></div><input type="hidden" name="xsrfprobe-test-form_build_id" id="xsrfprobe-test-form-6ab908" value="xsrfprobe-test-form-6a060cc6cb908" />
27+
<input type="hidden" name="xsrfprobe-test-form_id" id="edit-xsrfprobe-block" value="user_login_block" />
2828
</div></form> """
2929

30-
return form0x01
30+
return test_form_0x01
3131

32-
def form20(): # an example of a form (used drupal)
32+
def testFormx2(): # an example of a xsrfprobe-test-form (used drupal)
3333

34-
form0x02 = """<form action="/drupal/?q=node&amp;destination=node" accept-charset="UTF-8" method="post" id="user-login-form">
35-
<div><div class="form-item" id="edit-name-wrapper">
36-
<label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
37-
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="test2" class="form-text required" />
34+
test_form_0x02 = """<form action="/somendpoint" method="post" id="xsrfprobe-xsrfprobe-test-form">
35+
<div><div class="xsrfprobe-test-form-item" id="edit-name-wrapper">
36+
<label for="edit-name">Username: <span class="xsrfprobe-test-form-required" title="This field is required.">*</span></label>
37+
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="test2" class="xsrfprobe-test-form-text required" />
3838
</div>
39-
<div class="form-item" id="edit-pass-wrapper">
40-
<label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
41-
<input type="password" value="a9z8e7" name="pass" id="edit-pass" maxlength="60" size="15" class="form-text required" />
39+
<div class="xsrfprobe-test-form-item" id="edit-pass-wrapper">
40+
<label for="edit-pass">Password: <span class="xsrfprobe-test-form-required" title="This field is required.">*</span></label>
41+
<input type="password" value="a9z8e7" name="pass" id="edit-pass" maxlength="60" size="15" class="xsrfprobe-test-form-text required" />
4242
</div>
43-
<input type="submit" name="op" id="edit-submit" value="Log in" class="form-submit" />
44-
<div class="item-list"><ul><li class="first"><a href="/drupal/?q=user/register" title="Create a new user account.">Create new account</a></li>
45-
<li class="last"><a href="/drupal/?q=user/password" title="Request new password via e-mail.">Request new password</a></li>
46-
</ul></div><input type="hidden" name="form_build_id" id="form-6a060c0861888b7321fab4f5ac6cb908" value="form-6a060c0861888b7321fab4f5ac6cb908" />
47-
<input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block" />
43+
<input type="submit" name="op" id="edit-submit" value="Log in" class="xsrfprobe-test-form-submit" />
44+
<div class="item-list"><ul><li class="first"><a href="/somednpoint/register" title="Create a new user account.">Create new account</a></li>
45+
<li class="last"><a href="/somendpoint/tho" title="Request new password via e-mail.">Request new password</a></li>
46+
</ul></div><input type="hidden" name="xsrfprobe-test-form_build_id" id="xsrfprobe-test-form-6a060cc6cb908" value="xsrfprobe-test-form-6a060cc6cb908" />
47+
<input type="hidden" name="xsrfprobe-test-form_id" id="edit-xsrfprobe-block" value="user_login_block" />
4848
</div></form> """
4949

50-
return form0x02
50+
return test_form_0x02

core/inputin.py

+31-9
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#This module requires XSRF-Probe
1010
#https://github.com/0xInfection/XSRF-Probe
1111

12-
import sys
13-
import socket
12+
import socket, requests
13+
from tld import get_fld
1414
from core.colors import *
1515
from files.config import SITE_URL
1616

@@ -22,15 +22,37 @@ def inputin():
2222
if 'http' not in web: # add protocol to site
2323
web = 'http://' + web
2424

25-
web0 = web.split('//')[1]
25+
web0 = get_fld(web)
2626
try:
27-
print(O+'Testing site status...')
27+
print(O+'Testing site '+color.GREY+web0+color.END+' status...')
2828
socket.gethostbyname(web0) # test whether site is up or not
2929
print(color.GREEN+' [+] Site seems to be up!'+color.END)
3030
except socket.gaierror: # if site is down
3131
print(R+'Site seems to be down...')
32-
sys.exit(0)
33-
34-
if not web.endswith('/'): # check
35-
web = web + '/' # make sure the site address ends with '/'
36-
return web
32+
quit()
33+
try:
34+
print(O+'Testing '+color.CYAN+web.split('//')[1].replace(web0,'')+color.END+' endpoint status...')
35+
requests.get(web)
36+
print(color.GREEN+' [+] Endpoint seems to be up!'+color.END)
37+
except requests.exceptions.MissingSchema as e:
38+
verbout(R, 'Exception at: '+color.GREY+url)
39+
verbout(R, 'Error: Invalid URL Format')
40+
ErrorLogger(url, e.__str__())
41+
quit()
42+
except requests.exceptions.HTTPError as e: # if error
43+
verbout(R, "HTTP Error : "+main_url)
44+
ErrorLogger(main_url, e.__str__())
45+
quit()
46+
except requests.exceptions.ConnectionError as e:
47+
verbout(R, 'Connection Aborted : '+main_url)
48+
ErrorLogger(main_url, e.__str__())
49+
quit()
50+
except Exception as e:
51+
verbout(R, "Exception Caught: "+e.__str__())
52+
ErrorLogger(main_url, e.__str__())
53+
quit() # if at all nothing happens :(
54+
if not web0.endswith('/'):
55+
web0 = web0 + '/'
56+
if web.split('//')[1] == web0:
57+
return web, ''
58+
return (web, web0)

core/logger.py

+37-4
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
# XSRF Probe #
66
#-:-:-:-:-:-:-::-:-:#
77

8-
# Author: @_tID
8+
# Author: 0xInfection
99
# This module requires XSRFProbe
1010
# https://github.com/0xInfection/XSRFProbe
1111

1212
import os
1313
from core.colors import *
1414
from files.config import *
1515
from core.verbout import verbout
16+
from files.discovered import INTERNAL_URLS, FILES_EXEC, SCAN_ERRORS
17+
from files.discovered import VULN_LIST, FORMS_TESTED, REQUEST_TOKENS, STRENGTH_LIST
1618

1719
def logger(filename, content):
1820
'''
1921
This module is for logging all the stuff we found
2022
while crawling and scanning.
2123
'''
22-
output_file = OUTPUT_DIR + filename + '.txt'
24+
output_file = OUTPUT_DIR + filename + '.log'
2325
with open(output_file, 'w+', encoding='utf8') as f:
24-
for m in content:
25-
f.write(m+'\n')
26+
if type(content) is tuple or type(content) is list:
27+
for m in content: # if it is list or tuple, it is iterable
28+
f.write(m+'\n')
29+
else:
30+
f.write(content) # else we write out as it is... ;)
2631
f.write('\n')
2732

2833
def pheaders(tup):
@@ -35,3 +40,31 @@ def pheaders(tup):
3540
for key, val in tup.items():
3641
verbout(' ',color.CYAN+key+': '+color.ORANGE+val)
3742
verbout('','')
43+
44+
def GetLogger():
45+
if INTERNAL_URLS:
46+
logger('internal-links', INTERNAL_URLS)
47+
if SCAN_ERRORS:
48+
logger('errored', SCAN_ERRORS)
49+
if FILES_EXEC:
50+
logger('files-found', FILES_EXEC)
51+
if REQUEST_TOKENS:
52+
logger('anti-csrf-tokens', REQUEST_TOKENS)
53+
if FORMS_TESTED:
54+
logger('forms-tested', FORMS_TESTED)
55+
if VULN_LIST:
56+
logger('vulnerabilities', VULN_LIST)
57+
if STRENGTH_LIST:
58+
logger('strengths', STRENGTH_LIST)
59+
60+
def ErrorLogger(url, error):
61+
con = '(i) '+url+' -> '+error.__str__()
62+
SCAN_ERRORS.append(con)
63+
64+
def VulnLogger(url, vuln, content=''):
65+
tent = '[!] '+url+' -> '+vuln+'\n\n'+str(content)+'\n\n'
66+
VULN_LIST.append(tent)
67+
68+
def NovulLogger(url, strength):
69+
tent = '[+] '+url+' -> '+strength
70+
STRENGTH_LIST.append(tent)

0 commit comments

Comments
 (0)