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

Skip to content

Commit dda979a

Browse files
committed
minor refactoring
1 parent 0a6334d commit dda979a

4 files changed

Lines changed: 3 additions & 8 deletions

File tree

lib/core/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ class REFLECTIVE_COUNTER:
7070

7171
class HASH:
7272
MYSQL = r'(?i)\A\*[0-9a-f]{40}\Z'
73-
MYSQL_OLD = r'(?i)\A(?![0-9]{16})[0-9a-f]{16}\Z'
73+
MYSQL_OLD = r'(?i)\A(?![0-9]+\Z)[0-9a-f]{16}\Z'
7474
POSTGRES = r'(?i)\Amd5[0-9a-f]{32}\Z'
7575
MSSQL = r'(?i)\A0x0100[0-9a-f]{8}[0-9a-f]{40}\Z'
7676
MSSQL_OLD = r'(?i)\A0x0100[0-9a-f]{8}[0-9a-f]{80}\Z'
7777
ORACLE = r'(?i)\As:[0-9a-f]{60}\Z'
7878
ORACLE_OLD = r'(?i)\A[01-9a-f]{16}\Z'
7979
MD5_GENERIC = r'(?i)\A[0-9a-f]{32}\Z'
8080
SHA1_GENERIC = r'(?i)\A[0-9a-f]{40}\Z'
81-
CRYPT_GENERIC = r'(?i)\A(?![0-9]{13})[./0-9A-Za-z]{13}\Z'
81+
CRYPT_GENERIC = r'(?i)\A(?!\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z)(?![0-9]+\Z)[./0-9A-Za-z]{13}\Z'
8282
WORDPRESS = r'(?i)\A\$P\$[./0-9A-Za-z]{31}\Z'
8383

8484
# Reference: http://www.zytrax.com/tech/web/mobile_ids.html

lib/core/option.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
from lib.core.settings import DEFAULT_PAGE_ENCODING
8686
from lib.core.settings import DEFAULT_TOR_HTTP_PORTS
8787
from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
88-
from lib.core.settings import GENERAL_IP_ADDRESS_REGEX
8988
from lib.core.settings import IS_WIN
9089
from lib.core.settings import PLATFORM
9190
from lib.core.settings import PYVERSION

lib/core/settings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@
253253
# Regular expression used for parsing empty fields in tested form data
254254
EMPTY_FORM_FIELDS_REGEX = r'(?P<result>[^=]+=(&|\Z))'
255255

256-
# Regular expression for general IP address matching
257-
GENERAL_IP_ADDRESS_REGEX = r'\A\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z'
258-
259256
# Regular expression for soap message recognition
260257
SOAP_REGEX = r"\A(<\?xml[^>]+>)?\s*<soap.+</soap"
261258

lib/utils/hash.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
from lib.core.settings import COMMON_PASSWORD_SUFFIXES
6161
from lib.core.settings import COMMON_USER_COLUMNS
6262
from lib.core.settings import DUMMY_USER_PREFIX
63-
from lib.core.settings import GENERAL_IP_ADDRESS_REGEX
6463
from lib.core.settings import HASH_MOD_ITEM_DISPLAY
6564
from lib.core.settings import HASH_RECOGNITION_QUIT_THRESHOLD
6665
from lib.core.settings import IS_WIN
@@ -402,7 +401,7 @@ def hashRecognition(value):
402401
elif isMySQL and regex == HASH.ORACLE_OLD:
403402
continue
404403
elif regex == HASH.CRYPT_GENERIC:
405-
if any((getCompiledRegex(GENERAL_IP_ADDRESS_REGEX).match(value), value.lower() == value, value.upper() == value, value.isdigit())):
404+
if any((value.lower() == value, value.upper() == value)):
406405
continue
407406
elif getCompiledRegex(regex).match(value):
408407
retVal = regex

0 commit comments

Comments
 (0)