손지언

d

...@@ -12,11 +12,13 @@ unsigned int (* sys_write_orig)(int fd, char *byf, size_t count); ...@@ -12,11 +12,13 @@ unsigned int (* sys_write_orig)(int fd, char *byf, size_t count);
12 12
13 //sys_write_orig() 호출 전 pBuF의 내용 수정 13 //sys_write_orig() 호출 전 pBuF의 내용 수정
14 unsigned int sys_write_hooked(int nFD, char *pBuf, size_t nCnt){ 14 unsigned int sys_write_hooked(int nFD, char *pBuf, size_t nCnt){
15 - printk("hooker 호출!\n"); 15 + if(nFD == 1){
16 - if(current->comm == "hello_world" && nFD == 1){ 16 + printk("current process: %s\n",current->comm);
17 + if(current->comm == "hello_world"){
17 printk("hello world 호출\n"); 18 printk("hello world 호출\n");
18 memset(pBuf, 0, nCnt); 19 memset(pBuf, 0, nCnt);
19 strcpy(pBuf, "Hacked!!!\n"); 20 strcpy(pBuf, "Hacked!!!\n");
21 + }
20 return sys_write_orig(nFD,pBuf, nCnt); 22 return sys_write_orig(nFD,pBuf, nCnt);
21 } 23 }
22 else{ 24 else{
......
...@@ -30,4 +30,4 @@ __attribute__((section(".modinfo"))) = ...@@ -30,4 +30,4 @@ __attribute__((section(".modinfo"))) =
30 "depends="; 30 "depends=";
31 31
32 32
33 -MODULE_INFO(srcversion, "60CA43AA8E3D9473F7FCAB6"); 33 +MODULE_INFO(srcversion, "A0F99FC71D5DD93F3F8D53C");
......