I'm trying to do a simple script in Python that will print hex values and increment value like this:
char = 0
char2 = 0
def doublehex():
global char,char2
for x in range(255):
char = char + 1
a = str(chr(char)).encode("hex")
for p in range(255):
char2 = char2 + 1
b = str(chr(char2)).encode("hex")
c = a+" "+b
print "testing with:%s"%(c)
doublehex()
Output:
testing with:01 01
testing with:01 02
testing with:01 03
[snip]
testing with:01 fd
testing with:01 fe
testing with:01 ff
Traceback (most recent call last):
File "test2.py", line 16, in doublehex
b = str(chr(char2)).encode("hex")
ValueError: chr() arg not in range(256)
Actually what I'm trying to do is:
01 01
01 02
[snip]
01 ff
02 01
02 02
And so on, until ff ff
. What's wrong in my script?
Also it seems I can't try:
00 01
00 02
I don't know why.