diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-16 13:37:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-16 13:37:59 +0000 |
commit | 7b72fc12000c878e11d5f0b245f83c0d71b29f58 (patch) | |
tree | ae60975a107756cb3b7b6dd17e8f0d41427daed6 /networking | |
parent | 53a0e971960a520bd859b8aac6dbebec2045115f (diff) | |
download | busybox-w32-7b72fc12000c878e11d5f0b245f83c0d71b29f58.tar.gz busybox-w32-7b72fc12000c878e11d5f0b245f83c0d71b29f58.tar.bz2 busybox-w32-7b72fc12000c878e11d5f0b245f83c0d71b29f58.zip |
pscan: new applet (portscanner). ~1350 bytes. By Tito <farmatito@tiscali.it>
wget: lift 256 chars limitation on terminal width
Diffstat (limited to 'networking')
-rw-r--r-- | networking/Config.in | 6 | ||||
-rw-r--r-- | networking/Kbuild | 1 | ||||
-rw-r--r-- | networking/ping.c | 7 | ||||
-rw-r--r-- | networking/wget.c | 9 |
4 files changed, 19 insertions, 4 deletions
diff --git a/networking/Config.in b/networking/Config.in index 5ccc4836a..efa6aaec2 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -527,6 +527,12 @@ config PING6 | |||
527 | help | 527 | help |
528 | This will give you a ping that can talk IPv6. | 528 | This will give you a ping that can talk IPv6. |
529 | 529 | ||
530 | config PSCAN | ||
531 | bool "pscan" | ||
532 | default n | ||
533 | help | ||
534 | Simple network port scanner. | ||
535 | |||
530 | config FEATURE_FANCY_PING | 536 | config FEATURE_FANCY_PING |
531 | bool "Enable fancy ping output" | 537 | bool "Enable fancy ping output" |
532 | default y | 538 | default y |
diff --git a/networking/Kbuild b/networking/Kbuild index 13b4452bd..0f4ab7ba6 100644 --- a/networking/Kbuild +++ b/networking/Kbuild | |||
@@ -25,6 +25,7 @@ lib-$(CONFIG_NETSTAT) += netstat.o | |||
25 | lib-$(CONFIG_NSLOOKUP) += nslookup.o | 25 | lib-$(CONFIG_NSLOOKUP) += nslookup.o |
26 | lib-$(CONFIG_PING) += ping.o | 26 | lib-$(CONFIG_PING) += ping.o |
27 | lib-$(CONFIG_PING6) += ping.o | 27 | lib-$(CONFIG_PING6) += ping.o |
28 | lib-$(CONFIG_PSCAN) += pscan.o | ||
28 | lib-$(CONFIG_ROUTE) += route.o | 29 | lib-$(CONFIG_ROUTE) += route.o |
29 | lib-$(CONFIG_TELNET) += telnet.o | 30 | lib-$(CONFIG_TELNET) += telnet.o |
30 | lib-$(CONFIG_TELNETD) += telnetd.o | 31 | lib-$(CONFIG_TELNETD) += telnetd.o |
diff --git a/networking/ping.c b/networking/ping.c index 6b5045eb3..e94b7914f 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -341,7 +341,12 @@ static void sendping4(int junk ATTRIBUTE_UNUSED) | |||
341 | pkt->icmp_cksum = 0; | 341 | pkt->icmp_cksum = 0; |
342 | pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ | 342 | pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ |
343 | pkt->icmp_id = myid; | 343 | pkt->icmp_id = myid; |
344 | |||
345 | // I can't fucking believe someone thought it's okay to do it like this... | ||
346 | // where's hton? Where is a provision for different word size, structure padding, etc?? | ||
347 | // FIXME! | ||
344 | gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); | 348 | gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); |
349 | |||
345 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, datalen + ICMP_MINLEN); | 350 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, datalen + ICMP_MINLEN); |
346 | 351 | ||
347 | sendping_tail(sendping4, pkt, datalen + ICMP_MINLEN); | 352 | sendping_tail(sendping4, pkt, datalen + ICMP_MINLEN); |
@@ -356,6 +361,8 @@ static void sendping6(int junk ATTRIBUTE_UNUSED) | |||
356 | pkt->icmp6_cksum = 0; | 361 | pkt->icmp6_cksum = 0; |
357 | pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ | 362 | pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ |
358 | pkt->icmp6_id = myid; | 363 | pkt->icmp6_id = myid; |
364 | |||
365 | // FIXME! | ||
359 | gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL); | 366 | gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL); |
360 | 367 | ||
361 | sendping_tail(sendping6, pkt, datalen + sizeof(struct icmp6_hdr)); | 368 | sendping_tail(sendping6, pkt, datalen + sizeof(struct icmp6_hdr)); |
diff --git a/networking/wget.c b/networking/wget.c index 2c060d77d..fe669bbdd 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -693,16 +693,15 @@ progressmeter(int flag) | |||
693 | struct timeval now, td, tvwait; | 693 | struct timeval now, td, tvwait; |
694 | off_t abbrevsize; | 694 | off_t abbrevsize; |
695 | int elapsed, ratio, barlength, i; | 695 | int elapsed, ratio, barlength, i; |
696 | char buf[256]; | ||
697 | 696 | ||
698 | if (flag == -1) { /* first call to progressmeter */ | 697 | if (flag == -1) { /* first call to progressmeter */ |
699 | gettimeofday(&start, (struct timezone *) 0); | 698 | gettimeofday(&start, NULL); |
700 | lastupdate = start; | 699 | lastupdate = start; |
701 | lastsize = 0; | 700 | lastsize = 0; |
702 | totalsize = content_len + beg_range; /* as content_len changes.. */ | 701 | totalsize = content_len + beg_range; /* as content_len changes.. */ |
703 | } | 702 | } |
704 | 703 | ||
705 | gettimeofday(&now, (struct timezone *) 0); | 704 | gettimeofday(&now, NULL); |
706 | ratio = 100; | 705 | ratio = 100; |
707 | if (totalsize != 0 && !chunked) { | 706 | if (totalsize != 0 && !chunked) { |
708 | /* long long helps to have working ETA even if !LFS */ | 707 | /* long long helps to have working ETA even if !LFS */ |
@@ -713,7 +712,9 @@ progressmeter(int flag) | |||
713 | fprintf(stderr, "\r%-20.20s%4d%% ", curfile, ratio); | 712 | fprintf(stderr, "\r%-20.20s%4d%% ", curfile, ratio); |
714 | 713 | ||
715 | barlength = getttywidth() - 51; | 714 | barlength = getttywidth() - 51; |
716 | if (barlength > 0 && barlength < sizeof(buf)) { | 715 | if (barlength > 0) { |
716 | /* god bless gcc for variable arrays :) */ | ||
717 | char buf[barlength+1]; | ||
717 | i = barlength * ratio / 100; | 718 | i = barlength * ratio / 100; |
718 | memset(buf, '*', i); | 719 | memset(buf, '*', i); |
719 | memset(buf + i, ' ', barlength - i); | 720 | memset(buf + i, ' ', barlength - i); |