Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nedanator

macrumors newbie
Original poster
Apr 11, 2008
28
0
Derby, UK
I need to make an application that will listen in the background for specific keywords. Then, when a keyword is heard it sends me a notification on a different computer with the following content.

> The Keyword that triggered the alert.
> The computers Name.
> And the time the alert was triggered.

Somebody else suggested, Listening in the background for the keywords, then using sockets to notify two other machines.

Is this possible? If so, can anyone help me make it?


Dan
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
I need to make an application that will listen in the background for specific keywords. Then, when a keyword is heard it sends me a notification on a different computer with the following content.

> The Keyword that triggered the alert.
> The computers Name.
> And the time the alert was triggered.

Somebody else suggested, Listening in the background for the keywords, then using sockets to notify two other machines.

Is this possible? If so, can anyone help me make it?


Dan

What language will you be using?
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
Err, I would be using Xcode to build the App.

Yes, but what programming language?

If you have no idea what I am talking about then you need to learn a programming language before you even think about writing an application. I would suggest one of the following C, Objective-C or Python to get you going.

There are tons of threads about how to start programming in this forum.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
The NSA has something like this that looks for specific words. In addition to checking computers, it searches phone calls. You should contact them and see if they will give you a copy.
 

ChrisA

macrumors G5
Jan 5, 2006
12,576
1,691
Redondo Beach, California
I need to make an application that will listen in the background for specific keywords. Then, when a keyword is heard it sends me a notification on a different computer with the following content.

> The Keyword that triggered the alert.
> The computers Name.
> And the time the alert was triggered.

Somebody else suggested, Listening in the background for the keywords, then using sockets to notify two other machines.

Is this possible? If so, can anyone help me make it?


Dan

The notification part is easy. Yes you might use sockets if the rate of detection is fast but you could even use email. Email is more robust and does not require the sender and receiver to be on-line at the same time.

The hard part is detection of the key words. Do you literally mean "listening" as in with a microphone or is it reading some text stream?
 

Nedanator

macrumors newbie
Original poster
Apr 11, 2008
28
0
Derby, UK
also, define listen. for a spoken word on a mic? typed on the keyboard?

-Lee

The keywords would be typed.

I shan't bother contacting the NSA, I might get shot.

And all the machines on the network are always online. And our email is a bit slow.

This is the situation.

Computer showroom
(All computers are visible at all times. except when there is a large group of kids around them, and that is when the bad things happen.)

They are always online.

Those machines would send their notification to two checkout computers, also always online.

All the machines are the very latest Intel Macs.


This is our problem. We need this app quick, but none of us have any programming experience. We're Salesmen.


Cheers, Dan
 

LeMarsu

macrumors newbie
Jul 3, 2006
13
0
.eu
The keywords would be typed.

I shan't bother contacting the NSA, I might get shot.

And all the machines on the network are always online. And our email is a bit slow.

This is the situation.

Computer showroom
(All computers are visible at all times. except when there is a large group of kids around them, and that is when the bad things happen.)

They are always online.

Those machines would send their notification to two checkout computers, also always online.

All the machines are the very latest Intel Macs.


This is our problem. We need this app quick, but none of us have any programming experience. We're Salesmen.


Cheers, Dan


looks like you are looking for :

http://www.parental-controls-software.net/mac-keylogger-perfect-keylogger-for-mac-os-x.htm
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
I think you grossly underestimate the time value of trying to write your own software, especially when you've never done it before. It's like saying to save money on car repair, I'm going to rebuild the engine, even though I know nothing about auto-mechanics. It's not a trivial task and requires some experience.

Tell the clueless managers to suck it up and spend the whopping $50 for some keylogger software, if that's what they decide they want.
 

Nedanator

macrumors newbie
Original poster
Apr 11, 2008
28
0
Derby, UK
I think you grossly underestimate the time value of trying to write your own software, especially when you've never done it before. It's like saying to save money on car repair, I'm going to rebuild the engine, even though I know nothing about auto-mechanics. It's not a trivial task and requires some experience.

Tell the clueless managers to suck it up and spend the whopping $50 for some keylogger software, if that's what they decide they want.

I do realise that it would take me a while to make this application. But there is another reason why I want to make this. I want to learn how to program stuff.
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
I do realise that it would take me a while to make this application. But there is another reason why I want to make this. I want to learn how to program stuff.

Sure go ahead, but it might take you a few months to a few years, depending on how much time you can invest. If you do nothing else the entire day, it might be a few months. If you do it on the weekend on and off it might take you half a decade. Programming looks simple, but it isn't.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I'll at least say that keylogging will be easier than listening for a spoken word, so you have that on your side, at least.

What I'm not sure of is how sophisticated current keyloggers are, and how you could be sure you were catching every instance.

If you want to find out when someone has typed "sex", it's trivial if they just type s-e-x, but not so much if they type s-w-<backspace>-g-<backspace>-e-x. Or if they copied each letter from some other page and pasted them together, though that is far less likely unless they are intentionally trying to break the safeguards you are setting up.

I'm sure it's not perfect, but have you tried:
http://www.apple.com/macosx/features/parentalcontrols.html
?

If you're already working on Macs, that may be an option.

If there are very specific sites that you want to block, you could probably put them in the hosts file pointing to a google IP or the machines own IP so nothing gets pulled up.

For the notification: Sockets aren't THAT hard, but I would actually recommend having your program invoke a script, etc. that copies a file to one of the checkout machines via AFP or SMB or FTP, and just put another applescript that triggers off of content changes on that folder on the checkout machines. There's less programming to do then. The file could contain the machine's name, the "naughty" word that was typed, etc.

Once you have the notification and keylogging going, the hard part is what words to trigger on. Do you know all of the slang words in russian for sex acts? How about various racial slurs in Tagalog? Have you found somewhere on line that provides a somewhat comprehensive list to try to filter on?

I won't discourage you, but know that this will take some time. Hopefully you can get paid for the time you spend since it is for work, but it doesn't sound like you will. Break the problem down until you feel like you can approach it. I would try:
Capture Keystrokes
Break keystroke stream into words
Analyze words against a blacklist and greylist (you may want some greylisted words, and if more than 2 are present in a series of 10 words, etc. that causes a notification)
When a match is found, send alert to checkout machine.
When a match is found, display a dialog that their activity has been logged and that store personnel have been notified.
When a match is found, if your macs have built in iSights, take a pictures and send that along with the alert.
On receiving system, check for new alerts.
On receiving system, display a notice when alert is found.

I think a lot of this can be done with pretty simple applescript. The only thing you should really need to do in Obj-C. You may even be able to get away with using an existing keylogger and just parsing its output, which would make your task even easier.

-Lee
 

Nedanator

macrumors newbie
Original poster
Apr 11, 2008
28
0
Derby, UK
I'll at least say that keylogging will be easier than listening for a spoken word, so you have that on your side, at least.

What I'm not sure of is how sophisticated current keyloggers are, and how you could be sure you were catching every instance.

If you want to find out when someone has typed "sex", it's trivial if they just type s-e-x, but not so much if they type s-w-<backspace>-g-<backspace>-e-x. Or if they copied each letter from some other page and pasted them together, though that is far less likely unless they are intentionally trying to break the safeguards you are setting up.

I'm sure it's not perfect, but have you tried:
http://www.apple.com/macosx/features/parentalcontrols.html
?

If you're already working on Macs, that may be an option.

If there are very specific sites that you want to block, you could probably put them in the hosts file pointing to a google IP or the machines own IP so nothing gets pulled up.

For the notification: Sockets aren't THAT hard, but I would actually recommend having your program invoke a script, etc. that copies a file to one of the checkout machines via AFP or SMB or FTP, and just put another applescript that triggers off of content changes on that folder on the checkout machines. There's less programming to do then. The file could contain the machine's name, the "naughty" word that was typed, etc.

Once you have the notification and keylogging going, the hard part is what words to trigger on. Do you know all of the slang words in russian for sex acts? How about various racial slurs in Tagalog? Have you found somewhere on line that provides a somewhat comprehensive list to try to filter on?

