[PATCH] mini port scanner for busybox - V2
Denis Vlasenko
vda.linux at googlemail.com
Thu Jun 14 21:27:04 UTC 2007
On Thursday 14 June 2007 16:12, Tito wrote:
> > It's good that you added these comments,
> > but explanation is not clear enough (at least for me).
> >
> > Care to improve?
> > --
> > vda
> >
>
> Here a new version of the patch with improved comments. Enjoy! ;-D
>
> PS: fixed also a stupid typo in my_gettimeofday
> if (!gettimeofday(&now, NULL)) ==> if (gettimeofday(&now, NULL))
s = xsocket(lsap->sa.sa_family, SOCK_STREAM, 0);
ndelay_on(s);
t1 = my_gettimeofday();
connect(s, &lsap->sa, lsap->len);
Ok, here it can be successful, or can fail. You don't even look at return value.
It is useless or what?
These questions need to be explained in order to have understandable code.
Ok. I did a small experiment, added a few debug prints,
and changed it to start scanning from port 79.
# ./busybox pscan -p 80 195.66.192.167 2>2
Scanning 195.66.192.167 ports 1 to 80
Port Proto State Service
80 tcp open www
78 stealth, 1 closed, 1 open ports
logfile:
pscan: connect 45us: Operation now in progress
pscan: write:-1 4us
pscan: write:-1 2us
<15759 more write errors snipped>
pscan: connect 31us: Operation now in progress
pscan: write:-1 2us
<~140000 more write errors snipped>
pscan: write:1 18us
I don't like write() flood, with accompanying horde of gettimeofday calls.
Maybe this? (please see attched).
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 6504 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070614/baa8ccf0/attachment-0002.bin
More information about the busybox
mailing list