vulpfest 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vulpfest/__init__.py +1 -0
- vulpfest/__main__.py +108 -0
- vulpfest/banner.py +69 -0
- vulpfest/logo.py +19 -0
- vulpfest/tools/gmapscout/cli.py +51 -0
- vulpfest/tools/gmapscout/gmapscout_core.py +202 -0
- vulpfest/tools/leadscout/cli.py +52 -0
- vulpfest/tools/leadscout/leadscout_core.py +72 -0
- vulpfest/tools/scamcheck/checker.py +266 -0
- vulpfest/tools/scamcheck/cli.py +88 -0
- vulpfest/tools/scamcheck/ssrf_guard.py +142 -0
- vulpfest/tools/scanner/auth_scan.py +175 -0
- vulpfest/tools/scanner/cli.py +167 -0
- vulpfest/tools/scanner/deep_web.py +353 -0
- vulpfest/tools/scanner/dns_email.py +202 -0
- vulpfest/tools/scanner/manual_review.py +60 -0
- vulpfest/tools/scanner/repo_scan.py +434 -0
- vulpfest/tools/scanner/scanner.py +886 -0
- vulpfest/tools/scanner/ssrf_guard.py +142 -0
- vulpfest/ui.py +38 -0
- vulpfest-1.0.0.dist-info/METADATA +103 -0
- vulpfest-1.0.0.dist-info/RECORD +25 -0
- vulpfest-1.0.0.dist-info/WHEEL +4 -0
- vulpfest-1.0.0.dist-info/entry_points.txt +2 -0
- vulpfest-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""Pemeriksaan DNS dan email lanjutan (bagian dari Mode Web mendalam).
|
|
2
|
+
|
|
3
|
+
Hanya membaca DNS publik (DNS-over-HTTPS) dan log Certificate Transparency. Tidak mengirim email,
|
|
4
|
+
tidak mendaftarkan atau mengklaim apa pun.
|
|
5
|
+
"""
|
|
6
|
+
import re
|
|
7
|
+
import time
|
|
8
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
9
|
+
|
|
10
|
+
import requests
|
|
11
|
+
|
|
12
|
+
DOH = 'https://cloudflare-dns.com/dns-query'
|
|
13
|
+
TYPE_NUM = {'A': 1, 'NS': 2, 'CNAME': 5, 'MX': 15, 'TXT': 16, 'AAAA': 28}
|
|
14
|
+
MAX_SUBDOMAINS = 40
|
|
15
|
+
BUDGET_SECONDS = 22
|
|
16
|
+
CT_TIMEOUT = 10
|
|
17
|
+
DKIM_SELECTORS = ('google', 'selector1', 'selector2', 'k1', 'k2', 's1', 's2', 'default', 'mail', 'dkim', 'resend',
|
|
18
|
+
'zmail', 'smtp', 'mandrill', 'cf2024-1', 'hostingermail-a', 'protonmail', 'fm1')
|
|
19
|
+
# Layanan yang rawan diambil alih bila CNAME-nya menunjuk ke nama yang sudah tidak ada (NXDOMAIN).
|
|
20
|
+
DANGLING_NX = ('azurewebsites.net', 'cloudapp.net', 'cloudapp.azure.com', 'trafficmanager.net', 'blob.core.windows.net',
|
|
21
|
+
'azureedge.net', 'azure-api.net', 'azurestaticapps.net', 'elasticbeanstalk.com', 'herokudns.com',
|
|
22
|
+
'herokuapp.com', 'github.io', 'netlify.app', 'surge.sh', 'bitbucket.io', 'ghost.io', 'myshopify.com',
|
|
23
|
+
'pantheonsite.io', 'readthedocs.io', 'wpengine.com', 'fly.dev', 'onrender.com')
|
|
24
|
+
HOST_RE = re.compile(r'^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$')
|
|
25
|
+
UA = 'Mozilla/5.0 CyberWebScanner/2.0'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def doh(name, rtype, timeout=5):
|
|
29
|
+
"""Kembalikan (status DNS, daftar data). Status 3 berarti NXDOMAIN; 2 berarti gagal."""
|
|
30
|
+
try:
|
|
31
|
+
r = requests.get(DOH, params={'name': name, 'type': rtype}, headers={'accept': 'application/dns-json'}, timeout=timeout)
|
|
32
|
+
data = r.json()
|
|
33
|
+
except (requests.RequestException, ValueError):
|
|
34
|
+
return 2, []
|
|
35
|
+
want = TYPE_NUM.get(rtype)
|
|
36
|
+
out = []
|
|
37
|
+
for a in data.get('Answer', []) or []:
|
|
38
|
+
if want and a.get('type') != want:
|
|
39
|
+
continue
|
|
40
|
+
val = re.sub(r'"\s+"', '', str(a.get('data', ''))).strip().strip('"')
|
|
41
|
+
out.append(val)
|
|
42
|
+
return data.get('Status', 2), out
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def ct_subdomains(root, timeout=CT_TIMEOUT):
|
|
46
|
+
"""Subdomain dari log Certificate Transparency (crt.sh, cadangan Cert Spotter)."""
|
|
47
|
+
names, source = set(), None
|
|
48
|
+
try:
|
|
49
|
+
r = requests.get('https://crt.sh/', params={'q': f'%.{root}', 'output': 'json'}, timeout=timeout, headers={'User-Agent': UA})
|
|
50
|
+
if r.status_code == 200:
|
|
51
|
+
for row in r.json()[:5000]:
|
|
52
|
+
names.update(str(row.get('name_value', '')).split('\n'))
|
|
53
|
+
source = 'crt.sh'
|
|
54
|
+
except (requests.RequestException, ValueError):
|
|
55
|
+
pass
|
|
56
|
+
if not names:
|
|
57
|
+
try:
|
|
58
|
+
r = requests.get('https://api.certspotter.com/v1/issuances',
|
|
59
|
+
params={'domain': root, 'include_subdomains': 'true', 'expand': 'dns_names'}, timeout=timeout)
|
|
60
|
+
if r.status_code == 200:
|
|
61
|
+
for row in r.json():
|
|
62
|
+
names.update(row.get('dns_names', []))
|
|
63
|
+
source = 'Cert Spotter'
|
|
64
|
+
except (requests.RequestException, ValueError):
|
|
65
|
+
pass
|
|
66
|
+
clean = set()
|
|
67
|
+
for n in names:
|
|
68
|
+
n = n.strip().lower().rstrip('.')
|
|
69
|
+
while n.startswith('*.'):
|
|
70
|
+
n = n[2:]
|
|
71
|
+
if n != root and n.endswith('.' + root) and HOST_RE.match(n):
|
|
72
|
+
clean.add(n)
|
|
73
|
+
return sorted(clean), source
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def check_subdomain(fqdn, session, fingerprints):
|
|
77
|
+
_, cnames = doh(fqdn, 'CNAME')
|
|
78
|
+
if not cnames:
|
|
79
|
+
return None
|
|
80
|
+
target = cnames[0].rstrip('.').lower()
|
|
81
|
+
entry = {'subdomain': fqdn, 'cname': target}
|
|
82
|
+
status, _ = doh(target, 'A')
|
|
83
|
+
if status == 3:
|
|
84
|
+
svc = next((d for d in DANGLING_NX if target == d or target.endswith('.' + d)), None)
|
|
85
|
+
entry.update(status='rentan' if svc else 'dangling', layanan=svc or target, confidence='medium',
|
|
86
|
+
bukti='CNAME menunjuk ke nama yang tidak ada (NXDOMAIN)')
|
|
87
|
+
return entry
|
|
88
|
+
host = next((h for h, _ in fingerprints if target.endswith(h)), None)
|
|
89
|
+
if host and session is not None:
|
|
90
|
+
try:
|
|
91
|
+
r = session.get(f'https://{fqdn}', timeout=6, verify=False)
|
|
92
|
+
body = (r.text or '')[:8000].lower()
|
|
93
|
+
fp = next((p for h, p in fingerprints if h == host and p in body), None)
|
|
94
|
+
if fp:
|
|
95
|
+
entry.update(status='rentan', layanan=host, confidence='high', bukti=fp)
|
|
96
|
+
return entry
|
|
97
|
+
except requests.exceptions.RequestException:
|
|
98
|
+
pass
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
LOOKUP_TERM = re.compile(r'^[+\-~?]?(?:include:|a$|a:|a/|mx$|mx:|mx/|ptr$|ptr:|exists:|redirect=)', re.I)
|
|
103
|
+
INCLUDE_TERM = re.compile(r'^[+\-~?]?(?:include:|redirect=)(\S+)', re.I)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def spf_lookups(record, depth=0, seen=None, limit=11):
|
|
107
|
+
"""Jumlah DNS lookup SPF secara rekursif (berhenti setelah melewati batas agar hemat)."""
|
|
108
|
+
seen = set() if seen is None else seen
|
|
109
|
+
count = 0
|
|
110
|
+
for term in record.split()[1:]:
|
|
111
|
+
if not LOOKUP_TERM.match(term):
|
|
112
|
+
continue
|
|
113
|
+
count += 1
|
|
114
|
+
if count >= limit:
|
|
115
|
+
return count
|
|
116
|
+
m = INCLUDE_TERM.match(term)
|
|
117
|
+
if m and depth < 10:
|
|
118
|
+
dom = m.group(1).lower()
|
|
119
|
+
if dom in seen:
|
|
120
|
+
continue
|
|
121
|
+
seen.add(dom)
|
|
122
|
+
_, txt = doh(dom, 'TXT')
|
|
123
|
+
sub = next((t for t in txt if t.lower().startswith('v=spf1')), None)
|
|
124
|
+
if sub:
|
|
125
|
+
count += spf_lookups(sub, depth + 1, seen, limit - count)
|
|
126
|
+
if count >= limit:
|
|
127
|
+
return count
|
|
128
|
+
return count
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _dmarc_tags(rec):
|
|
132
|
+
tags = {}
|
|
133
|
+
for part in rec.split(';'):
|
|
134
|
+
if '=' in part:
|
|
135
|
+
k, v = part.split('=', 1)
|
|
136
|
+
tags[k.strip().lower()] = v.strip()
|
|
137
|
+
return tags
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def analyze_email(root):
|
|
141
|
+
_, mx = doh(root, 'MX')
|
|
142
|
+
has_mx = any(m.split()[-1].rstrip('.') not in ('', '.') for m in mx if m.split())
|
|
143
|
+
_, txt = doh(root, 'TXT')
|
|
144
|
+
spf = [t for t in txt if t.lower().startswith('v=spf1')]
|
|
145
|
+
out = {'domain': root, 'has_mx': has_mx, 'spf_records': len(spf), 'spf': None, 'spf_all': None, 'spf_lookups': 0,
|
|
146
|
+
'dmarc': False, 'dmarc_rua': False, 'dkim_checked': False, 'dkim_selectors': [], 'mta_sts': False, 'tls_rpt': False}
|
|
147
|
+
if spf:
|
|
148
|
+
rec = spf[0]
|
|
149
|
+
out['spf'] = rec[:300]
|
|
150
|
+
m = re.search(r'(?:^|\s)([+\-~?]?)all(?:\s|$)', rec, re.I)
|
|
151
|
+
out['spf_all'] = (m.group(1) or '+') if m else None
|
|
152
|
+
out['spf_lookups'] = spf_lookups(rec)
|
|
153
|
+
_, dm = doh('_dmarc.' + root, 'TXT')
|
|
154
|
+
dmarc = next((t for t in dm if t.lower().startswith('v=dmarc1')), None)
|
|
155
|
+
if dmarc:
|
|
156
|
+
out['dmarc'] = True
|
|
157
|
+
out['dmarc_rua'] = bool(_dmarc_tags(dmarc).get('rua'))
|
|
158
|
+
sends = bool(spf) and bool(re.search(r'(?:^|\s)[+?~]?(?:include:|ip4:|ip6:|a\b|mx\b)', spf[0], re.I))
|
|
159
|
+
if sends:
|
|
160
|
+
out['dkim_checked'] = True
|
|
161
|
+
with ThreadPoolExecutor(max_workers=6) as ex:
|
|
162
|
+
results = list(ex.map(lambda sel: (sel, doh(f'{sel}._domainkey.{root}', 'TXT')[1] or doh(f'{sel}._domainkey.{root}', 'CNAME')[1]), DKIM_SELECTORS))
|
|
163
|
+
out['dkim_selectors'] = [sel for sel, ans in results if any(('p=' in a) or a.endswith('.') or '.' in a for a in ans)]
|
|
164
|
+
if has_mx:
|
|
165
|
+
_, sts = doh('_mta-sts.' + root, 'TXT')
|
|
166
|
+
out['mta_sts'] = any(t.lower().startswith('v=stsv1') for t in sts)
|
|
167
|
+
_, rpt = doh('_smtp._tls.' + root, 'TXT')
|
|
168
|
+
out['tls_rpt'] = any('v=tlsrptv1' in t.lower() for t in rpt)
|
|
169
|
+
return out
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def run(session, root, fingerprints, budget=BUDGET_SECONDS):
|
|
173
|
+
t0 = time.monotonic()
|
|
174
|
+
out = {'domain': root, 'ct_source': None, 'ct_total': 0, 'checked': 0, 'takeover': [], 'dangling': [],
|
|
175
|
+
'email': {}, 'partial': False}
|
|
176
|
+
ex = ThreadPoolExecutor(max_workers=8)
|
|
177
|
+
try:
|
|
178
|
+
email_f = ex.submit(analyze_email, root)
|
|
179
|
+
subs, source = ct_subdomains(root, timeout=min(CT_TIMEOUT, budget))
|
|
180
|
+
out['ct_source'], out['ct_total'] = source, len(subs)
|
|
181
|
+
futures = [ex.submit(check_subdomain, sd, session, fingerprints) for sd in subs[:MAX_SUBDOMAINS]]
|
|
182
|
+
if len(subs) > MAX_SUBDOMAINS:
|
|
183
|
+
out['partial'] = True
|
|
184
|
+
for f in futures:
|
|
185
|
+
left = budget - (time.monotonic() - t0)
|
|
186
|
+
if left <= 0:
|
|
187
|
+
out['partial'] = True
|
|
188
|
+
break
|
|
189
|
+
try:
|
|
190
|
+
entry = f.result(timeout=left)
|
|
191
|
+
except Exception:
|
|
192
|
+
continue
|
|
193
|
+
out['checked'] += 1
|
|
194
|
+
if entry:
|
|
195
|
+
(out['takeover'] if entry['status'] == 'rentan' else out['dangling']).append(entry)
|
|
196
|
+
try:
|
|
197
|
+
out['email'] = email_f.result(timeout=max(1, budget - (time.monotonic() - t0)))
|
|
198
|
+
except Exception as e:
|
|
199
|
+
out['email'] = {'error': f'{e.__class__.__name__}'}
|
|
200
|
+
finally:
|
|
201
|
+
ex.shutdown(wait=False, cancel_futures=True)
|
|
202
|
+
return out
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Lembar telaah manual: area yang tidak aman atau tidak mungkin diuji otomatis dari luar."""
|
|
2
|
+
|
|
3
|
+
CHECKLIST = (
|
|
4
|
+
{'id': 'access-control', 'title': 'Kontrol akses antar-pengguna (IDOR)', 'track_label': 'Senior',
|
|
5
|
+
'questions': ('Setiap endpoint yang menerima ID memeriksa bahwa objek itu milik pengguna yang login.',
|
|
6
|
+
'Pengguna biasa tidak bisa memanggil endpoint atau aksi milik admin.',
|
|
7
|
+
'Data milik tim atau organisasi lain tidak bisa dibaca dengan mengganti ID di URL atau body.'),
|
|
8
|
+
'evidence': 'pengujian dengan dua akun uji milik sendiri, atau pemeriksaan kode untuk filter pemilik di setiap query.'},
|
|
9
|
+
{'id': 'auth', 'title': 'Login, reset kata sandi, dan sesi', 'track_label': 'Pemula',
|
|
10
|
+
'questions': ('Tautan reset kata sandi dibuat dari alamat situs yang tetap, bukan dari header Host permintaan.',
|
|
11
|
+
'Token reset hanya berlaku sekali dan kedaluwarsa dalam waktu singkat.',
|
|
12
|
+
'Sesi diganti (dirotasi) setelah login, dan logout benar-benar membatalkan sesi di server.',
|
|
13
|
+
'Cookie sesi memakai Secure, HttpOnly, dan SameSite, serta tidak berlaku untuk seluruh subdomain bila tidak perlu.'),
|
|
14
|
+
'evidence': 'konfigurasi autentikasi dan hasil uji manual alur reset kata sandi.'},
|
|
15
|
+
{'id': 'rate-limit', 'title': 'Pembatasan percobaan (rate limiting)', 'track_label': 'Pemula',
|
|
16
|
+
'questions': ('Login, reset kata sandi, OTP, dan pendaftaran dibatasi jumlah percobaannya per akun dan per IP.',
|
|
17
|
+
'Ada penundaan atau CAPTCHA setelah beberapa kegagalan.',
|
|
18
|
+
'Endpoint mahal (AI, ekspor, kirim email) punya kuota per pengguna.'),
|
|
19
|
+
'evidence': 'konfigurasi pembatas di server, gateway, atau layanan seperti Cloudflare/Vercel Firewall.'},
|
|
20
|
+
{'id': 'webhooks', 'title': 'Webhook dan pembayaran', 'track_label': 'Senior',
|
|
21
|
+
'questions': ('Setiap webhook (Midtrans, Xendit, PayPal, Stripe) memverifikasi tanda tangan sebelum diproses.',
|
|
22
|
+
'Status pembayaran dicek ulang ke penyedia, bukan hanya dipercaya dari data yang dikirim browser.',
|
|
23
|
+
'Webhook yang sama tidak diproses dua kali (idempoten).'),
|
|
24
|
+
'evidence': 'kode handler webhook dan log pemrosesan.'},
|
|
25
|
+
{'id': 'business-logic', 'title': 'Logika bisnis dan race condition', 'track_label': 'Senior',
|
|
26
|
+
'questions': ('Kupon, saldo, kuota, dan stok tidak bisa dipakai ganda lewat permintaan paralel.',
|
|
27
|
+
'Langkah dalam alur (checkout, verifikasi, persetujuan) tidak bisa dilompati.',
|
|
28
|
+
'Harga dan jumlah dihitung ulang di server, bukan diambil dari browser.'),
|
|
29
|
+
'evidence': 'transaksi atau kunci database pada operasi saldo dan stok, serta pengujian alur.'},
|
|
30
|
+
{'id': 'ssrf', 'title': 'Fitur yang mengambil URL dari pengguna', 'track_label': 'Senior',
|
|
31
|
+
'questions': ('Fitur impor URL, webhook keluar, atau proxy gambar menolak alamat privat, loopback, dan 169.254.169.254.',
|
|
32
|
+
'Jumlah redirect dan ukuran respons dibatasi.'),
|
|
33
|
+
'evidence': 'kode validasi URL; lihat ssrf_guard.py di repositori ini sebagai contoh.'},
|
|
34
|
+
{'id': 'data', 'title': 'Data pribadi, log, dan audit', 'track_label': 'Senior',
|
|
35
|
+
'questions': ('Kata sandi, token, dan data pribadi tidak tercatat di log.',
|
|
36
|
+
'Aksi admin (hapus, ubah peran, ekspor data) tercatat di audit log.',
|
|
37
|
+
'Data pribadi dikumpulkan seperlunya dan ada kebijakan privasi sesuai UU PDP.'),
|
|
38
|
+
'evidence': 'contoh baris log, tabel audit, dan kebijakan privasi.'},
|
|
39
|
+
{'id': 'backup', 'title': 'Backup dan pemulihan', 'track_label': 'Pemula',
|
|
40
|
+
'questions': ('Backup database berjalan otomatis dan disimpan di luar server utama.',
|
|
41
|
+
'Backup terenkripsi dan aksesnya dibatasi.',
|
|
42
|
+
'Pemulihan dari backup pernah benar-benar diuji.'),
|
|
43
|
+
'evidence': 'jadwal backup, lokasi penyimpanan, dan catatan uji pemulihan terakhir.'},
|
|
44
|
+
{'id': 'secrets', 'title': 'Pengelolaan rahasia dan akses', 'track_label': 'Pemula',
|
|
45
|
+
'questions': ('Semua kunci API disimpan di variabel lingkungan atau secret manager, bukan di kode.',
|
|
46
|
+
'Akun admin dan layanan (hosting, database, domain, email) memakai autentikasi dua faktor.',
|
|
47
|
+
'Kunci yang pernah bocor sudah dicabut, dan akses mantan anggota tim sudah dicabut.'),
|
|
48
|
+
'evidence': 'daftar variabel lingkungan (tanpa nilai) dan pengaturan 2FA tiap layanan.'},
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def to_markdown():
|
|
53
|
+
lines = ['# Lembar telaah manual (Cyber Web Scanner)', '',
|
|
54
|
+
'Area berikut tidak aman atau tidak mungkin diuji otomatis dari luar. Jawab bersama tim, lalu centang yang sudah dipastikan.', '']
|
|
55
|
+
for area in CHECKLIST:
|
|
56
|
+
lines.append(f"## {area['title']} ({area['track_label']})")
|
|
57
|
+
lines.append('')
|
|
58
|
+
lines += [f'- [ ] {q}' for q in area['questions']]
|
|
59
|
+
lines += ['', f"Bukti yang perlu ada: {area['evidence']}", '']
|
|
60
|
+
return '\n'.join(lines)
|