Last active
December 14, 2015 15:39
-
-
Save Songmu/5109279 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S.on('appActivated', function (event, app) { | |
S.log('appActivated:' + app.name()); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type forward | |
port 24224 | |
</source> | |
<match keylogger> | |
type copy | |
<store> | |
type datacounter | |
#unit minute | |
count_interval 1m | |
count_key app | |
tag keycounter | |
aggregate all | |
# patternX: X(1-9) | |
pattern1 Terminal ^Terminal$ | |
pattern2 MacVim ^MacVim$ | |
pattern3 LimeChat ^LimeChat$ | |
pattern4 Slack ^Slack$ | |
pattern5 GoogleChrome ^Google\s*Chrome$ | |
</store> | |
<store> | |
type stdout | |
</store> | |
</match> | |
<match keycounter> | |
type copy | |
<store> | |
type growthforecast | |
gfapi_url http://localhost:5127/api/ | |
service key | |
section count | |
tag_for ignore | |
name_keys Terminal_count,MacVim_count,LimeChat_count,Slack_count,GoogleChrome_count | |
</store> | |
<store> | |
type mackerel | |
service songmu | |
api_key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
metrics_name keylogger.${out_key} | |
out_keys Terminal_count,MacVim_count,LimeChat_count,Slack_count,GoogleChrome_count | |
</store> | |
<store> | |
type stdout | |
</store> | |
</match> | |
<match **> | |
type stdout | |
</match> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.014; | |
use warnings; | |
#use utf8; | |
use autodie; | |
$| = 1; | |
my $current_app = 'Terminal'; | |
while (my $line = <>) { | |
if (my ($app) = $line =~ /Slate\[.*appActivated:(.*)/) { | |
if ($app =~ /ターミナル/) { | |
$app = 'Terminal'; | |
} | |
else { | |
$app =~ s/[^a-zA-Z0-9 ]//g; | |
} | |
$current_app = $app; next; | |
} | |
my $press_key = quotemeta 'org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 10'; | |
if ($line =~ /$press_key/) { | |
printf qq[{"app": "%s"}\n], $current_app if $current_app; | |
} | |
} | |
1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
tail -F /var/log/system.log | perl $HOME/service/keylogger/keylogger.pl | fluent-cat keylogger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment