2022-02-05 19:00:25 -05:00
|
|
|
#include <stdio.h>
|
2022-02-06 14:15:57 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <unistd.h>
|
2022-02-05 19:00:25 -05:00
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]){
|
|
|
|
|
printf("Hello world from execve hijacker\n");
|
|
|
|
|
for(int ii=0; ii<argc; ii++){
|
|
|
|
|
printf("Argument %i is %s\n", ii, argv[ii]);
|
|
|
|
|
}
|
2022-02-06 14:15:57 -05:00
|
|
|
|
|
|
|
|
int fd = open("/tmp/testcreated", O_RDWR | O_CREAT | O_TRUNC, 0666);
|
|
|
|
|
|
|
|
|
|
int ii = 0;
|
|
|
|
|
while(*(argv[0]+ii)!='\0'){
|
|
|
|
|
write(fd, argv[0]+ii, 1);
|
|
|
|
|
ii++;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-05 19:00:25 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|