Created
April 16, 2019 08:18
-
-
Save upidea/71043acfd1474319e6bdf1474167bf7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mmap | |
| import struct | |
| print(struct.unpack('<i', b'\xa0\xcf\x6e\x44')) # 1148112800 | |
| struct.unpack('>i', b'\x95\x6b\x31\x93') # -1788137069 | |
| with open('tmp', 'rb', 0) as file, \ | |
| mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as s: | |
| pos = s.find(b'\x64\x65') | |
| if pos != -1: | |
| x=struct.unpack('cc', s[pos+2:pos+4]) | |
| print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment