Last active
September 24, 2016 16:50
-
-
Save ahussam/38f2b0eac1d6ac0f0f92 to your computer and use it in GitHub Desktop.
Simple tool in python write file as hex
This file contains 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
#!/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 | |
Author
ahussam
commented
Aug 25, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment