Page 2 of 3

Posted: Wed 02 Nov 2016, 21:20
by greengeek
Hey, good find! I did select us keymap so hopefully that is the problem. Will test later tonight I hope.

Posted: Wed 02 Nov 2016, 23:28
by Geoffrey
greengeek wrote:Hey, good find! I did select us keymap so hopefully that is the problem. Will test later tonight I hope.
Just removing the -m fixes it

from

Code: Select all

logkeys -s -m --us-keymap --no-func-keys -o /var/log/kp/secret-keys.log
to

Code: Select all

logkeys -s --us-keymap --no-func-keys -o /var/log/kp/secret-keys.log

Posted: Wed 02 Nov 2016, 23:39
by Geoffrey
Here's a script that works with nilsonmorales pklogger-0.3.pet, it will put a gtkdialog text edit in the tray.

The keylogger runs on running the script and stops when the tray app is exited, right click the icon for the exit menu, clicking the tray icon toggles the edit window.

You still need to configure pklogger prior to running the script to set the key map, as I mentioned the kp-map script needs the US map fixed to work.

Code: Select all

logkeys -s --us-keymap --no-func-keys -o /var/log/kp/secret-keys.log

Code: Select all

#!/bin/bash
# MyKeylog
# By Geoffrey

ps ax | grep -q '[My]Keylog' && exit 1
KEYLOG=`awk 'NR==2' < /root/Startup/.pkl`
KEYLOG=`echo "$KEYLOG" | awk -F'-o' '{print $1}'`
eval "$KEYLOG"--no-timestamps -o /var/log/kp/secret-keys.log # no timestamps
function my_keylog () {
ps ax | grep -q '[MY]KEYLOG' && kill $(ps -ef | awk '/[MY]KEYLOG/{print $2}') && exit 1
    export MYKEYLOG='
<window title="MyKeylog" icon-name="gtk-edit">
  <vbox>
    <edit file-monitor="true" auto-refresh="true" wrap-mode="3" editable="true">
    <variable>MY_KEYLOG</variable> 
    <input file>/var/log/kp/secret-keys.log</input>
    </edit>
    <hbox homogeneous="true">
    <hbox>
      <button>
        <label>Save</label>
        <input file stock="gtk-save"></input>
        <action>`echo "$MY_KEYLOG" > /var/log/kp/secret-keys.log`</action>
      </button>
    </hbox>
    </hbox>
  </vbox>
</window>'
gtkdialog -p MYKEYLOG -G 400x200"+`getcurpos | tr " " "+"`"
}
export -f my_keylog

function killkeylog () {
logkeys -k	
kill $(ps -ef | awk '/[MY]KEYLOG/{print $2}')
kill $(ps -ef | awk '/[t]ext=MyKeylog/{print $2}')
}
export -f killkeylog

function about () {
yad --title="About MyKeylog" --close-on-unfocus --geometry=200x100"+`getcurpos | tr " " "+"`" --text-align="center" --skip-taskbar --window-icon="gtk-dialog-info" \
--text="
MyKeylog
   
By Geoffrey
 
03/11/2016
 
" --no-buttons --timeout="5" 
}
export -f about

mkfifo /tmp/mykeylog >/dev/null 2>&1
exec 3<> /tmp/mykeylog

exec yad --notification --no-middle --text=$"MyKeylog" --image="gtk-edit" --command "sh -c 'my_keylog >/dev/null 2>&1'" --listen <&3 &

echo "menu:About!bash -c about!gtk-about|Exit!sh -c 'killkeylog >/dev/null 2>&1'!gtk-quit" >&3

Posted: Thu 03 Nov 2016, 03:42
by nilsonmorales
Thank you Geoffrey, i will commit your fixes and update the pklogger.

Posted: Fri 04 Nov 2016, 00:58
by april
Yes thanks Geoffrey and nilsonmorales .

Seems to work atm only when I start it . I put your script in /root/Startup so hopefully it will run forever more .(Whoops noticed thats not needed so I removed that)(No it does not seem to start automatically from ".pkl" either. I have to run kp in a terminal each time and choose to start it ) Why are these things always marred by problems?
Its pretty easy . I just want it to run automatically every time I run my computer.



It doesn't happen to RoundRobin does it? I'll just have to edit it from time to time .
Oh and i don't get an icon in the tray and no menu entry Geoffrey . Is that what you meant to happen?
Using Precise 5.7.1

Posted: Fri 04 Nov 2016, 02:40
by Geoffrey
april wrote:Yes thanks Geoffrey and nilsonmorales . I used /usr/bin/kp-map as was so perhaps he has fixed that. I use the us keyboard anyhow.

Seems to work atm . I put your script in /root/Startup so hopefully it will run forever more . I'll just have to edit it from time to time .

It doesn't happen to RoundRobin does it?
Oh and i don't get an icon in the tray
Using Precise 5.7.1
It needs a recent version of yad to work, precise has yad 0.12.4, yad 0.26.1 will work but not the --close-on-unfocus option in the about menu, not that you need it, also the stock icons gtk-about and gtk-quit aren't found in precise.

I installed precise 5.7.1 added the pklogger-0.3.pet, mustn't be fixed yet as I had to edit the kp-map script for US keyboard.

T̶h̶i̶s̶ ̶w̶i̶l̶l̶ ̶w̶o̶r̶k̶ ̶w̶i̶t̶h̶ ̶y̶a̶d̶ ̶v̶e̶r̶s̶i̶o̶n̶ ̶0̶.̶1̶2̶.̶4̶

Edit: The old precise yad 0.12.4 doesn't support some feature of newer yad code.

Posted: Fri 04 Nov 2016, 05:38
by april
Tried this on another machine but still have to start it with kp so I don't understand what your script is doing Geoffrey.

nilsonmorales I would like to edit your configuration file to suit me then have it start at boot thereafter and always run. What command can I use in /root/Start/ folder to achieve this .

I see it is option 2 and your code uses the following

Code: Select all

if [ "$r" == "2" ];then
chmod +x /root/Startup/.pkl && /root/Startup/.pkl
Xdialog --rc-file /root/.color.rc --title "keylogger" --icon '/usr/share/icons/espia.png' --msgbox "$(gettext 'keylogger Enable - 
		Log is stored in
/var/log/kp/secret-keys.log ')" 10 40 && /usr/bin/kp
   exit ## Exit Script ##
fi
If I make this a script would that start it automatically? or can you suggest a more simple way
Thanks

I have done this above and just edited out chunks of the code just to test this . It seems to be starting automatically at least and recording but I would like to get the GUI in the tray and accessible
Logging started ...

2016-11-04 15:58:09+1000 > 1<#+7>21<#+65>

Logging stopped at 2016-11-04 16:00:16+1000

Logging started ...

2016-11-04 16:01:22+1000 >
2016-11-04 16:02:54+1000 >
2016-11-04 16:02:54+1000 > I have done this above and just edited out the chunks of the code just to test this . It seems to be starting automatically at least and recording but I would like to get the GUI in the tray. and accessible
So I am guessing it will start a new file each boot this way.

OK so now I have edited it down to a 1 line script an put this in Startup

Code: Select all

#!/bin/sh
chmod +x /root/Startup/.pkl && /root/Startup/.pkl
Giving after reboot
Logging started ...

2016-11-04 15:58:09+1000 > 1<#+7>21<#+65>

Logging stopped at 2016-11-04 16:00:16+1000

Logging started ...

2016-11-04 16:01:22+1000 >
2016-11-04 16:02:54+1000 >
2016-11-04 16:02:54+1000 > I have done this above and just edited out the chunks of the code just to test this . It seems to be starting automatically at least and recording but I would like to get the GUI in the tray. and accessible
2016-11-04 16:06:13+1000 >
2016-11-04 16:06:13+1000 >
2016-11-04 16:06:25+1000 >
2016-11-04 16:06:26+1000 > So I am guessing it will start a new file each boot this way.##

Logging stopped at 2016-11-04 16:11:16+1000

Logging started ...

2016-11-04 16:12:22+1000 >
2016-11-04 16:13:09+1000 >
2016-11-04 16:13:09+1000 > OK so now I have edited it down to a 1 line script an put this in Startup
2016-11-04 16:13:41+1000 >
2016-11-04 16:14:48+1000 > Giving after reboot
2016-11-04 16:14:59+1000 >
So it is adding to the file each boot and I can easily run the clean line if I need it .

Looks like apart from input from nilsonmorales and maybe getting the tray GUI to work which is what I think you intend Geoffrey I'm getting somewhere Thanks Guys

