in reply to Re^8: p0fq.pl and pack
in thread p0fq.pl and pack?
You changed the data. When I said I couldn't see how "L L ..." would have worked on the PC (or any machine), you told me the response was
0x0d 0xef 0xac 0xed 0x78 0x56 0x34 0x12 ...
Now you say it's either
0x0d 0xef 0xac 0xed 0x12 0x34 0x56 0x78 ... or
0xed 0xac 0xef 0x0d 0x78 0x56 0x34 0x12 ...
both different from what you told me.
And you didn't mention anything about the server's response being different based on the server on which it runs.
The problem you have is not related to pack, it's related to not knowing how the data is saved. The structure is meaningless. How the data is serialized is not dependent on its structure in memory. You need to know how the data is serialized. There's no escaping that.
In can be in terms of number of bytes, byte orderings, etc (at which point its dead simple to write the proper pack/unpack patterns), but it doesn't have to be.
If you know the library that was used to serialize the data, you could potentially use the same library or a port of it to deserialize the data.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: p0fq.pl and pack
by macli (Beadle) on Feb 23, 2007 at 20:33 UTC | |
PowerPC: 192.168.1.1
p0f -Q /var/run/p0f.sock -0 'dst port 443 and dst host 192.168.1.1' p0f -Q /var/run/p0f.sock -0 'dst port 443 and dst host 192.168.1.2'
Here is a updated p0fq.pl script which used function DumpString to dump decmal, hex,and character of $query,$response,$magic,$type
On PC:
PC result:
PowerPC result:
| [reply] [d/l] [select] |
by ikegami (Patriarch) on Feb 23, 2007 at 22:22 UTC | |
I looked into p0f's source. It appears the format is just a memory dump of the structures you showed earlier.
In that case, Convert::Binary::C would be simpler to use instead of pack and unpack. (This falls under the "If you know the library that was used to serialize the data, you could potentially use the same library or a port of it to deserialize the data." case I mentioned earlier.) The layout of a C structure varies by system. If p0f and p0fq.pl are not both executed on the same machine, you'll need to configure your Convert::Binary::C object's ByteOrder and Alignment.
| [reply] [d/l] [select] |
by Anonymous Monk on Feb 24, 2007 at 04:42 UTC | |
| [reply] |
by macli (Beadle) on Feb 25, 2007 at 06:29 UTC | |
I tried your script, but it got:
Now the running result as:
It is getting close, the strange thing is that the pack method seems eat up the src_ip, dst_ip, from the query hex dump, you can see src_ip and dst_ip are all 0x00, I am lost again. | [reply] [d/l] [select] |
by ikegami (Patriarch) on Feb 25, 2007 at 08:41 UTC | |
by Anonymous Monk on Feb 26, 2007 at 00:58 UTC | |
| |