LOoLzeC

[Python] upfile.py

Nov 28th, 2018
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.38 KB | None | 0 0
  1. #!/usr/bin/python
  2. #-*-coding:utf-8-*-
  3. W = '\033[1;37m'
  4. N  = '\033[0m'
  5. R = '\033[31m'
  6. G  = '\033[1;32m'
  7. import requests
  8. import re
  9. import os
  10. import sys
  11. from time import sleep
  12. class upload():
  13.     def __init__(self):
  14.         self.banner()
  15.         self.buka()
  16.     def banner(self):
  17.         ban="""
  18.              ______  _  _      
  19. LOoLzeC Scurty|  ___|(_)| |      
  20. _   _  _ __  | |_    _ | |  ___
  21. | | | || '_ \ |  _|  | || | / _ \\
  22. | |_| || |_) || |    | || ||  __/
  23. \__,_|| .__/ \_|    |_||_| \___|
  24.       | |  - reffer: upfile.mobi
  25.       |_|  - coded by deray
  26.                    
  27. """+N
  28.         for perin in ban:
  29.             sys.stdout.write(perin)
  30.             sys.stdout.flush()
  31.             sleep(00.01)
  32.     def nanya(self):
  33.         r=raw_input('[U]lang? / [E]xit? U/E: ')
  34.         if "u" in r.lower():
  35.             os.system('clear')
  36.             print """
  37.              ______  _  _      
  38. LOoLzeC Scurty|  ___|(_)| |      
  39. _   _  _ __  | |_    _ | |  ___
  40. | | | || '_ \ |  _|  | || | / _ \\
  41. | |_| || |_) || |    | || ||  __/
  42. \__,_|| .__/ \_|    |_||_| \___|
  43.       | |  - reffer: upfile.mobi
  44.       |_|  - coded by deray
  45.                    
  46. """+N
  47.             self.buka()
  48.         else:sys.exit(W+R"\n[!]"+N+" Exit.")
  49.     def buka(self):
  50.         try:
  51.             self.filename=raw_input('[*] path file lu: '+W+'')
  52.             o=open(self.filename)
  53.             self.up()
  54.         except Exception as f:
  55.             print(W+R+"[!] "+N+str(f))
  56.             self.nanya()
  57.     def up(self):
  58.         name=raw_input(N+'[*] file name   : '+W+'')
  59.         print(N+"[*] uploading files ...")
  60.         filed=open(self.filename,'rb')
  61.         files={"file":(name,filed,"multipart/form-data"),"submit":"upload"}
  62.         memek=requests.post('http://fs2.upfile.mobi:2052/upload_1',files=files).text
  63.         if "File uploaded" in memek:
  64.             print("[*] Upload Success jancogg")
  65.             print("-"*50)
  66.             print("[!] Link Download: "+G+str(re.findall('<a href = "(.*?)"/>',memek)[0]))
  67.             print(N+"[!] Page Delete  : "+G+str(re.findall('color:black">(.*?)</span>',memek)[0]))
  68.             print(W+R+"[!] "+N+"backup links: "+G+name+".txt")
  69.             a="[!] Link Download: "+str(re.findall('<a href = "(.*?)"/>',memek)[0])
  70.             b="[!] Page Delete  : "+str(re.findall('color:black">(.*?)</span>',memek)[0])
  71.             c=open(name+'.txt','w')
  72.             d="""#### Backup Links {} ####
  73. {}
  74. {}
  75.             """.format(name,a,b)
  76.             c.write(d)
  77.             c.close()
  78.             print(N+"-"*50)
  79.             self.nanya()
  80.         else:
  81.             print(W+R+"[-] "+N+"gagal upload mek")
  82.             self.nanya()
  83. if __name__ == "__main__":
  84.     try:
  85.         upload()
  86.     except:sys.exit(W+R"\n[!]"+N+" Exit.")
Advertisement
Add Comment
Please, Sign In to add comment