Posted: Fri 04 Nov 2016, 06:23
by Geoffrey
april wrote:Tried this on another machine but still have to start it with kp so I don't understand what your script is doing Geoffrey.

nilsonmorales I would like to edit your configuration file to suit me then have it start at boot thereafter and always run. What command can I use in /root/Start/ folder to achieve this .

I see it is option 2 and your code uses the following

Code: Select all

if [ "$r" == "2" ];then
chmod +x /root/Startup/.pkl && /root/Startup/.pkl
Xdialog --rc-file /root/.color.rc --title "keylogger" --icon '/usr/share/icons/espia.png' --msgbox "$(gettext 'keylogger Enable - 
		Log is stored in
/var/log/kp/secret-keys.log ')" 10 40 && /usr/bin/kp
   exit ## Exit Script ##
fi
If I make this a script would that start it automatically? or can you suggest a more simple way
Thanks
april, nilsonmorales script places /root/Startup/.pkl, the .pkl should run the logger on startup every time by making .pkl executable.

My script doesn't need the /root/Startup/.pkl to be executable, it reads the content of this script and strips every thing after and including the "-o" then adds " --no-timestamps -o /var/log/kp/secret-keys.log ".

There is no need to have the key logger running as my script starts it and stops the logger when the tray app is closed

This makes for a better looking text that's easier to copy from without all the time stamps on every line.

Posted: Fri 04 Nov 2016, 19:44
by april
Yes but your script does not appear to run on mine. Should I remove /root/Startup/.pkl .Will that make yours start . I get nothing when I do that atm.
I have your second script in /root/Startup/ and have changed the permissions to executeable but checking running processes there is nothing started?

Posted: Fri 04 Nov 2016, 23:20
by april
nilsonmorales- Your pet as installed at present brings up your fine dialog box but takes some 4 keystrokes to get rid of . Yes ,it is still turned on then, but keystrokes are a pain and in its present form it would not last very long before I chucked it.

I would suggest to you that, having it come up as a tray applet only, on boot with the option to start that tray dialog box and an option to have it turn on at bootup ,would be the way to go . The rest of it is excellent .Thanks for the app I will follow you on github.

Posted: Sat 05 Nov 2016, 01:00
by Geoffrey
april wrote:Yes but your script does not appear to run on mine. Should I remove /root/Startup/.pkl .Will that make yours start . I get nothing when I do that atm.
I have your second script in /root/Startup/ and have changed the permissions to executeable but checking running processes there is nothing started?
Ok, It's yad, precise yad version is at fault, I can't get a functional right click menu with yad 0.12.4.

Heres a yad I compiled in precise 5.7.1, yad-0.37.0, it's the latest and afaik the last that supports gtk2.

this revised script will first kill the logger if it is running, then restarts it with the timestamp disabled


Code: Select all

#!/bin/bash
# MyKeylog

ps ax | grep -q '[My]Keylog' && exit 1
logkeys -k >/dev/null 2>&1 
KEYLOG=`awk 'NR==2' < /root/Startup/.pkl` 
KEYLOG=`echo "$KEYLOG" | awk -F'-o' '{print $1}'`
eval "$KEYLOG"--no-timestamps -o /var/log/kp/secret-keys.log
function my_keylog () {
ps ax | grep -q '[MY]KEYLOG' && kill $(ps -ef | awk '/[MY]KEYLOG/{print $2}') && exit 1
    export MYKEYLOG='
<window title="MyKeylog" icon-name="gtk-edit">
  <vbox>
    <edit file-monitor="true" auto-refresh="true" wrap-mode="3" editable="true">
    <variable>MY_KEYLOG</variable>
    <input file>/var/log/kp/secret-keys.log</input>
    </edit>
    <hbox homogeneous="true">
    <hbox>
      <button>
        <label>Save</label>
        <input file stock="gtk-save"></input>
        <action>`echo "$MY_KEYLOG" > /var/log/kp/secret-keys.log`</action>
      </button>
    </hbox>
    </hbox>
  </vbox>
</window>'
gtkdialog -p MYKEYLOG -G 400x200"+`getcurpos | tr " " "+"`"
}
export -f my_keylog

function killkeylog () {
logkeys -k   
kill $(ps -ef | awk '/[MY]KEYLOG/{print $2}')
kill $(ps -ef | awk '/[t]ext=MyKeylog/{print $2}')
}
export -f killkeylog

