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 | |
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
-rw-r--r-- | include/applets.h | 1 | ||||
-rw-r--r-- | include/usage.h | 10 | ||||
-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 |
6 files changed, 30 insertions, 4 deletions
diff --git a/include/applets.h b/include/applets.h index e4dff119a..0f378bbeb 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -257,6 +257,7 @@ USE_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, poweroff)) | |||
257 | USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER)) | 257 | USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER)) |
258 | USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 258 | USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
259 | USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER)) | 259 | USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER)) |
260 | USE_PSCAN(APPLET(pscan, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | ||
260 | USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd)) | 261 | USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd)) |
261 | USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 262 | USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
262 | USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 263 | USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
diff --git a/include/usage.h b/include/usage.h index 1c4442e33..7e23de92d 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2676,6 +2676,16 @@ | |||
2676 | " 2990 andersen andersen R ps\n" | 2676 | " 2990 andersen andersen R ps\n" |
2677 | 2677 | ||
2678 | 2678 | ||
2679 | #define pscan_trivial_usage \ | ||
2680 | "[-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" | ||
2681 | #define pscan_full_usage \ | ||
2682 | "Scan a host, print all open ports" \ | ||
2683 | "\n\nOptions:" \ | ||
2684 | "\n -p Scan from this port (default 1)" \ | ||
2685 | "\n -P Scan up to this port (default 1024)" \ | ||
2686 | "\n -t Timeout (default 5000 ms)" \ | ||
2687 | "\n -T Minimum rtt (default 5 ms, increase for congested hosts)" \ | ||
2688 | |||
2679 | #define pwd_trivial_usage \ | 2689 | #define pwd_trivial_usage \ |
2680 | "" | 2690 | "" |
2681 | #define pwd_full_usage \ | 2691 | #define pwd_full_usage \ |
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); |