Difference between revisions of "Checking ports with netcat"

From thelinuxwiki
Jump to: navigation, search
 
(3 intermediate revisions by one user not shown)
Line 3: Line 3:
 
== checking tcp ports ==
 
== checking tcp ports ==
  
~% '''nc -vz 192.168.1.1 80'''
+
~% '''nc -vz 192.168.1.1 80'''
  
 
examplehostname [192.168.1.1] 80 (http) open
 
examplehostname [192.168.1.1] 80 (http) open
  
~% '''nc -vz 192.168.1.1 80'''
+
~% '''nc -vz 192.168.1.1 80'''
  
 
examplehostname [192.168.1.1] 80 (http) : Connection refused
 
examplehostname [192.168.1.1] 80 (http) : Connection refused
~                                                              
+
~
  
 
== checking udp ports ==
 
== checking udp ports ==
  
~% '''nc -vzu 192.168.1.1 53'''
+
~% '''nc -vzu 192.168.1.1 53'''
  
 
examplehostname [192.168.1.1] 53 (domain) open
 
examplehostname [192.168.1.1] 53 (domain) open
  
~% '''nc -vzu 192.168.1.1 54'''
+
~% '''nc -vzu 192.168.1.1 54'''
  
 
examplehostname [192.168.1.1] 54 (?) : Connection refused
 
examplehostname [192.168.1.1] 54 (?) : Connection refused
 +
 
== portscan ==
 
== portscan ==
  
  for i in {1..1024}; do nc -vz -w 1 192.168.1.1 $i; done
+
  # for i in {1..1024}; do nc -vz -w 1 192.168.1.1 $i; done
  
 
[[category:network]]
 
[[category:network]]

Latest revision as of 15:44, 12 December 2014


checking tcp ports

~% nc -vz 192.168.1.1 80

examplehostname [192.168.1.1] 80 (http) open

~% nc -vz 192.168.1.1 80

examplehostname [192.168.1.1] 80 (http) : Connection refused ~

checking udp ports

~% nc -vzu 192.168.1.1 53

examplehostname [192.168.1.1] 53 (domain) open

~% nc -vzu 192.168.1.1 54

examplehostname [192.168.1.1] 54 (?) : Connection refused

portscan

# for i in {1..1024}; do nc -vz -w 1 192.168.1.1 $i; done