Recent Changes - Search:

Softwares

.

NetcatUtility

Main.NetcatUtility History

Hide minor edits - Show changes to output

November 14, 2011, at 12:11 PM by 117.192.152.141 -
Added lines 9-26:

(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :)
(:cellnr:)
[@
[centos@centos ~]$ sudo yum install nc
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* rpmforge: fr2.rpmfind.net
* updates: ftp.iitm.ac.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nc.x86_64 0:1.84-22.el6 set to be updated
--> Finished Dependency Resolution
@]
(:tableend:)
November 14, 2011, at 12:02 PM by 117.192.152.141 -
Changed lines 8-10 from:
'''INSTALL''

nc.x86_64 : Reads and writes data across network connections using TCP or UDP
to:
'''INSTALL'''

'''
nc.x86_64 : Reads and writes data across network connections using TCP or UDP'''
November 14, 2011, at 12:01 PM by 117.192.152.141 -
Added lines 1-97:
(:Google1:)
(:Googlemm:)
----

!!nc - arbitrary TCP and UDP connections and listens


'''INSTALL''

nc.x86_64 : Reads and writes data across network connections using TCP or UDP

The nc (or netcat) utility is used for just about anything under the sun involving TCP or UDP. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6. Unlike telnet(1), nc scripts nicely, and separates error messages onto standard error instead of sending them to standard output, as telnet(1) does with some.

[@
Common uses include:

· simple TCP proxies
· shell-script based HTTP clients and servers
· network daemon testing
· a SOCKS or HTTP ProxyCommand for ssh(1)
· and much, much more
@]

'''EXAMPLE''':

(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :)
(:cellnr:)
[@
[centos@centos ~]$ sudo nc -v 127.0.0.1 80

Connection to 127.0.0.1 80 port [tcp/http] succeeded!
[centos@centos ~]$
@]
(:tableend:)


'''HELP'''

(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :)
(:cellnr:)
[@
[centos@centos ~]$ nc -h
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hostname] [port[s]]
Command Summary:
-4 Use IPv4
-6 Use IPv6
-D Enable the debug socket option
-d Detach from stdin
-h This help text
-i secs Delay interval for lines sent, ports scanned
-k Keep inbound sockets open for multiple connects
-l Listen mode, for inbound connects
-n Suppress name/port resolutions
-p port Specify local port for remote connects
-r Randomize remote ports
-S Enable the TCP MD5 signature option
-s addr Local source address
-T ToS Set IP Type of Service
-C Send CRLF as line-ending
-t Answer TELNET negotiation
-U Use UNIX domain socket
-u UDP mode
-v Verbose
-w secs Timeout for connects and final net reads
-X proto Proxy protocol: "4", "5" (SOCKS) or "connect"
-x addr[:port] Specify proxy address and port
-z Zero-I/O mode [used for scanning]
Port numbers can be individual or ranges: lo-hi [inclusive]
[centos@centos ~]$
@]
(:tableend:)



'''CLIENT/SERVER MODEL'''

It is quite simple to build a very basic client/server model using nc. On one console, start nc listening on a specific port for a connection. For example:

(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :)
(:cellnr:)
$ nc -l 1234
(:tableend:)

nc is now listening on port 1234 for a connection. On a second console (or a second machine), connect to the machine and port being listened on:

(:table border=1 width=70% bgcolor=#cccc99 cellspacing=0 :)
(:cellnr:)
$ nc 127.0.0.1 1234
(:tableend:)

There should now be a connection between the ports. Anything typed at the second console will be concatenated to the first, and vice-versa. After the connection has been set up, nc does not really care which side is being used as a ‘server’ and which side is being used as a ‘client’. The connection may be terminated using an EOF (‘^D’).

----
(:Google1:)
(:Googlemm:)
Edit - History - Print - Recent Changes - Search
Page last modified on November 14, 2011, at 12:11 PM