473,666 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Key logger

2 New Member
Hello,

I was wondering if it is possible to create a key logger program that utilize the javascript programming language. Well, the entire program itself wouldn't be coded in javascript, only the client-side of the program. So on the client, is it possible to use javascript to invisibly record what a user inputs in the address field, and other website forms, then that data would be sent to the server to be stored in a text file?


p.s. I'm trying to create this security system, that has the capacity to build psychological profiles of users based on the websites they go, and the key logger component would provide the system access to the user's data, to be used for processing.
Jan 13 '10 #1
5 3951
gits
5,390 Recognized Expert Moderator Expert
of course .... it is possible ... but you would only be able to record the keypresses that are done while the webpage has focus ...

kind regards
Jan 13 '10 #2
harrierdh
16 New Member
Here are two ways. The first code captures everything the user types. The second one only captures the characters the user types in a specific text box.
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. var keystrokes = "";
  3. if (navigator.appName == 'Netscape') {
  4.     window.captureEvents(Event.KEYPRESS);
  5.     document.onkeypress = netscapeKeyPress;
  6. }
  7. function netscapeKeyPress(e) {
  8.     keyCode=e.which;
  9.     handleEvent(keyCode);
  10. }
  11. function microsoftKeyPress() {
  12.     keyCode = window.event.keyCode;
  13.     handleEvent(keyCode);
  14. }
  15. function handleEvent(keyCode) {
  16.     keystrokes += String.fromCharCode(keyCode);
  17. }
  18. </script>
  19. <body onKeyPress="microsoftKeyPress();">
  20.  
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. var keystrokes = "";
  3. function captureKey(e) {
  4.     var key = window.event ? e.keyCode : e.which;
  5.     var keychar = String.fromCharCode(key);
  6.     keystrokes += keychar;
  7. }
  8. </script>
  9.  
  10. <input type="text" onkeypress="captureKey(event);" />
  11.  
Jan 13 '10 #3
gits
5,390 Recognized Expert Moderator Expert
the second script would even capture all keystrokes when you would add the listener to the document like this:
Expand|Select|Wrap|Line Numbers
  1. var keystrokes = "";
  2.  
  3. function captureKey(e) {
  4.     var key = window.event ? e.keyCode : e.which;
  5.     var keychar = String.fromCharCode(key);
  6.     keystrokes += keychar;
  7. }
  8.  
  9. document.onkeypress = captureKey;
and it should be preferred to use addEventListene r() / attachEvent() to add the listerens ... like here for FF for example:
Expand|Select|Wrap|Line Numbers
  1. document.addEventListener('keypress', captureKey, true);
kind regards
Jan 14 '10 #4
acoder
16,027 Recognized Expert Moderator MVP
Also note that the first script is badly out of date to the point of almost being useless.
Jan 15 '10 #5
meng91
2 New Member
Thanks so much for the insight. More questions coming soon!!

best regards,
Jan 15 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2804
by: Nermin Brgulja | last post by:
Hi, I am using jdk1.4 Logger with a FileHandler for logging in a web application, and have two questions regarding logging: The first question is: I've created an Logger and mapped it to an FileHandler. When the application starts the logging, The logger is writing in the file as well as in to Syste.out. How can I turn off system out?
0
1955
by: Laszlo | last post by:
Hi I need a GL::Logger wich implements Class::Singleton to be a singleton and Log::Log4perl to can log amy message into a file. Here is the module source: ------------------------------------------------------------------------- package GL::Logger; use Class::Singleton; use vars qw( $ERROR );
2
2468
by: Robert | last post by:
Hi all I have been trying to set up a framework with logging implemented using the built in Python logging module. For better or worse, I have decided to base the logger names on the module names. This means that I am using multiple layers of name, eg logging.getLogger("a.b.c"). I am also using logging.config to load a file configuration but have been experiencing some unexpected behaviour. If for instance I have something resembling...
1
1576
by: rodsatt | last post by:
Hi, This is my first post, and I got questions about logging. When something happen within an object, and if I would like to log the event, what would be a good way to do it? 1. I make the logger object embedded in the class and use it (as the one below) 2. I have only one logger that other objects can call. Create Logger once, and let it stay there where other objects can call for services. The reason I asked this question about this...
10
8078
by: Gary Jefferson | last post by:
Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', and each module has its own logger, created with: module1logger = logging.getLogger('project.A') and module2logger = logging.getLogger('project.A.a') and
5
2118
by: CedricCicada | last post by:
Greetings! I want to write messages into the Windows event log. I found sevicemanager, but the source is always "Python Service", and I'd like to be a bit more descriptive. Poking around on the Internet revealed the existence of the logging module. It seems to have easily understood methods with the power I need. So I tried it. Here's my attempt: logger = logging.getLogger("TahChung Part 1")
4
1705
by: garyjefferson123 | last post by:
Suppose I have some sort of context variable that I want to appear in log messages. E.g.: logger = logging.getLogger("somelogger") class SomeOp: def __init__(self, ctx): self.ctx = ctx def method1(self): logger.info("%s: here's a message", self.ctx)
2
3297
by: DwBear75 | last post by:
I am hoping to find some simple examples of how to create a logger instance using smtphandler. I don't want to create a separate ini file. I just want to sent the smtphost, from, to right in the code when I instantiate the logger. I can't seem to find simple code on how to do this. Any pointers ?
1
1807
by: nagk9 | last post by:
Hi , I am using log4j in my application. I have the problem with log4j.properties file . It will automatically appends another logger file from the current logger which i am using for the current application and also it logs or merging other logger content of other applications in the current logger. I don't want to print other logger messages from the current logger. Is there any way to restrict the other logger messages of other...
1
2852
by: Matimus | last post by:
Yes but in the other hand :http://docs.python.org/library/logging.html#logger-objects That is part of the power of the logging module. If you ask for a logger of the same name in two different place you will get the same object. That way you don't have to pass the logger instances around, and it always has the same properties (same handlers attached, same level, etc.). If you want to add functionality you getLoggerClass, inherit from...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.