marcosjp 0 Light Poster

Hi there!

As a College assignment I must write a network scanner that will create a report containing all open ports and some network statistics etc.
The code is almost done.. however, as I need to test it to see if its ok, I ve been scanning my own machine to check and etc... most of the times I run the scanner all ports are closed. Sometimes there are some ports open, sometimes other different ports are - I dont understand why and how it happens.

I am using connect(sockTarget,(struct sockaddr *)&target, sizeof(target)) to test each port, where target is defined by target.sin_port = htons(port_number);

Also, running sudo iptables -L I get:

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Please help! :o)