jm33-m0 / SSH-Harvester

Harvest passwords automatically from OpenSSH server
GNU General Public License v3.0
342 stars 39 forks source link

ssh_harvester函数执行结束时为什么不调用ptrace(PTRACE_DETACH, pid) #1

Closed 10ca1h0st closed 1 year ago

10ca1h0st commented 1 year ago

请问,在ssh_harvester函数中,在执行到这段代码时

https://github.com/jm33-m0/SSH-Harvester/blob/9ca291bb642aa9356eb246112f38606c934176a3/ssh_harvester.c#L245-L260

如果条件语句为false,代表再次执行到了之前设置的int3断点处,并且打印了相关提示信息(puts("[*] Added breakpoint back")),之后不是应该重新获取密码的值吗? 为什么之后直接调用了pthread_exit(NULL)退出了ssh_harvester函数,并且不调用ptrace(PTRACE_DETACH, pid)结束对这个ssh子进程的追踪

jm33-m0 commented 1 year ago

已知问题,请看emp3r0r里的实现

jm33-m0 commented 1 year ago

简单来说,这里本来应该是loop,注释里也提到了这一点。这个C版本仅作为demo发布,以后的改进和功能添加主要以Go版本为准。

ssh_harvester函数执行结束时为什么不调用ptrace(PTRACE_DETACH, pid)

因为它还要考虑用户输错密码重新输入的情况,参见上文

jm33-m0 commented 1 year ago

For what it's worth, I have fixed this bug

https://github.com/jm33-m0/SSH-Harvester/assets/10167884/f22835f3-7281-4c31-829f-a2aee40f1cf9