ncat端口转发使用测试

ncat端口转发使用测试

https://nmap.org/dist/ncat-7.93-1.x86_64.rpm

11: 10.1.0.11 12:10.1.0.12 13:10.1.0.13

[root@11 ~]# yum -y install ncat-7.93-1.x86_64.rpm
[root@11 ~]# yum -y install iproute  telnet
#起监听端口
[root@11 ~]# ncat -l 8888        #监听8888 只能创建一个连接,加 -k 创建多个连接

[root@12 ~]# telnet 10.1.0.11 8888
Trying 10.1.0.11...
Connected to 10.1.0.11.
Escape character is '^]'.

[root@13 ~]# telnet 10.1.0.11 8888
Trying 10.1.0.11...
telnet: connect to address 10.1.0.11: Connection refused  

#起监听端口,可以多个连接
[root@11 ~]#ncat -lk 8888 &    #放后台,监听多个连接,B、C都可以连通

[root@12 ~]# ncat 10.1.0.11 8888   #连接远程服务器A,这与telnet相似,也可以实现与11通信
hello

[root@13 ~]# telnet 10.1.0.11 8888
Trying 10.1.0.11...
Connected to 10.1.0.11.
Escape character is '^]'.
qq

#将 nc 作为代理 
[root@12 ~]# ncat -l 8888  #有先后顺序
[root@11 ~]# ncat -l 8888 | ncat 10.1.0.12  8888
[root@13 ~]# telnet 10.1.0.11 8888
qq   #  12能够收到消息,但是发的消息只有中转的主机收到,无法转发给13

#将 nc 作为代理  双向
[root@12 ~]# ncat -l 8888
[root@11 ~]# ncat -l 8888 0<2way | ncat 10.1.0.12  8888 1>2way  # 先执行  mkfifo 2way,未知
[root@13 ~]# ncat 10.1.0.11 8888
11   #12能收到,telent这里中断,原因暂时不知

#使用 nc 传输文件
[root@11 ~]# ncat -l 8888 > recive.file    #先准备接收
[root@12 ~]# ncat 10.1.0.11 8888 < /etc/passwd     #再开始发送
[root@11 ~]# ls
recive.file

#压缩传输文件
[root@11 ~]# ncat -l 8888  | tar xfvz -
[root@12 ~]# tar czf -  myfile  |ncat 10.1.0.11 8888


#通过 nc 创建后门
[root@11 ~]# ncat -l 8888 -e /bin/bash
[root@12 ~]# ncat 10.1.0.11 8888    #然后就可以操作11的服务器了
hostname 
11

#连接保持
[root@12 ~]# ncat -w 60  10.1.0.11 8888   #连接 60 秒后终止

#端口转发
[root@11 ~]# yum -y install 
[root@11 ~]# systemctl start httpd

[root@12 ~]# ncat -lk 9090 -c "ncat 10.1.0.11 80"
[root@13 ~]# curl -v 10.1.0.12:9090


#测试连接
[root@vm test]# ncat -vz 10.1.0.12 22
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Connected to 10.1.0.12:22.
Ncat: 0 bytes sent, 0 bytes received in 0.02 seconds.

·

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值