Keystroke logger for Windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hokieghal99

    Keystroke logger for Windows

    Does anyone know of a keystroke logger that has been written in Python
    for Windows machines? I'd like to see such a script and use it as a
    point of reference for a real-time backup project that I'm working on.
    Basically, I'd like to be able to capture all keystrokes from the
    keyboard buffer and write them to a text file so I could reporduce
    emails, documents, etc. in the event of file loss that occurs between
    nightly backups. For example, my boss comes to me, he has deleted an
    email that he was writing... he has been working on the email all day...
    and he expects me to wave a magic wand and bring it back.

    Thanks for any advice, code or pointers. Also, if Python isn't suited
    for this, let me know and I'll look at doing this in c

  • Elaine Jackson

    #2
    Re: Keystroke logger for Windows

    I found this on the web someplace. It may be relevant.

    # /usr/local/bin/Python
    # Displays the keysym for each KeyPress event as you type
    import Tkinter
    root = Tkinter.Tk()

    root.title("Key sym Logger")

    def reportEvent(eve nt):
    print 'keysym=%s, keysym_num=%s' % (event.keysym, event.keysym_nu m)

    text = Tkinter.Text(ro ot, width=20, height=5, highlightthickn ess=2)

    text.bind('<Key Press>', reportEvent)

    text.pack(expan d=1, fill="both")
    text.focus_set( )

    root.mainloop()


    "hokieghal9 9" <hokiegal99@hot mail.com> wrote in message
    news:bi66lq$skj $1@solaris.cc.v t.edu...
    | Does anyone know of a keystroke logger that has been written in Python
    | for Windows machines? I'd like to see such a script and use it as a
    | point of reference for a real-time backup project that I'm working on.
    | Basically, I'd like to be able to capture all keystrokes from the
    | keyboard buffer and write them to a text file so I could reporduce
    | emails, documents, etc. in the event of file loss that occurs between
    | nightly backups. For example, my boss comes to me, he has deleted an
    | email that he was writing... he has been working on the email all day...
    | and he expects me to wave a magic wand and bring it back.
    |
    | Thanks for any advice, code or pointers. Also, if Python isn't suited
    | for this, let me know and I'll look at doing this in c
    |


    Comment

    • Elaine Jackson

      #3
      Re: Keystroke logger for Windows

      I found this on the web someplace. It may be relevant.

      # /usr/local/bin/Python
      # Displays the keysym for each KeyPress event as you type
      import Tkinter
      root = Tkinter.Tk()

      root.title("Key sym Logger")

      def reportEvent(eve nt):
      print 'keysym=%s, keysym_num=%s' % (event.keysym, event.keysym_nu m)

      text = Tkinter.Text(ro ot, width=20, height=5, highlightthickn ess=2)

      text.bind('<Key Press>', reportEvent)

      text.pack(expan d=1, fill="both")
      text.focus_set( )

      root.mainloop()


      "hokieghal9 9" <hokiegal99@hot mail.com> wrote in message
      news:bi66lq$skj $1@solaris.cc.v t.edu...
      | Does anyone know of a keystroke logger that has been written in Python
      | for Windows machines? I'd like to see such a script and use it as a
      | point of reference for a real-time backup project that I'm working on.
      | Basically, I'd like to be able to capture all keystrokes from the
      | keyboard buffer and write them to a text file so I could reporduce
      | emails, documents, etc. in the event of file loss that occurs between
      | nightly backups. For example, my boss comes to me, he has deleted an
      | email that he was writing... he has been working on the email all day...
      | and he expects me to wave a magic wand and bring it back.
      |
      | Thanks for any advice, code or pointers. Also, if Python isn't suited
      | for this, let me know and I'll look at doing this in c
      |


      Comment

      • Michael Geary

        #4
        Re: Keystroke logger for Windows

        > Does anyone know of a keystroke logger that has been written in Python[color=blue]
        > for Windows machines? I'd like to see such a script and use it as a
        > point of reference for a real-time backup project that I'm working on.
        > Basically, I'd like to be able to capture all keystrokes from the
        > keyboard buffer and write them to a text file so I could reporduce
        > emails, documents, etc. in the event of file loss that occurs between
        > nightly backups. For example, my boss comes to me, he has deleted an
        > email that he was writing... he has been working on the email all day...
        > and he expects me to wave a magic wand and bring it back.
        >
        > Thanks for any advice, code or pointers. Also, if Python isn't suited
        > for this, let me know and I'll look at doing this in c[/color]

        I don't think Python would be a good choice for the basic keystroke logging
        utility. A program like this is implemented as a systemwide message hook,
        which is a DLL that is loaded into the address space of *every* application.
        This is a simple piece of code that should be written in C/C++ to keep it
        small.

        There are a number of commercial products that do keystroke logging, but the
        ones I've seen are intended for spying on someone else's computer
        activity--i.e. something your boss might want to put on your computer, not
        something you would want to put on your boss's computer!

        I find the spying orientation of those products rather distasteful, but
        maybe one of them could be used in a more benign way. PC Magazine reviewed
        several of them last year:

        PCMag is your complete guide to computers, peripherals and upgrades. We test and review tech products and services, report technology news and trends, and provide shopping advice with price comparisons.


        Some time ago I wrote a similar program for my own use (spying on myself as
        it were). Maybe it would be worth cleaning it up and releasing it as open
        source. It's actually pretty handy. For example, if I see a file on my
        system I don't recognize, I can look back at my log and see what I was
        doing--what program I was running that created that file. But I'd be worried
        about the privacy implications--I wouldn't want my program being used as
        spyware.

        -Mike


        Comment

        • Michael Geary

          #5
          Re: Keystroke logger for Windows

          > Does anyone know of a keystroke logger that has been written in Python[color=blue]
          > for Windows machines? I'd like to see such a script and use it as a
          > point of reference for a real-time backup project that I'm working on.
          > Basically, I'd like to be able to capture all keystrokes from the
          > keyboard buffer and write them to a text file so I could reporduce
          > emails, documents, etc. in the event of file loss that occurs between
          > nightly backups. For example, my boss comes to me, he has deleted an
          > email that he was writing... he has been working on the email all day...
          > and he expects me to wave a magic wand and bring it back.
          >
          > Thanks for any advice, code or pointers. Also, if Python isn't suited
          > for this, let me know and I'll look at doing this in c[/color]

          I don't think Python would be a good choice for the basic keystroke logging
          utility. A program like this is implemented as a systemwide message hook,
          which is a DLL that is loaded into the address space of *every* application.
          This is a simple piece of code that should be written in C/C++ to keep it
          small.

          There are a number of commercial products that do keystroke logging, but the
          ones I've seen are intended for spying on someone else's computer
          activity--i.e. something your boss might want to put on your computer, not
          something you would want to put on your boss's computer!

          I find the spying orientation of those products rather distasteful, but
          maybe one of them could be used in a more benign way. PC Magazine reviewed
          several of them last year:

          PCMag is your complete guide to computers, peripherals and upgrades. We test and review tech products and services, report technology news and trends, and provide shopping advice with price comparisons.


          Some time ago I wrote a similar program for my own use (spying on myself as
          it were). Maybe it would be worth cleaning it up and releasing it as open
          source. It's actually pretty handy. For example, if I see a file on my
          system I don't recognize, I can look back at my log and see what I was
          doing--what program I was running that created that file. But I'd be worried
          about the privacy implications--I wouldn't want my program being used as
          spyware.

          -Mike


          Comment

          • Michael Geary

            #6
            Re: Keystroke logger for Windows

            > I don't think Python would be a good choice for the basic keystroke
            logging[color=blue]
            > utility. A program like this is implemented as a systemwide message hook,
            > which is a DLL that is loaded into the address space of *every*[/color]
            application.[color=blue]
            > This is a simple piece of code that should be written in C/C++ to keep it
            > small.[/color]

            Just adding one (fairly obvious) thought... Even though I wouldn't use
            Python for the low-level systemwide message hook, it would be an excellent
            choice for code that processes the resulting log.

            -Mike


            Comment

            • Michael Geary

              #7
              Re: Keystroke logger for Windows

              > I don't think Python would be a good choice for the basic keystroke
              logging[color=blue]
              > utility. A program like this is implemented as a systemwide message hook,
              > which is a DLL that is loaded into the address space of *every*[/color]
              application.[color=blue]
              > This is a simple piece of code that should be written in C/C++ to keep it
              > small.[/color]

              Just adding one (fairly obvious) thought... Even though I wouldn't use
              Python for the low-level systemwide message hook, it would be an excellent
              choice for code that processes the resulting log.

              -Mike


              Comment

              • Peter Parente

                #8
                Re: Keystroke logger for Windows

                Change of plans. The hooks library is at
                http://www.sourceforge.net/projects/uncassist. You can download and
                run the pyHook windows installer, or check it out of CVS. There's an
                example.py file in the CVS pyHook module that shows you how to use it
                (requires wxPython for the GUI).

                Pete

                parente@cs.unc. edu (Peter Parente) wrote in message news:<85b6a599. 0308230628.49ba 3c74@posting.go ogle.com>...[color=blue]
                > I have a Python library that can capture system wide keystrokes and
                > mouse events. Basically, the windows hooking code is in a C Python
                > extension that passes callback information back to Python when an
                > event occurs. I'll
                > post it to our Python tools sourceforge site in the near future. (I
                > need to clean it up a bit and provide an example before it will be the
                > least bit useful to you.)
                >
                > When it's posted, it will appear at
                > http://sourceforge.net/projects/uncpythontools/ as the pyHook project.
                >
                > Pete
                >
                >
                > hokieghal99 <hokiegal99@hot mail.com> wrote in message news:<bi66lq$sk j$1@solaris.cc. vt.edu>...[color=green]
                > > Does anyone know of a keystroke logger that has been written in Python
                > > for Windows machines? I'd like to see such a script and use it as a
                > > point of reference for a real-time backup project that I'm working on.
                > > Basically, I'd like to be able to capture all keystrokes from the
                > > keyboard buffer and write them to a text file so I could reporduce
                > > emails, documents, etc. in the event of file loss that occurs between
                > > nightly backups. For example, my boss comes to me, he has deleted an
                > > email that he was writing... he has been working on the email all day...
                > > and he expects me to wave a magic wand and bring it back.
                > >
                > > Thanks for any advice, code or pointers. Also, if Python isn't suited
                > > for this, let me know and I'll look at doing this in c[/color][/color]

                Comment

                Working...