netsniff-ng / netsniff-ng

A Swiss army knife for your daily Linux network plumbing.
http://netsniff-ng.org
Other
1.2k stars 237 forks source link

mausezahn: Restore handling of raw hex string passed in on command line #191

Closed ngrauel closed 6 years ago

ngrauel commented 6 years ago

Originally all hex strings (whether they were given on the command line or in a file) were handled by a call to str2hex():

bytestring_s = str2hex (tx.arg_string, bytestring, MAX_PAYLOAD_SIZE);

Commit f634c74 added code to parse out "payload=" or "p=" flags that may have been added at the start of the hex string. This code also changed the logic around this str2hex() call to only call the function and populate bytestring_s if one of these flags was found. This broke the ability to pass in a raw hex string on the command line since it fails the check and bytestring_s is never populated with the hex bytes. I've added an else condition to make the str2hex() call using the old method in cases where no "payload=" or "p=" flags are found.

tklauser commented 6 years ago

Thanks for the PR @ngrauel. The change itself LGTM. A few minor comments on the PR/commit format:

Could you please fix those? Thanks.

ngrauel commented 6 years ago

@tklauser I've updated the PR with those changes. Let me know if it looks good.

tklauser commented 6 years ago

This looks great. Thanks a lot, merged as 3f26829394ea.