Closed gelim closed 7 years ago
Another variant not casting the Long to Int in the dissector could be to apply this transformation at client:
sapts
being what's returned by the dissector, and return value of lambda func is a more common UNIX timestamp ready to be consumed by datetime.fromtimestamp()
.
sapts_to_epoch=lambda sapts: (sapts & 0xFFFFFFFF) + 1000000000
I found the same weirdeness when started playing with those fields. In the end, figured out that the first 4 bytes were used as some way of time zone, and the remaining 4 bytes were the actual timestamp. Date is somewhat used in the server's local time zone, instead of using UTC, which is not the best decision by SAP.
Will check your changes to see if that covers the different scenarios, we need to check how that works across time zones. The best way to solve this might be maybe creating a new Scapy field that abstracts the implementation.
Actually I have several testcases on different timezone (India, Asia, US) where the first Int is always 0x01.
datetime.fromtimestamp
is properly printing time in my local timezone.
I would bet for the timezone of Walldorf, DE (UTC+1) being hardcoded :-))
Hi, while playing with
router_admin.py -l
I noticed timestamp (connected_on
,started_on
) where broken showing date like June 2121.I don't really know what format SAP use for that, but "reversed" a bit those fields to get something plausible with following modifications:
and in
router_admin.py
code, do some offseting:It's quick and dirty so you got the idea. Adding the offset should be done at the field level, but my scapy skills are a bit rusty.
Cheers,
NB: btw I changed the '\x00' by '|', more easy to read in my opinion
-- Mathieu