|
99 | 99 | from lib.core.settings import ISSUES_PAGE |
100 | 100 | from lib.core.settings import IS_WIN |
101 | 101 | from lib.core.settings import LARGE_OUTPUT_THRESHOLD |
| 102 | +from lib.core.settings import MIN_ENCODED_LEN_CHECK |
102 | 103 | from lib.core.settings import MIN_TIME_RESPONSES |
103 | 104 | from lib.core.settings import ML |
104 | 105 | from lib.core.settings import NULL |
@@ -570,7 +571,7 @@ def paramToDict(place, parameters=None): |
570 | 571 | for encoding in ("hex", "base64"): |
571 | 572 | try: |
572 | 573 | decoded = value.decode(encoding) |
573 | | - if all(_ in string.printable for _ in decoded): |
| 574 | + if len(decoded) > MIN_ENCODED_LEN_CHECK and all(_ in string.printable for _ in decoded): |
574 | 575 | warnMsg = "provided parameter '%s' " % parameter |
575 | 576 | warnMsg += "seems to be '%s' encoded" % encoding |
576 | 577 | logger.warn(warnMsg) |
@@ -768,13 +769,6 @@ def dataToOutFile(filename, data): |
768 | 769 |
|
769 | 770 | return retVal |
770 | 771 |
|
771 | | -def strToHex(value): |
772 | | - """ |
773 | | - Converts string value to it's hexadecimal representation |
774 | | - """ |
775 | | - |
776 | | - return (value if not isinstance(value, unicode) else value.encode(UNICODE_ENCODING)).encode("hex").upper() |
777 | | - |
778 | 772 | def readInput(message, default=None, checkBatch=True): |
779 | 773 | """ |
780 | 774 | Reads input from terminal |
@@ -1313,20 +1307,6 @@ def getCharset(charsetType=None): |
1313 | 1307 |
|
1314 | 1308 | return asciiTbl |
1315 | 1309 |
|
1316 | | -def searchEnvPath(filename): |
1317 | | - retVal = None |
1318 | | - path = os.environ.get("PATH", "") |
1319 | | - paths = path.split(";") if IS_WIN else path.split(":") |
1320 | | - |
1321 | | - for _ in paths: |
1322 | | - _ = _.replace(";", "") |
1323 | | - retVal = os.path.exists(os.path.normpath(os.path.join(_, filename))) |
1324 | | - |
1325 | | - if retVal: |
1326 | | - break |
1327 | | - |
1328 | | - return retVal |
1329 | | - |
1330 | 1310 | def directoryPath(filepath): |
1331 | 1311 | """ |
1332 | 1312 | Returns directory path for a given filepath |
@@ -1434,13 +1414,6 @@ def showStaticWords(firstPage, secondPage): |
1434 | 1414 |
|
1435 | 1415 | logger.info(infoMsg) |
1436 | 1416 |
|
1437 | | -def isWindowsPath(filepath): |
1438 | | - """ |
1439 | | - Returns True if given filepath is in Windows format |
1440 | | - """ |
1441 | | - |
1442 | | - return re.search("\A[\w]\:\\\\", filepath) is not None |
1443 | | - |
1444 | 1417 | def isWindowsDriveLetterPath(filepath): |
1445 | 1418 | """ |
1446 | 1419 | Returns True if given filepath starts with a Windows drive letter |
@@ -1470,18 +1443,6 @@ def ntToPosixSlashes(filepath): |
1470 | 1443 |
|
1471 | 1444 | return filepath.replace('\\', '/') |
1472 | 1445 |
|
1473 | | -def isBase64EncodedString(subject): |
1474 | | - """ |
1475 | | - Checks if the provided string is Base64 encoded |
1476 | | -
|
1477 | | - >>> isBase64EncodedString('dGVzdA==') |
1478 | | - True |
1479 | | - >>> isBase64EncodedString('123456') |
1480 | | - False |
1481 | | - """ |
1482 | | - |
1483 | | - return re.match(r"\A(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z", subject) is not None |
1484 | | - |
1485 | 1446 | def isHexEncodedString(subject): |
1486 | 1447 | """ |
1487 | 1448 | Checks if the provided string is hex encoded |
@@ -2485,20 +2446,6 @@ def showHttpErrorCodes(): |
2485 | 2446 | for code, count in kb.httpErrorCodes.items()) |
2486 | 2447 | logger.warn(warnMsg) |
2487 | 2448 |
|
2488 | | -def getComparePageRatio(firstPage, secondPage, filtered=False): |
2489 | | - """ |
2490 | | - Returns comparison ratio between two given pages |
2491 | | - """ |
2492 | | - |
2493 | | - if filtered: |
2494 | | - (firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage)) |
2495 | | - |
2496 | | - seqMatcher = getCurrentThreadData().seqMatcher |
2497 | | - seqMatcher.set_seq1(firstPage) |
2498 | | - seqMatcher.set_seq2(secondPage) |
2499 | | - |
2500 | | - return seqMatcher.quick_ratio() |
2501 | | - |
2502 | 2449 | def openFile(filename, mode='r'): |
2503 | 2450 | """ |
2504 | 2451 | Returns file handle of a given filename |
@@ -2752,16 +2699,6 @@ def unsafeSQLIdentificatorNaming(name): |
2752 | 2699 |
|
2753 | 2700 | return retVal |
2754 | 2701 |
|
2755 | | -def isBinaryData(value): |
2756 | | - """ |
2757 | | - Tests given value for binary content |
2758 | | - """ |
2759 | | - |
2760 | | - retVal = False |
2761 | | - if isinstance(value, basestring): |
2762 | | - retVal = reduce(lambda x, y: x or not (y in string.printable or ord(y) > 255), value, False) |
2763 | | - return retVal |
2764 | | - |
2765 | 2702 | def isNoneValue(value): |
2766 | 2703 | """ |
2767 | 2704 | Returns whether the value is unusable (None or '') |
|
0 commit comments