X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/df1e29bb402ca6dfa8810c8a8cd1b90cac60ce36..18d4eec685bba58f60c19cd7ad6fdf60000e73ba:/tools/findbits.py diff --git a/tools/findbits.py b/tools/findbits.py index 442d2810..d5516e59 100755 --- a/tools/findbits.py +++ b/tools/findbits.py @@ -22,7 +22,6 @@ import sys import os -import string # invert binary string def invert(data): @@ -30,7 +29,7 @@ def invert(data): # do the actual search def search(target,data): - location= string.find(data,target) + location = data.find(target) if location >= 0: print '*** Match at bit %d:' % location, print '%s<%s>%s' % (data[:location],target,data[location+len(target):]) @@ -43,10 +42,7 @@ def binstring(number): # reverse string order def stringreverse(data): - out= '' - for x in range(len(data) -1,-1,-1): - out += data[x] - return out + return data[::-1] # match forward, backward and inverted def domatch(number,binary): @@ -88,11 +84,11 @@ def main(): 16:'HEX', } - for base in 2,8,10,16: + for base, base_name in sorted(bases.iteritems()): try: number= int(sys.argv[1],base) print - print 'Trying', bases[base] + print 'Trying', base_name # do BINARY as specified to preserve leading zeros if base == 2: domatch(sys.argv[1],sys.argv[2])