Censys
Censys เป็น search engine สำหรับ host และ certificate ที่ต่ออินเทอร์เน็ต คล้าย Shodan แต่เด่นเรื่อง certificate search (เผย subdomain/related infra) และข้อมูลเชิงลึก บทนี้ลงลึก host vs certificate search, query syntax, การหา IP จริงหลัง CDN ผ่าน cert, CLI, และเทียบกับ Shodan (เนื้อหาเพื่อ recon ที่ได้รับอนุญาต)
1. Censys คืออะไร (vs Shodan)
Censys สแกนอินเทอร์เน็ตเก็บข้อมูล host และ certificate คล้าย Shodan แต่จุดเด่นคือ certificate search ที่ทรงพลัง — ค้น SSL/TLS certificate ทั้งหมดที่เกี่ยวกับ domain เผย subdomain และ related infrastructure ได้ดี และมีข้อมูล host เชิงลึก (service, software, cert) เป็น passive recon ที่ควรใช้คู่กับ Shodan เพราะฐานข้อมูล/มุมมองต่างกัน
2. Host search vs Certificate search
| โหมด | ค้นอะไร | ใช้เมื่อ |
|---|---|---|
| Hosts | IP + service/port/software | หา exposed service (เหมือน Shodan) |
| Certificates | SSL/TLS cert ทั้งหมด | หา subdomain/related domain จาก cert |
Certificate search คือจุดแข็ง — cert มักครอบหลาย subdomain (SAN) และเผย domain ที่เกี่ยวข้อง ค้น cert ที่มีชื่อ target → ได้ subdomain/related infra ที่วิธีอื่นไม่เจอ
3. Query syntax
# === Hosts search ===
services.service_name: HTTP and location.country: TH
services.port: 3389 # RDP exposed
ip: 8.8.8.0/24 # IP range
autonomous_system.asn: 15169 # ตาม ASN
services.software.product: nginx
same_service(services.port: 443 and services.tls.certificates.leaf_data.subject.common_name: "example.com")
# === Certificates search (จุดเด่น) ===
names: example.com # cert ที่มีชื่อนี้
names: *.example.com # subdomain จาก cert
parsed.subject.organization: "Example Inc"
parsed.names: example.com and parsed.validity.end > 2024-01-01
# หา subdomain จาก cert แล้วดึงชื่อ → เป็น subdomain list4. CLI + การใช้
pip install censys
censys config # ใส่ API ID + secret
# ค้น host
censys search "services.port: 3389 and autonomous_system.asn: 15169"
# ดูข้อมูล IP
censys view 8.8.8.8
# ค้น certificate → ดึง subdomain
censys search "names: example.com" --index-type certs
# เชื่อมกับ subdomain enum:
# ดึงชื่อจาก cert → เพิ่มเข้า subdomain list → resolve (ดู Subdomain Enumeration)5. การใช้ + Quick Reference
- หา subdomain ผ่าน cert:
names: *.example.comเผย subdomain ที่ออก cert (คู่กับ crt.sh) - IP จริงหลัง CDN: ค้น cert ที่มีชื่อ domain → IP ที่ใช้ cert นั้น (อาจเป็น origin จริง)
- related infra: cert ของ org เดียวกัน → domain/host ที่เกี่ยวข้อง
- exposed service: services.port/software ตาม org/ASN (เหมือน Shodan)
- ใช้คู่ Shodan: ฐานข้อมูลต่างกัน — ตัวหนึ่งอาจเห็น host ที่อีกตัวไม่เห็น
- search engine host + certificate (เด่น cert search)
- Hosts: services.port/software, autonomous_system.asn
- Certificates: names: *.domain (เผย subdomain — จุดเด่น)
- CLI: censys search; censys view IP; --index-type certs
- หา IP จริงหลัง CDN + related infra ผ่าน cert
- ใช้คู่ Shodan (ฐานข้อมูลต่างกัน)
🧭 จับมือทำทีละขั้น (มีแค่ Kali) + ถ้าติดไปไหนต่อ
สมมติอยากหา IP จริงหลัง CDN หรือ subdomain ที่ tool อื่นไม่เจอ มีแค่ Kali + เบราว์เซอร์ ทำตามนี้ทีละขั้น
- 1เปิดเบราว์เซอร์ไป search.censys.io แล้วสมัคร account ฟรี (ต้องมี account ถึงจะค้นได้เต็มที่)
- 2ลอง Certificate search ก่อน: พิมพ์
names: target.comดูว่ามี cert อะไรบ้าง - 3ขยายหา subdomain จาก cert:
names: *.target.comแล้วจดชื่อทั้งหมดที่ขึ้น - 4สลับไป Hosts search ดู service ที่เปิด:
services.tls.certificates.leaf_data.subject.common_name: target.com - 5ถ้ารู้ ASN ขององค์กรแล้ว (จาก ASN Enumeration) ลอง:
autonomous_system.asn: 15169 - 6ถ้าอยากใช้ผ่าน terminal ติดตั้ง CLI:
pip install censys && censys config(ใส่ API ID/secret จากหน้า account) - 7ค้นผ่าน CLI:
censys search "names: target.com" --index-type certs - 8ดึงชื่อจาก cert ที่ได้ → เอาไปรวมกับ subdomain list อื่น แล้ว resolve ด้วย dnsx
- 9ถ้าต้องการหา IP จริงหลัง Cloudflare ลองหา cert ที่มีชื่อ target แล้วดูว่า IP ไหนใช้ cert เดียวกัน
- 10ถ้า Censys ไม่มี rate/quota พอ หรือหาไม่เจอ สลับไปลอง Shodan ดูมุมต่าง (ฐานข้อมูลคนละชุด)
| ขั้นตอน/งาน | เครื่องมือใน Kali | ติดตั้งเพิ่ม (ถ้าไม่มี) | เครื่องมือออนไลน์ |
|---|---|---|---|
| ค้น host/certificate | - | - | search.censys.io |
| ค้นผ่าน CLI | python3/pip | pip install censys | - |
| resolve subdomain ที่ได้ | dnsx | go install .../dnsx@latest | dnsdumpster.com |
| เทียบ cert อีกมุม | - | - | crt.sh |
| เทียบฐานข้อมูล exposed service | - | - | shodan.io |
| สแกน service ที่เจอ | nmap | - | - |
หัวข้อที่เชื่อมโยง
โน้ตของฉัน
ยังไม่มีโน้ตสำหรับหัวข้อนี้