aboutsummaryrefslogtreecommitdiff
path: root/network/hping3/patches
diff options
context:
space:
mode:
Diffstat (limited to 'network/hping3/patches')
-rw-r--r--network/hping3/patches/README1
-rw-r--r--network/hping3/patches/bytesex.diff25
-rw-r--r--network/hping3/patches/ip_id_field.diff64
-rw-r--r--network/hping3/patches/libpcap0.8.diff22
-rw-r--r--network/hping3/patches/personality.diff301
-rw-r--r--network/hping3/patches/spelling.diff24
-rw-r--r--network/hping3/patches/tcl.diff13
7 files changed, 450 insertions, 0 deletions
diff --git a/network/hping3/patches/README b/network/hping3/patches/README
new file mode 100644
index 0000000000000..34d5da43e4002
--- /dev/null
+++ b/network/hping3/patches/README
@@ -0,0 +1 @@
+Thanks to Debian for the patchset :-)
diff --git a/network/hping3/patches/bytesex.diff b/network/hping3/patches/bytesex.diff
new file mode 100644
index 0000000000000..533bc6b11317d
--- /dev/null
+++ b/network/hping3/patches/bytesex.diff
@@ -0,0 +1,25 @@
+Endianness fixes.
+
+--- hping3-3.a2.ds1.orig/bytesex.h
++++ hping3-3.a2.ds1/bytesex.h
+@@ -7,16 +7,11 @@
+ #ifndef ARS_BYTESEX_H
+ #define ARS_BYTESEX_H
+
+-#if defined(__i386__) \
+- || defined(__alpha__) \
+- || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))
++#include <endian.h>
++
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define BYTE_ORDER_LITTLE_ENDIAN
+-#elif defined(__mc68000__) \
+- || defined (__sparc__) \
+- || defined (__sparc) \
+- || defined (__PPC__) \
+- || defined (__BIG_ENDIAN__) \
+- || (defined(__mips__) && (defined(MIPSEB) || defined (__MIPSEB__)))
++#elif __BYTE_ORDER == __BIG_ENDIAN
+ #define BYTE_ORDER_BIG_ENDIAN
+ #else
+ # error can not find the byte order for this architecture, fix bytesex.h
diff --git a/network/hping3/patches/ip_id_field.diff b/network/hping3/patches/ip_id_field.diff
new file mode 100644
index 0000000000000..bcd2029fe84f6
--- /dev/null
+++ b/network/hping3/patches/ip_id_field.diff
@@ -0,0 +1,64 @@
+--- a/docs/hping2.8
++++ b/docs/hping2.8
+@@ -343,7 +343,7 @@
+ .I -N --id
+ Set ip->id field. Default id is random but if fragmentation is turned on
+ and id isn't specified it will be
+-.BR "getpid() & 0xFF" ,
++.BR "getpid() & 0xFFFF" ,
+ to implement a better solution is in TODO list.
+ .TP
+ .I -H --ipproto
+@@ -714,4 +714,4 @@
+ a solaris problem, as stated in the tcpdump-workers mailing list,
+ so the libpcap can't do nothing to handle it properly.
+ .SH SEE ALSO
+-ping(8), traceroute(8), ifconfig(8), nmap(1)
+\ No newline at end of file
++ping(8), traceroute(8), ifconfig(8), nmap(1)
+--- a/docs/hping3.8
++++ b/docs/hping3.8
+@@ -352,7 +352,7 @@
+ .I -N --id
+ Set ip->id field. Default id is random but if fragmentation is turned on
+ and id isn't specified it will be
+-.BR "getpid() & 0xFF" ,
++.BR "getpid() & 0xFFFF" ,
+ to implement a better solution is in TODO list.
+ .TP
+ .I -H --ipproto
+--- a/hping2.h
++++ b/hping2.h
+@@ -121,7 +121,7 @@
+ #define DEFAULT_ICMP_IP_IHL (IPHDR_SIZE >> 2)
+ #define DEFAULT_ICMP_IP_TOS 0
+ #define DEFAULT_ICMP_IP_TOT_LEN 0 /* computed by send_icmp_*() */
+-#define DEFAULT_ICMP_IP_ID 0 /* rand */
++#define DEFAULT_ICMP_IP_ID -1 /* rand */
+ #define DEFAULT_ICMP_CKSUM -1 /* -1 means compute the cksum */
+ #define DEFAULT_ICMP_IP_PROTOCOL 6 /* TCP */
+ #define DEFAULT_RAW_IP_PROTOCOL 6 /* TCP */
+--- a/parseoptions.c
++++ b/parseoptions.c
+@@ -463,6 +463,10 @@
+ break;
+ case OPT_ICMP_IPID:
+ icmp_ip_id = strtol(ago_optarg, NULL, 0);
++ if (icmp_ip_id < 0 || icmp_ip_id > 0xffff) {
++ fprintf(stderr, "Bad ICMP IP ID, resetting to random.\n");
++ icmp_ip_id = DEFAULT_ICMP_IP_ID;
++ }
+ break;
+ case OPT_ICMP_IPPROTO:
+ icmp_ip_protocol = strtol(ago_optarg, NULL, 0);
+--- a/sendicmp.c
++++ b/sendicmp.c
+@@ -83,7 +83,7 @@
+ icmp->type = opt_icmptype; /* echo replay or echo request */
+ icmp->code = opt_icmpcode; /* should be indifferent */
+ icmp->checksum = 0;
+- icmp->un.echo.id = getpid() & 0xffff;
++ icmp->un.echo.id = icmp_ip_id == DEFAULT_ICMP_IP_ID ? getpid() & 0xffff : icmp_ip_id;
+ icmp->un.echo.sequence = _icmp_seq;
+
+ /* data */
diff --git a/network/hping3/patches/libpcap0.8.diff b/network/hping3/patches/libpcap0.8.diff
new file mode 100644
index 0000000000000..97e9178cfd842
--- /dev/null
+++ b/network/hping3/patches/libpcap0.8.diff
@@ -0,0 +1,22 @@
+Various fixes for libpcap0.8 compilation.
+
+--- hping3-3.a2.ds1.orig/libpcap_stuff.c
++++ hping3-3.a2.ds1/libpcap_stuff.c
+@@ -17,7 +17,6 @@
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+ #include <pcap.h>
+-#include <net/bpf.h>
+
+ #include "globals.h"
+
+--- hping3-3.a2.ds1.orig/script.c
++++ hping3-3.a2.ds1/script.c
+@@ -24,7 +24,6 @@
+
+ #include <sys/ioctl.h>
+ #include <pcap.h>
+-#include <net/bpf.h>
+
+ #include "release.h"
+ #include "hping2.h"
diff --git a/network/hping3/patches/personality.diff b/network/hping3/patches/personality.diff
new file mode 100644
index 0000000000000..59c0bd7120097
--- /dev/null
+++ b/network/hping3/patches/personality.diff
@@ -0,0 +1,301 @@
+Say hping3, not hping2.
+
+--- hping3-3.a2.ds1.orig/docs/hping3.8
++++ hping3-3.a2.ds1/docs/hping3.8
+@@ -1,8 +1,8 @@
+-.TH HPING2 8 "2001 Aug 14"
++.TH HPING3 8 "2001 Aug 14"
+ .SH NAME
+-hping2 \- send (almost) arbitrary TCP/IP packets to network hosts
++hping3 \- send (almost) arbitrary TCP/IP packets to network hosts
+ .SH SYNOPSIS
+-.B hping2
++.B hping3
+ [
+ .B \-hvnqVDzZ012WrfxykQbFSRPAUXYjJBuTG
+ ] [
+@@ -116,11 +116,11 @@
+ .br
+ .ad
+ .SH DESCRIPTION
+-hping2 is a network tool able to send custom TCP/IP packets and to
+-display target replies like ping program does with ICMP replies. hping2
++hping3 is a network tool able to send custom TCP/IP packets and to
++display target replies like ping program does with ICMP replies. hping3
+ handle fragmentation, arbitrary packets body and size and can be used in
+ order to transfer files encapsulated under supported protocols. Using
+-hping2 you are able to perform at least the following stuff:
++hping3 you are able to perform at least the following stuff:
+
+ - Test firewall rules
+ - Advanced port scanning
+@@ -136,7 +136,7 @@
+ - A lot of others.
+
+ .IR "It's also a good didactic tool to learn TCP/IP" .
+-hping2 is developed and maintained by antirez@invece.org and is
++hping3 is developed and maintained by antirez@invece.org and is
+ licensed under GPL version 2. Development is open so you can send
+ me patches, suggestion and affronts without inhibitions.
+ .SH HPING SITE
+@@ -158,7 +158,7 @@
+ .I -c --count count
+ Stop after sending (and receiving)
+ .I count
+-response packets. After last packet was send hping2 wait COUNTREACHED_TIMEOUT
++response packets. After last packet was send hping3 wait COUNTREACHED_TIMEOUT
+ seconds target host replies. You are able to tune COUNTREACHED_TIMEOUT editing
+ hping2.h
+ .TP
+@@ -171,10 +171,10 @@
+ .I wait
+ to X micro seconds.
+ The default is to wait
+-one second between each packet. Using hping2 to transfer files tune this
++one second between each packet. Using hping3 to transfer files tune this
+ option is really important in order to increase transfer rate. Even using
+-hping2 to perform idle/spoofing scanning you should tune this option, see
+-.B HPING2-HOWTO
++hping3 to perform idle/spoofing scanning you should tune this option, see
++.B HPING3-HOWTO
+ for more information.
+ .TP
+ .I --fast
+@@ -195,13 +195,13 @@
+ startup time and when finished.
+ .TP
+ .I -I --interface interface name
+-By default on linux and BSD systems hping2 uses default routing interface.
++By default on linux and BSD systems hping3 uses default routing interface.
+ In other systems or when there is no default route
+-hping2 uses the first non-loopback interface.
+-However you are able to force hping2 to use the interface you need using
++hping3 uses the first non-loopback interface.
++However you are able to force hping3 to use the interface you need using
+ this option. Note: you don't need to specify the whole name, for
+ example -I et will match eth0 ethernet0 myet1 et cetera. If no interfaces
+-match hping2 will try to use lo.
++match hping3 will try to use lo.
+ .TP
+ .I -V --verbose
+ Enable verbose output. TCP replies will be shown as follows:
+@@ -211,7 +211,7 @@
+ .TP
+ .I -D --debug
+ Enable debug mode, it's useful when you experience some problem with
+-hping2. When debug mode is enabled you will get more information about
++hping3. When debug mode is enabled you will get more information about
+ .B interface detection, data link layer access, interface settings, options
+ .B parsing, fragmentation, HCMP protocol
+ and other stuff.
+@@ -223,30 +223,30 @@
+ CTRL+Z once or twice.
+ .TP
+ .I -Z --unbind
+-Unbind CTRL+Z so you will able to stop hping2.
++Unbind CTRL+Z so you will able to stop hping3.
+ .TP
+ .I --beep
+ Beep for every matching received packet (but not for ICMP errors).
+ .SH PROTOCOL SELECTION
+-Default protocol is TCP, by default hping2 will send tcp headers to target
++Default protocol is TCP, by default hping3 will send tcp headers to target
+ host's port 0 with a winsize of 64 without any tcp flag on. Often this
+ is the best way to do an 'hide ping', useful when target is behind
+ a firewall that drop ICMP. Moreover a tcp null-flag to port 0 has a good
+ probability of not being logged.
+ .TP
+ .I -0 --rawip
+-RAW IP mode, in this mode hping2 will send IP header with data
++RAW IP mode, in this mode hping3 will send IP header with data
+ appended with --signature and/or --file, see also --ipproto that
+ allows you to set the ip protocol field.
+ .TP
+ .I -1 --icmp
+-ICMP mode, by default hping2 will send ICMP echo-request, you can set
++ICMP mode, by default hping3 will send ICMP echo-request, you can set
+ other ICMP type/code using
+ .B --icmptype --icmpcode
+ options.
+ .TP
+ .I -2 --udp
+-UDP mode, by default hping2 will send udp to target host's port 0.
++UDP mode, by default hping3 will send udp to target host's port 0.
+ UDP header tunable options are the following:
+ .B --baseport, --destport, --keep.
+ .TP
+@@ -288,11 +288,11 @@
+ shows interesting details.
+ .TP
+ .I -9 --listen signature
+-HPING2 listen mode, using this option hping2 waits for packet that contain
++HPING3 listen mode, using this option hping3 waits for packet that contain
+ .I signature
+ and dump from
+ .I signature
+-end to packet's end. For example if hping2 --listen TEST reads a packet
++end to packet's end. For example if hping3 --listen TEST reads a packet
+ that contain
+ .B 234-09sdflkjs45-TESThello_world
+ it will display
+@@ -304,7 +304,7 @@
+ ensures that target will not gain your real address. However replies
+ will be sent to spoofed address, so you will can't see them. In order
+ to see how it's possible to perform spoofed/idle scanning see the
+-.BR HPING2-HOWTO .
++.BR HPING3-HOWTO .
+ .TP
+ .I --rand-source
+ This option enables the
+@@ -347,7 +347,7 @@
+ or
+ .B --bind
+ options. If in doubt try
+-.BR "" "`" "hping2 some.host.com -t 1 --traceroute" "'."
++.BR "" "`" "hping3 some.host.com -t 1 --traceroute" "'."
+ .TP
+ .I -N --id
+ Set ip->id field. Default id is random but if fragmentation is turned on
+@@ -361,11 +361,11 @@
+ .I -W --winid
+ id from Windows* systems before Win2k has different byte ordering, if this
+ option is enable
+-hping2 will properly display id replies from those Windows.
++hping3 will properly display id replies from those Windows.
+ .TP
+ .I -r --rel
+ Display id increments instead of id. See the
+-.B HPING2-HOWTO
++.B HPING3-HOWTO
+ for more information. Increments aren't computed as id[N]-id[N-1] but
+ using packet loss compensation. See relid.c for more information.
+ .TP
+@@ -445,7 +445,7 @@
+ .SH TCP/UDP RELATED OPTIONS
+ .TP
+ .I -s --baseport source port
+-hping2 uses source port in order to guess replies sequence number. It
++hping3 uses source port in order to guess replies sequence number. It
+ starts with a base source port number, and increase this number for each
+ packet sent. When packet is received sequence number can be computed as
+ .IR "replies.dest.port - base.source.port" .
+@@ -485,7 +485,7 @@
+ by target host. This can be useful when you need to analyze whether
+ TCP sequence number is predictable. Output example:
+
+-.B #hping2 win98 --seqnum -p 139 -S -i u1 -I eth0
++.B #hping3 win98 --seqnum -p 139 -S -i u1 -I eth0
+ .nf
+ HPING uaz (eth0 192.168.4.41): S set, 40 headers + 0 data bytes
+ 2361294848 +2361294848
+@@ -540,8 +540,8 @@
+ .SH COMMON OPTIONS
+ .TP
+ .I -d --data data size
+-Set packet body size. Warning, using --data 40 hping2 will not generate
+-0 byte packets but protocol_header+40 bytes. hping2 will display
++Set packet body size. Warning, using --data 40 hping3 will not generate
++0 byte packets but protocol_header+40 bytes. hping3 will display
+ packet size information as first line output, like this:
+ .B HPING www.yahoo.com (ppp0 204.71.200.67): NO FLAGS are set, 40 headers + 40 data bytes
+ .TP
+@@ -577,9 +577,9 @@
+ A to host B you may use the following:
+ .nf
+ .I [host_a]
+-.B # hping2 host_b --udp -p 53 -d 100 --sign signature --safe --file /etc/passwd
++.B # hping3 host_b --udp -p 53 -d 100 --sign signature --safe --file /etc/passwd
+ .I [host_b]
+-.B # hping2 host_a --listen signature --safe --icmp
++.B # hping3 host_a --listen signature --safe --icmp
+ .fi
+ .TP
+ .I -u --end
+@@ -587,13 +587,13 @@
+ .I --file filename
+ option, tell you when EOF has been reached. Moreover prevent that other end
+ accept more packets. Please, for more information see the
+-.BR HPING2-HOWTO .
++.BR HPING3-HOWTO .
+ .TP
+ .I -T --traceroute
+-Traceroute mode. Using this option hping2 will increase ttl for each
++Traceroute mode. Using this option hping3 will increase ttl for each
+ .B ICMP time to live 0 during transit
+ received. Try
+-.BR "hping2 host --traceroute" .
++.BR "hping3 host --traceroute" .
+ This option implies --bind and --ttl 1. You can override the ttl of 1
+ using the --ttl option. Since 2.0.0 stable it prints RTT information.
+ .TP
+@@ -601,7 +601,7 @@
+ Keep the TTL fixed in traceroute mode, so you can monitor just one hop
+ in the route. For example, to monitor how the 5th hop changes or
+ how its RTT changes you can try
+-.BR "hping2 host --traceroute --ttl 5 --tr-keep-ttl" .
++.BR "hping3 host --traceroute --ttl 5 --tr-keep-ttl" .
+ .TP
+ .I --tr-stop
+ If this option is specified hping will exit once the first packet
+--- hping3-3.a2.ds1.orig/main.c
++++ hping3-3.a2.ds1/main.c
+@@ -193,8 +193,8 @@
+ }
+
+ if (parse_options(argc, argv) == -1) {
+- printf("hping2: missing host argument\n"
+- "Try `hping2 --help' for more information.\n");
++ printf("hping3: missing host argument\n"
++ "Try `hping3 --help' for more information.\n");
+ exit(1);
+ }
+
+@@ -298,7 +298,7 @@
+ /* if we are in listemode enter in listenmain() else */
+ /* print HPING... bla bla bla and enter in wait_packet() */
+ if (opt_listenmode) {
+- fprintf(stderr, "hping2 listen mode\n");
++ fprintf(stderr, "hping3 listen mode\n");
+
+ /* memory protection */
+ if (memlockall() == -1) {
+--- hping3-3.a2.ds1.orig/parseoptions.c
++++ hping3-3.a2.ds1/parseoptions.c
+@@ -215,12 +215,12 @@
+ case AGO_UNKNOWN:
+ case AGO_REQARG:
+ case AGO_AMBIG:
+- ago_gnu_error("hping", o);
+- fprintf(stderr, "Try hping --help\n");
++ ago_gnu_error("hping3", o);
++ fprintf(stderr, "Try hping3 --help\n");
+ exit(1);
+ case AGO_ALONE:
+ if (targethost_set == 1) {
+- fprintf(stderr, "hping: you must specify only "
++ fprintf(stderr, "hping3: you must specify only "
+ "one target host at a time\n");
+ exit(1);
+ } else {
+--- hping3-3.a2.ds1.orig/usage.c
++++ hping3-3.a2.ds1/usage.c
+@@ -16,7 +16,7 @@
+ void show_usage(void)
+ {
+ printf(
+-"usage: hping host [options]\n"
++"usage: hping3 host [options]\n"
+ " -h --help show this help\n"
+ " -v --version show version\n"
+ " -c --count packet count\n"
+--- hping3-3.a2.ds1.orig/version.c
++++ hping3-3.a2.ds1/version.c
+@@ -18,7 +18,7 @@
+
+ void show_version(void)
+ {
+- printf("hping version %s (%s)\n", RELEASE_VERSION, RELEASE_DATE);
++ printf("hping3 version %s (%s)\n", RELEASE_VERSION, RELEASE_DATE);
+ #ifdef USE_TCL
+ printf("This binary is TCL scripting capable\n");
+ #else
diff --git a/network/hping3/patches/spelling.diff b/network/hping3/patches/spelling.diff
new file mode 100644
index 0000000000000..7b6c2aa1d7925
--- /dev/null
+++ b/network/hping3/patches/spelling.diff
@@ -0,0 +1,24 @@
+Various spelling fixes.
+
+--- hping3-3.a2.ds1.orig/antigetopt.c
++++ hping3-3.a2.ds1/antigetopt.c
+@@ -142,7 +142,7 @@
+ #define UNK_LONG_ERRSTRING "unrecognized option `--%s'\n"
+ #define ARG_SHORT_ERRSTRING "option requires an argument -- %c\n"
+ #define ARG_LONG_ERRSTRING "option `--%s' requires an argument\n"
+-#define AMB_ERRSTRING "option `--%s' is ambiguos\n"
++#define AMB_ERRSTRING "option `--%s' is ambiguous\n"
+ #define IERR_ERRSTRING "internal error. ago_gnu_error() called with " \
+ "a bad error code (%d)\n"
+ void ago_gnu_error(char *pname, int error)
+--- hping3-3.a2.ds1.orig/statistics.c
++++ hping3-3.a2.ds1/statistics.c
+@@ -30,7 +30,7 @@
+ lossrate = 100;
+
+ fprintf(stderr, "\n--- %s hping statistic ---\n", targetname);
+- fprintf(stderr, "%d packets tramitted, %d packets received, "
++ fprintf(stderr, "%d packets transmitted, %d packets received, "
+ "%d%% packet loss\n", sent_pkt, recv_pkt, lossrate);
+ if (out_of_sequence_pkt)
+ fprintf(stderr, "%d out of sequence packets received\n",
diff --git a/network/hping3/patches/tcl.diff b/network/hping3/patches/tcl.diff
new file mode 100644
index 0000000000000..5e2de0cfd76c7
--- /dev/null
+++ b/network/hping3/patches/tcl.diff
@@ -0,0 +1,13 @@
+Harcode libtcl version to be that of the default tclsh.
+
+--- a/configure
++++ b/configure
+@@ -98,7 +98,7 @@
+ fi
+ if [ -n $USE_TCL ]
+ then
+- LIBPOSTFIX=`ls -1 /usr/local/lib/ /usr/lib | grep 'libtcl[0-9]' | grep so | sed -e 's/\.so.*//g' -e 's/libtcl//g' | sort -r | head -1`
++ LIBPOSTFIX=`echo puts \\$tcl_version | $TCLSH -`
+ TCL_LIB="-ltcl${LIBPOSTFIX} -lm -lpthread"
+ fi
+