Repository navigation
Expand file tree
/
Copy pathquery_generator.py
More file actions
59 lines (54 loc) · 2.92 KB
/
Copy pathquery_generator.py
File metadata and controls
59 lines (54 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CyberCodex - Automated OSINT Dork & SIEM Detection Rule Generator
=================================================================
Generates ready-to-copy reconnaissance dorks (Google, GitHub, Shodan, Censys)
and defensive SIEM hunting queries (Wazuh, Sigma, Microsoft Sentinel KQL, Splunk SPL)
for any target domain, IP, CVE, or attack technique.
# TR: Herhangi bir hedef domain, IP veya saldırı tekniği için hem OSINT (Google,
# GitHub, Shodan) arama dorkları hem de SOC/SIEM (Wazuh, Sigma, KQL, Splunk)
# tespit kuralları üreten modül.
"""
from typing import Dict, List
class DorkAndSIEMGenerator:
"""
Produces dual-use offensive OSINT dorks and defensive SOC SIEM queries.
"""
def generate_for_target(self, target: str) -> Dict[str, List[str]]:
t = target.strip().lower()
return {
"google_osint_dorks": [
f'site:{t} ext:env OR ext:yaml OR ext:ini OR ext:conf OR ext:sql "DB_PASSWORD"',
f'site:{t} intitle:"index of" ("backup" OR "admin" OR ".git" OR "config")',
f'site:{t} inurl:api/v1 OR inurl:graphql OR inurl:swagger OR inurl:actuator/env',
f'site:pastebin.com OR site:trello.com OR site:postman.com "{t}"',
],
"github_secret_dorks": [
f'"{t}" (AWS_SECRET_ACCESS_KEY OR AKIA OR api_key OR client_secret OR BEGIN RSA PRIVATE KEY)',
f'"{t}" filename:.env OR filename:wp-config.php OR filename:kubeconfig OR filename:credentials',
f'"{t}" language:shell OR language:python (password OR token OR bearer)',
],
"shodan_censys_fofa_queries": [
f'Shodan: ssl.cert.subject.cn:"{t}" OR hostname:"{t}" http.status:200',
f'Censys: services.tls.certificates.leaf_data.names: "{t}" and not services.http.response.status_code: 403',
f'FOFA: domain="{t}" || cert="{t}" && status_code="200"',
],
"wazuh_sigma_kql_splunk_siem": [
(
f"Wazuh Rule (XML): <rule id=\"100950\" level=\"12\"><if_sid>31100</if_sid>"
f"<match>{t}</match><description>CyberCodex Alert: Traffic/IOC matching {t}</description></rule>"
),
(
f"Microsoft Sentinel (KQL): DeviceNetworkEvents | where RemoteUrl has \"{t}\" "
f"or RemoteIP == \"{t}\" | project Timestamp, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine"
),
(
f"Splunk (SPL): index=main OR index=sysmon (\"{t}\") "
f"| stats count by host, User, Image, CommandLine, DestinationIp"
),
(
f"Sigma Detection Snippet: detection:\\n selection:\\n DestinationHostname|contains: '{t}'\\n condition: selection"
),
],
}