mkfifo /tmp/mykeylog >/dev/null 2>&1
exec 3<> /tmp/mykeylog

exec yad --notification --no-middle --text=$"MyKeylog" --image="gtk-edit" --command "sh -c 'my_keylog >/dev/null 2>&1'" --listen <&3 &

echo "menu:Exit!sh -c 'killkeylog >/dev/null 2>&1'!gtk-cancel" >&3

Posted: Sat 05 Nov 2016, 09:16
by april
OK yad is bringing up a dialog box when I run it but with the new script I still have nothing in the tray.?
Nothing running either and nothing in the log file

Posted: Sat 05 Nov 2016, 10:49
by Geoffrey
april wrote:OK yad is bringing up a dialog box when I run it but with the new script I still have nothing in the tray.?
Nothing running either and nothing in the log file
Can you post the content of your /root/Startup/.pkl file.
The yad script should work, I'm running it in a clean install of precise 5.7.1 with only the new yad and pklogger installed, it's working fine for me.

Posted: Sat 05 Nov 2016, 21:04
by april

Code: Select all

#!/bin/sh
logkeys -s  --us-keymap --no-func-keys -o /var/log/kp/secret-keys.log
I took the -m out as per your notes

testkp.sh will run the original dialog box-Im using it so its still in now . To see if yours runs I take it out.

Posted: Sun 06 Nov 2016, 01:59
by april
Can you just tell me what I should have in /root/Startup/ to run your script please Geoffrey?

BTW You can get pklogger-0.4.pet from github/pklogger or in a terminal --

Code: Select all

 wget --no-check-certificate http://repo.gentoo-es.com/PuppyLinux-repositorios/Pupjibaro/3.2.48/pklogger-0.4.pet
#v0.4 Geoffrey fix added 11032016, orange color
http://repo.gentoo-es.com/PuppyLinux-re ... er-0.4.pet

Posted: Sun 06 Nov 2016, 18:30
by april
Can you just tell me what I should have in /root/Startup/ to run your script please Geoffrey?
Your script runs without any reported error in a terminal but no GUI shows up?

Posted: Sun 06 Nov 2016, 20:18
by nilsonmorales
When we began to think about a GUI for logkeys, as a joke we thought of an application to 'spy', something for 'jealous husbands', like secretly checking who and what is writing in our computers, for that reason we didn't thought of putting anything on the system tray. Neither José nor I have experience writing code, that's why the GUI may have bugs, but for the same reason it is in GitHub in the hope that someone is able to improve the code. The application is opensource if you want to improve it, we'll be happy and satisfied for that.

Posted: Mon 07 Nov 2016, 02:32
by Geoffrey
april wrote:Can you just tell me what I should have in /root/Startup/ to run your script please Geoffrey?
Your script runs without any reported error in a terminal but no GUI shows up?
I made a pet for the gui, it has a menu entry in Utility and the tray editor has a option to enable it to run at startup.

Give it try, it works for me ok, make sure you have the new yad installed else it won't work.

Posted: Mon 07 Nov 2016, 06:43
by april
nilsonmorales wrote:When we began to think about a GUI for logkeys, as a joke we thought of an application to 'spy', something for 'jealous husbands', like secretly checking who and what is writing in our computers, for that reason we didn't thought of putting anything on the system tray. Neither José nor I have experience writing code, that's why the GUI may have bugs, but for the same reason it is in GitHub in the hope that someone is able to improve the code. The application is opensource if you want to improve it, we'll be happy and satisfied for that.
Fine I understand that . I wondered how practical that would be because it is not sustained on boot or shutdown so the user at the time would have to start it after bootup in a terminal each time so you would have to leave your machine running all the time to catch anybody.

If I get time I will see if I can get it to be persistent and update github . Maybe Geoffrey will put his script there for you.

Posted: Mon 07 Nov 2016, 06:55
by april
Geoffrey wrote:I made a pet for the gui, it has a menu entry in Utility and the tray editor has a option to enable it to run at startup.

Give it try, it works for me ok, make sure you have the new yad installed else it won't work.
OK we are progressing . I now have a menu entry for Mykeylog and it is recording keystrokes to the log file without timestamps -Thanks

No GUI or tray editor though so there must be something else I don't have running . I have the newer Yad and it seems to be running properly on test.