Skip to content

Instantly share code, notes, and snippets.

@ahussam
Last active September 24, 2016 16:50
Show Gist options
  • Save ahussam/38f2b0eac1d6ac0f0f92 to your computer and use it in GitHub Desktop.
Save ahussam/38f2b0eac1d6ac0f0f92 to your computer and use it in GitHub Desktop.
Simple tool in python write file as hex
#!/usr/bin/python
print" _/_/_/_/ _/ _/ _/_/ _/ _/ "
print" _/ _/ _/_/ _/ _/ _/ _/ _/_/ _/ _/ "
print" _/_/_/ _/ _/ _/_/_/_/ _/ _/_/_/_/ _/_/_/_/ _/_/ "
print" _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ "
print"_/ _/ _/ _/_/_/ _/_/_/_/ _/ _/ _/_/_/ _/ _/ "
print""
print""
print""
print"Abdullah Hussam (@Abdulahhusam)"
print""
print""
print""
import sys,getopt
filename = None
blocksize = 1024
opts,args = getopt.getopt(sys.argv[1:],'f:b:')
for o,a in opts:
if o == '-f':
filename = a
if o == '-b':
blocksize = a
offset = 0
with open(filename,"rb") as f:
block = f.read(blocksize)
str = ""
for ch in block:
str += hex(ord(ch))+" "
print "here :"
print str
@ahussam
Copy link
Author

ahussam commented Aug 25, 2016

cqirhyawcaeqrm2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment