Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b75c52f

Browse files
committed
Minor display fix (in --hex mode)
1 parent 25a5073 commit b75c52f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/techniques/blind/inference.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
6060
abortedFlag = False
6161
partialValue = u""
6262
finalValue = None
63+
retrievedLength = 0
6364
asciiTbl = getCharset(charsetType)
6465
timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED))
6566
retVal = hashDBRetrieve(expression, checkConf=True)
@@ -410,7 +411,7 @@ def blindThread():
410411
if conf.verbose in (1, 2) and not showEta:
411412
output += '_' * (min(length, conf.progressWidth) - len(output))
412413
status = ' %d/%d (%d%s)' % (count, length, round(100.0*count/length), '%')
413-
output += status if count != length else " "*len(status)
414+
output += status if count != length else " " * len(status)
414415

415416
dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(output)))
416417

@@ -527,15 +528,16 @@ def blindThread():
527528
finally:
528529
kb.prependFlag = False
529530
kb.stickyLevel = None
531+
retrievedLength = len(finalValue or "")
530532

531533
if finalValue is not None:
532534
finalValue = decodeHexValue(finalValue) if conf.hexConvert else finalValue
533535
hashDBWrite(expression, finalValue)
534536
elif partialValue:
535537
hashDBWrite(expression, "%s%s" % (PARTIAL_VALUE_MARKER, partialValue))
536538

537-
if conf.hexConvert:
538-
infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * len(finalValue or ""))
539+
if conf.hexConvert and not abortedFlag:
540+
infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * retrievedLength)
539541
dataToStdout(infoMsg)
540542
else:
541543
if conf.verbose in (1, 2) or showEta:

0 commit comments

Comments
 (0)