mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
Minor bug fix and layout adjustments
This commit is contained in:
parent
758a858785
commit
652daa616e
|
@ -33,20 +33,20 @@ def convert(inputFile):
|
||||||
fileSize = fileStat.st_size
|
fileSize = fileStat.st_size
|
||||||
|
|
||||||
if fileSize > 65280:
|
if fileSize > 65280:
|
||||||
print 'ERROR: the provided input file \'%s\' is too big for debug.exe' % inputFile
|
print "ERROR: the provided input file '%s' is too big for debug.exe" % inputFile
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
script = 'n %s\r\nr cx\r\n' % os.path.basename(inputFile.replace('.', '_'))
|
script = "n %s\nr cx\n" % os.path.basename(inputFile.replace(".", "_"))
|
||||||
script += "%x\r\nf 0100 ffff 00\r\n" % fileSize
|
script += "%x\nf 0100 ffff 00\n" % fileSize
|
||||||
scrString = ""
|
scrString = ""
|
||||||
counter = 256
|
counter = 256
|
||||||
counter2 = 0
|
counter2 = 0
|
||||||
|
|
||||||
fp = open(inputFile, 'rb')
|
fp = open(inputFile, "rb")
|
||||||
fileContent = fp.read()
|
fileContent = fp.read()
|
||||||
|
|
||||||
for fileChar in fileContent:
|
for fileChar in fileContent:
|
||||||
unsignedFileChar = struct.unpack('B', fileChar)[0]
|
unsignedFileChar = struct.unpack("B", fileChar)[0]
|
||||||
|
|
||||||
if unsignedFileChar != 0:
|
if unsignedFileChar != 0:
|
||||||
counter2 += 1
|
counter2 += 1
|
||||||
|
@ -56,49 +56,49 @@ def convert(inputFile):
|
||||||
else:
|
else:
|
||||||
scrString += " %02x" % unsignedFileChar
|
scrString += " %02x" % unsignedFileChar
|
||||||
elif scrString:
|
elif scrString:
|
||||||
script += "%s\r\n" % scrString
|
script += "%s\n" % scrString
|
||||||
scrString = ""
|
scrString = ""
|
||||||
counter2 = 0
|
counter2 = 0
|
||||||
|
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
||||||
if counter2 == 20:
|
if counter2 == 20:
|
||||||
script += "%s\r\n" % scrString
|
script += "%s\n" % scrString
|
||||||
scrString = ""
|
scrString = ""
|
||||||
counter2 = 0
|
counter2 = 0
|
||||||
|
|
||||||
script += "w\r\nq\r\n"
|
script += "w\nq\n"
|
||||||
|
|
||||||
return script
|
return script
|
||||||
|
|
||||||
def main(inputFile, outputFile):
|
def main(inputFile, outputFile):
|
||||||
if not os.path.isfile(inputFile):
|
if not os.path.isfile(inputFile):
|
||||||
print 'ERROR: the provided input file \'%s\' is not a regular file' % inputFile
|
print "ERROR: the provided input file '%s' is not a regular file" % inputFile
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
script = convert(inputFile)
|
script = convert(inputFile)
|
||||||
|
|
||||||
if outputFile:
|
if outputFile:
|
||||||
fpOut = open(outputFile, 'w')
|
fpOut = open(outputFile, "w")
|
||||||
sys.stdout = fpOut
|
sys.stdout = fpOut
|
||||||
sys.stdout.write(script)
|
sys.stdout.write(script)
|
||||||
sys.stdout.close()
|
sys.stdout.close()
|
||||||
else:
|
else:
|
||||||
print script
|
print script
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
usage = '%s -i <input file> [-o <output file>]' % sys.argv[0]
|
usage = "%s -i <input file> [-o <output file>]" % sys.argv[0]
|
||||||
parser = OptionParser(usage=usage, version='0.1')
|
parser = OptionParser(usage=usage, version="0.1")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parser.add_option('-i', dest='inputFile', help='Input binary file')
|
parser.add_option("-i", dest="inputFile", help="Input binary file")
|
||||||
|
|
||||||
parser.add_option('-o', dest='outputFile', help='Output debug.exe text file')
|
parser.add_option("-o", dest="outputFile", help="Output debug.exe text file")
|
||||||
|
|
||||||
(args, _) = parser.parse_args()
|
(args, _) = parser.parse_args()
|
||||||
|
|
||||||
if not args.inputFile:
|
if not args.inputFile:
|
||||||
parser.error('Missing the input file, -h for help')
|
parser.error("Missing the input file, -h for help")
|
||||||
|
|
||||||
except (OptionError, TypeError), e:
|
except (OptionError, TypeError), e:
|
||||||
parser.error(e)
|
parser.error(e)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user