I won't discourage you, but know that this will take some time. Hopefully you can get paid for the time you spend since it is for work, but it doesn't sound like you will. Break the problem down until you feel like you can approach it. I would try:
Capture Keystrokes
Break keystroke stream into words
Analyze words against a blacklist and greylist (you may want some greylisted words, and if more than 2 are present in a series of 10 words, etc. that causes a notification)
When a match is found, send alert to checkout machine.
When a match is found, display a dialog that their activity has been logged and that store personnel have been notified.
When a match is found, if your macs have built in iSights, take a pictures and send that along with the alert.
On receiving system, check for new alerts.
On receiving system, display a notice when alert is found.

I think a lot of this can be done with pretty simple applescript. The only thing you should really need to do in Obj-C. You may even be able to get away with using an existing keylogger and just parsing its output, which would make your task even easier.

-Lee


Thank you very much.

Regarding the List of keywords.

I installed a key logger on all the machines today, so I will leave that on for a few weeks to get a nice large list of terms, Its mainly only Friday, Saturday and Sunday that yobs use the machines. For example we caught one new keyword the other day. 'Meatswing' this is when a Male swings about his 'meat' in front of a camera. this is now on the blacklist.
The key Logger in question is 'LogKext' it runs through Terminal, do you think it would be possible to Parse output from this?

Applescript sounds like a good idea, and I like your idea about the dialog box and iSight.

Somebody else suggested sending the alerts out via RSS. Would this be a possible route?

You obviously know what your talking about.

Cheers, Dan.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
I think it is great that you want to learn to program, and I sincerely hope you do, but don't go promising you'll have this app written in 'a couple of weeks' otherwise you could end up in a depressing situation with your manager …and likely be considering forking out for the software yourself!

b e n
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Thank you very much.

Regarding the List of keywords.

I installed a key logger on all the machines today, so I will leave that on for a few weeks to get a nice large list of terms, Its mainly only Friday, Saturday and Sunday that yobs use the machines. For example we caught one new keyword the other day. 'Meatswing' this is when a Male swings about his 'meat' in front of a camera. this is now on the blacklist.
The key Logger in question is 'LogKext' it runs through Terminal, do you think it would be possible to Parse output from this?

Applescript sounds like a good idea, and I like your idea about the dialog box and iSight.

Somebody else suggested sending the alerts out via RSS. Would this be a possible route?

You obviously know what your talking about.

Cheers, Dan.

I'm not familiar w/ LogKext, but I think if you just turn encryption off so the log file is plain text, it should be easy to parse the LogKext logfile. You'll need to find out where it is stored. I don't know what format it writes. It may put one word per line, or break lines at 80 characters, etc. This will determine how you parse it. It should be easy to have something that is constantly reading the end of this file with something like "tail -f". It's also pretty trivial to see if any particular word is in your list.

In the case of meatswing that might be a reason to do something like the grey list. meat and swing are probably not going to be on the blacklist individually, but perhaps if you see them within 5 words of each other, etc. that's an issue. Of course with no space you can just have meatswing in the blacklist, but I'm guessing they'd find plenty of things with two words as well.

I'd say simpler is better, but you can probably implement everything first just to be sure you're matching words and getting alerted. Then you can worry about supplementing that with other features like alerting the users that the act has been reported, taking their picture, etc. There may be legal implications to photographing them. If your store already has a notice on the front that surveillance equipment is in use you should be fine, but if not I would be hesitant to do that.

RSS... it's possible, but i'd try to keep it simple at first.

All RSS is is an xml document with a particular format. Generally it's used to give summaries of some items whose full contents are published elsewhere, but this is not required. I'd recommend against this at first, as stated above. Get something simple going, then you can worry about that. i don't see RSS as being the fastest as most RSS software only checks for updates to the feed every N minutes. You seem to want to know immediately, so RSS might not fit the bill. It's not a bad idea, but that's not where I would start.

If you want to learn XML, you can try to add that in later, but for your first crack that's adding a lot of complexity for little gain in functionality.

-Lee
 

ChrisA

macrumors G5
Jan 5, 2006
12,576
1,691
Redondo Beach, California
The keywords would be typed.

I shan't bother contacting the NSA, I might get shot.

And all the machines on the network are always online. And our email is a bit slow.

This is the situation.

Computer showroom
(All computers are visible at all times. except when there is a large group of kids around them, and that is when the bad things happen.)

They are always online.

Those machines would send their notification to two checkout computers, also always online.

All the machines are the very latest Intel Macs.


This is our problem. We need this app quick, but none of us have any programming experience. We're Salesmen.


Cheers, Dan

So this only applies to a web brower? All you really want to do is prevent access to certain web sites?

The most importent part of writing software is getting the requirements down correctly. This is very, very hard because people like to think in terms of "sollutions" and "actions" and are not so good at defining a problem. So if your problem is "kids are using our computers to access web sites we don't like, we need to prevent this" your proposed solution is not very good and it is certainly way to expensive and complex.

The simplest and most effective thing to do is set up all the machines to acces the web via a proxy server and then have the proxy filter content using several different sets of rules. This would cost you nothing (other than the time to set it up) and can acually make web acces appear to be faster. You can also block ads and popups at the same time. The pproxy can be configured to send mesaages to you.

Back when I was a sys-admin I prefered email notifications. Yes we sent them to a log file but we mailed a lot of them to a distribution list that included my cell phone. That way if a process or computer failed I'd get the message right away.

Now if what you car about is kids typing bad words into a text editor and saving the files. Just use leoprd's Guest account and all of that will go away when the account is logged out.
 

Muncher

macrumors 65816
Apr 19, 2007
1,465
0
California
So this only applies to a web brower? All you really want to do is prevent access to certain web sites?

The most importent part of writing software is getting the requirements down correctly. This is very, very hard because people like to think in terms of "sollutions" and "actions" and are not so good at defining a problem. So if your problem is "kids are using our computers to access web sites we don't like, we need to prevent this" your proposed solution is not very good and it is certainly way to expensive and complex.

The simplest and most effective thing to do is set up all the machines to acces the web via a proxy server and then have the proxy filter content using several different sets of rules. This would cost you nothing (other than the time to set it up) and can acually make web acces appear to be faster. You can also block ads and popups at the same time. The pproxy can be configured to send mesaages to you.

Back when I was a sys-admin I prefered email notifications. Yes we sent them to a log file but we mailed a lot of them to a distribution list that included my cell phone. That way if a process or computer failed I'd get the message right away.

Now if what you care about is kids typing bad words into a text editor and saving the files. Just use leoprd's Guest account and all of that will go away when the account is logged out.

Yes, Chris is right. Perhaps a key-logger is overkill; maybe parental control features are all you need? Do you really need to know EVERY word they type? Or if what they're typing is inappropriate? Now, if they're sticking obscene backgrounds on your computer, or turning the volume to full and making it say things you'd rather the computer not say, that's a different matter. But you could probably hide access to the say command in the terminal and use a guest account so you could just log them off later.

Another approach would be to use desktop sharing to watch them.
 

Nedanator

macrumors newbie
Original poster
Apr 11, 2008
28
0
Derby, UK
Yes, Chris is right. Perhaps a key-logger is overkill; maybe parental control features are all you need? Do you really need to know EVERY word they type? Or if what the.....Another approach would be to use desktop sharing to watch them....

Yeah, we are screen sharing them off, but its mainly on the very busy shopping days that they come in and we cant clear them off and talk to customers at the same time. we do physically clear them off sometimes as well but its just more fun to make and use an app.
 

Muncher

macrumors 65816
Apr 19, 2007
1,465
0
California
Yeah, we are screen sharing them off, but its mainly on the very busy shopping days that they come in and we cant clear them off and talk to customers at the same time. we do physically clear them off sometimes as well but its just more fun to make and use an app.

Perhaps you could draw one of the larger kids over and hire him at minimum wage to keep his buddies away? Just a thought. :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.