UDP is connectionless, so I can't expect a response packet, necessarily. If the port is closed, I might get an ICMP error message, but if the firewall could silently drop the ICMP packet How could I know if the UDP port is opened or closed is there another way to scan UDP port.
1 Answer
Nmap tool has the -sU
flag to scan UDP ports.
e.g :
# nmap -sU 192.168.0.39
Starting Nmap 5.21 ( http://nmap.org ) at 2014-08-23 19:02 CEST
Nmap scan report for 192.168.0.39
Host is up (0.00017s latency).
Not shown: 999 open|filtered ports
PORT STATE SERVICE
137/udp open netbios-ns
MAC Address: xx:xx:xx:xx:xx:xx (Unknown)
Nmap done: 1 IP address (1 host up) scanned in 19.88 seconds
-
seems good, but how can I use it in my java code, and retrieve list of open ports ?– dana.baAug 23, 2014 at 19:09
-
You were not talking about any Java code in your initial question ! However Java is able to run external programs rgagnon.com/javadetails/java-0014.html Search for "java run external program" within Google, and post on stackoverflow if you have programming problems Aug 23, 2014 at 19:13