diff options
author | Thomas Fleischmann <thomas.fleischmann.08@googlemail.com> | 2015-02-19 02:46:48 -0800 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2016-01-21 18:35:13 +0100 |
commit | f634c7420a9345987001c0e965c4d79057197f6f (patch) | |
tree | bf7adffad4682c0c040688697275b794de657cf3 | |
parent | 73928b158a1190c55b22418faf5cd3f3204108d1 (diff) |
mausezahn: Fix reading of hex payload file
Using the option -F with mausezahn, to read input out of a hexfile,
results in corrupt data transmitted (first byte will always be 0).
Properly parse "payload="/p=" at the start of the file by the same
method as used in layer3.c and layer4.c
Closes #153
Reference: http://permalink.gmane.org/gmane.linux.network.netsniff-ng/600
Signed-off-by: Thomas Fleischmann <thomas.fleischmann.08@googlemail.com>
Reported-by: Thomas De Schampheleire
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | staging/layer1.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/staging/layer1.c b/staging/layer1.c index a1ca417..bf00a52 100644 --- a/staging/layer1.c +++ b/staging/layer1.c @@ -58,7 +58,8 @@ int send_eth(void) j=0; char err_buf[LIBNET_ERRBUF_SIZE], - message[MAX_PAYLOAD_SIZE*3]; + message[MAX_PAYLOAD_SIZE*3], + argval[MAX_PAYLOAD_SIZE*2]; u_int8_t bytestring[MAX_PAYLOAD_SIZE]; libnet_ptag_t t; @@ -100,7 +101,10 @@ int send_eth(void) // Create a temporal, local bytestring: // for (i=0; i<MAX_PAYLOAD_SIZE; i++) bytestring[i]=0x00; - bytestring_s = str2hex (tx.arg_string, bytestring, MAX_PAYLOAD_SIZE); + if ( (getarg(tx.arg_string,"payload", argval)==1) || (getarg(tx.arg_string,"p", argval)==1)) + { + bytestring_s = str2hex (argval, bytestring, MAX_PAYLOAD_SIZE); + } // Set the flags to shorten subsequent decisions: src = strlen(tx.eth_src_txt); |