Skip to content

Commit d09441e

Browse files
committed
feat: reduce retrieval keywords in encrypt logic mcp to improve the result of fetch_encryption_logic, v2025.9
1 parent c2e3561 commit d09441e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

modules/mcp/mcp_data_handler.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,13 @@ async def detect_validation_mechanisms():
670670
return JSONResponse(content=validation_info)
671671
except Exception as e:
672672
return JSONResponse(content={"error": str(e)})
673+
674+
##################################################################
675+
# Hashing Logic Detection Endpoint
676+
##################################################################
677+
# @app.get("/fetch_hashing_logic")
678+
# async def fetch_hashing_logic():
679+
673680

674681
##################################################################
675682
# Encryption Logic Detection Endpoint
@@ -682,7 +689,6 @@ async def fetch_encryption_logic():
682689
encryption_info = {
683690
"encryption_functions": [],
684691
"crypto_libraries": [],
685-
"hash_functions": [],
686692
"encoding_functions": [],
687693
"suspicious_patterns": [],
688694
"javascript_sources": []
@@ -693,18 +699,16 @@ async def fetch_encryption_logic():
693699
const encryptionInfo = {
694700
encryption_functions: [],
695701
crypto_libraries: [],
696-
hash_functions: [],
697702
encoding_functions: [],
698703
suspicious_patterns: [],
699704
javascript_sources: []
700705
};
701706
702707
// Common encryption/crypto keywords to search for
703708
const encryptKeywords = [
704-
'encrypt', 'decrypt', 'cipher', 'aes', 'rsa', 'des', 'blowfish',
705-
'crypto', 'cryptojs', 'sjcl', 'forge', 'webcrypto', 'subtle',
706-
'hash', 'sha', 'md5', 'pbkdf2', 'scrypt', 'bcrypt',
707-
'base64', 'hex', 'encode', 'decode', 'btoa', 'atob'
709+
'encrypt', 'decrypt', 'cipher', 'aes', 'rsa', 'blowfish',
710+
'crypto', 'cryptojs', 'sjcl', 'forge', 'webcrypto', 'subtle', 'scrypt', 'bcrypt',
711+
'encr', 'decr'
708712
];
709713
710714
// Function to extract function source code
@@ -815,16 +819,16 @@ async def fetch_encryption_logic():
815819
});
816820
817821
// Check for common hash/encoding functions
818-
const hashFunctions = ['btoa', 'atob', 'encodeURIComponent', 'decodeURIComponent'];
819-
hashFunctions.forEach(funcName => {
820-
if (window[funcName]) {
821-
encryptionInfo.encoding_functions.push({
822-
name: funcName,
823-
available: true,
824-
source: getFunctionSource(window[funcName])
825-
});
826-
}
827-
});
822+
// const hashFunctions = ['btoa', 'atob', 'encodeURIComponent', 'decodeURIComponent'];
823+
// hashFunctions.forEach(funcName => {
824+
// if (window[funcName]) {
825+
// encryptionInfo.encoding_functions.push({
826+
// name: funcName,
827+
// available: true,
828+
// source: getFunctionSource(window[funcName])
829+
// });
830+
// }
831+
// });
828832
829833
return encryptionInfo;
830834
"""
@@ -861,7 +865,6 @@ async def fetch_encryption_logic():
861865
r'var\s+(\w*secret\w*)\s*=',
862866
r'var\s+(\w*salt\w*)\s*=',
863867
r'var\s+(\w*iv\w*)\s*=',
864-
r'var\s+(\w*hash\w*)\s*=',
865868
r'var\s+(\w*cipher\w*)\s*='
866869
]
867870

@@ -874,7 +877,7 @@ async def fetch_encryption_logic():
874877
if hasattr(driver, 'requests'):
875878
for request in driver.requests[-50:]: # Check last 50 requests
876879
url_lower = request.url.lower()
877-
if any(keyword in url_lower for keyword in ['encrypt', 'decrypt', 'hash', 'crypto', 'auth', 'token']):
880+
if any(keyword in url_lower for keyword in ['encrypt', 'decrypt', 'crypto', 'auth', 'token']):
878881
network_crypto_endpoints.append({
879882
'url': request.url,
880883
'method': request.method,
@@ -988,7 +991,7 @@ async def analyze_specific_function(function_name: str):
988991
}
989992

990993
# Check for encryption keywords
991-
keywords = ['encrypt', 'decrypt', 'hash', 'cipher', 'key', 'salt', 'iv', 'aes', 'rsa', 'md5', 'sha']
994+
keywords = ['encrypt', 'decrypt', 'cipher', 'key', 'salt', 'iv', 'aes', 'rsa']
992995
for keyword in keywords:
993996
if keyword in source:
994997
crypto_indicators['encryption_keywords'].append(keyword)

0 commit comments

Comments
 (0)