Proof of concept to detect files based in magic numbers.
Last active
August 29, 2015 14:07
-
-
Save matiskay/3b6fe77cf38d1cd588c8 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 binascii | |
f = open('bolivia-latest.osm.pbf', 'rb') | |
h = f.read(32) | |
print 'pbf file: ', h | |
h = f.read(32) | |
print h | |
f = open('data-peru/points.shp', 'rb') | |
h = f.read(32) | |
print 'shapefile: ', binascii.hexlify(h) | |
f = open('uruguay-latest.osm', 'rb') | |
h = f.read(32) | |
print 'osm file: ', h | |
f = open('uruguay-latest-bak.osm.bz2', 'rb') | |
h = f.read(32) | |
print 'bz2 file: ', h |
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
pbf file: | |
OSMHeaderzuvx������6 | |
N�H��a�X��w����s߶�bT��/� | |
shapefile: 0000270a00000000000000000000000000000000000000000008e172e8030000 | |
osm file: <?xml version='1.0' encoding='UT | |
bz2 file: BZh11AY&SY�ӫ�n(߀@0P������ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment