Leaked Code Vulnerability Scanner
This tool scans leaked AI source code for common security vulnerabilities such as hardcoded API keys, weak cryptographic practices, and improper input sanitization. It uses pattern matching and static code analysis to flag potential risks, helping AI developers quickly assess leaked code for potential threats.
What It Does
This tool scans leaked AI source code for common security vulnerabilities such as hardcoded API keys, weak cryptographic practices, and improper input sanitization. It uses pattern matching to flag potential risks, helping AI developers quickly assess leaked code for potential issues.
Installation
No external dependencies are required. This tool uses Python's standard library.
Usage
python leaked_code_vulnerability_scanner.py --path ./leaked_code --output report.jsonSource Code
import argparse
import os
import json
import re
def scan_file(file_path):
"""Scan a single file for vulnerabilities."""
results = []
# Check for hardcoded sensitive information
sensitive_patterns = [
r'api[_-]?key\s*=\s*["\'].*["\']',
r'password\s*=\s*["\'].*["\']',
r'secret\s*=\s*["\'].*["\']'
]
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
for pattern in sensitive_patterns:
matches = re.findall(pattern, content, re.IGNORECASE)
for match in matches:
results.append({
'type': 'Hardcoded Sensitive Information',
'detail': match
})
except FileNotFoundError:
results.append({
'type': 'Error',
'detail': f"File '{file_path}' not found."
})
except Exception as e:
results.append({
'type': 'Error',
'detail': str(e)
})
return results
def scan_directory(directory_path):
"""Scan all files in a directory for vulnerabilities."""
all_results = {}
for root, _, files in os.walk(directory_path):
for file in files:
file_path = os.path.join(root, file)
all_results[file_path] = scan_file(file_path)
return all_results
def main():
parser = argparse.ArgumentParser(description='Leaked Code Vulnerability Scanner')
parser.add_argument('--path', required=True, help='Path to the file or directory containing the leaked code')
parser.add_argument('--output', required=True, help='Output file for the vulnerability report (JSON or plain text)')
args = parser.parse_args()
if not os.path.exists(args.path):
print(f"Error: Path '{args.path}' does not exist.")
return
if os.path.isfile(args.path):
results = {args.path: scan_file(args.path)}
elif os.path.isdir(args.path):
results = scan_directory(args.path)
else:
print(f"Error: Path '{args.path}' is neither a file nor a directory.")
return
if args.output.endswith('.json'):
with open(args.output, 'w', encoding='utf-8') as f:
json.dump(results, f, indent=4)
else:
with open(args.output, 'w', encoding='utf-8') as f:
for file, issues in results.items():
f.write(f"File: {file}\n")
for issue in issues:
f.write(f" - {issue['type']}: {issue['detail']}\n")
if __name__ == '__main__':
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- leaked_code_vulnerability_scanner
- Category
- Claude AI Source Code Leak
- Generated
- April 1, 2026
- Tests
- Passing โ
- Fix Loops
- 3
Quick Install
Clone just this tool:
git clone --depth 1 --filter=blob:none --sparse \ https://github.com/ptulin/autoaiforge.git cd autoaiforge git sparse-checkout set generated_tools/2026-04-01/leaked_code_vulnerability_scanner cd generated_tools/2026-04-01/leaked_code_vulnerability_scanner pip install -r requirements.txt 2>/dev/null || true python leaked_code_vulnerability_scanner.py