คลัง
wireless

Hashcat Workflow (WPA)

Hashcat เป็น password cracker ที่ใช้ GPU ทำให้ crack WPA handshake เร็วกว่า CPU หลายเท่า บทนี้เน้น workflow เฉพาะ WPA (mode 22000) — การแปลง capture, attack modes (dictionary/rule/mask), และกลยุทธ์เลือก attack ตามลักษณะรหัส Wi-Fi (เนื้อหาเพื่อทดสอบที่ได้รับอนุญาต)

IntermediateAdvanced#hashcat#wireless#wpa#22000#mask#rules#gpu#ctf

1. ทำไมใช้ hashcat กับ WPA

WPA crack คือการคำนวณ PBKDF2 ซ้ำๆ เพื่อเทียบกับ MIC ใน handshake — งานนี้ ขนานกันได้ดีมากบน GPU hashcat ใช้ GPU จึงเร็วกว่า aircrack-ng (CPU) หลายสิบถึงร้อยเท่า ใช้ mode 22000 ที่รวมทั้ง PMKID และ EAPOL handshake

WPA2 passphrase ขั้นต่ำ 8 ตัวอักษร — ทำให้ brute-force ทั้งหมดไม่ไหว แต่ pattern ที่คนใช้จริง (เบอร์โทร, วันเกิด, คำ+ตัวเลข) เดาได้ด้วย mask/rule; เนื้อหาเพื่อทดสอบเครือข่ายที่ได้รับอนุญาต

2. เตรียม hash (mode 22000)

แปลง capture เป็น 22000Linux
# จาก pcapng (hcxdumptool) — รองรับทั้ง PMKID + handshake
hcxpcapngtool -o hash.22000 capture.pcapng

# จาก .cap เก่า (aircrack-ng format) → แปลงก่อน
hcxpcapngtool -o hash.22000 capture-01.cap

# ตรวจว่าได้ hash
cat hash.22000
# รูปแบบ: WPA*01*... (PMKID) หรือ WPA*02*... (EAPOL)
mode 22000 แทน mode เก่า (2500/16800) — เป็นมาตรฐานปัจจุบันที่รวมทุกแบบ

3. Attack modes

dictionary / rule / maskLinux
# 1. Dictionary (-a 0) — wordlist ตรงๆ
hashcat -m 22000 hash.22000 rockyou.txt

# 2. Dictionary + rules — แปลง word (เพิ่มเลข/สัญลักษณ์)
hashcat -m 22000 hash.22000 rockyou.txt -r rules/best64.rule

# 3. Mask (-a 3) — brute ตาม pattern
hashcat -m 22000 hash.22000 -a 3 ?d?d?d?d?d?d?d?d        # 8 หลักตัวเลข
hashcat -m 22000 hash.22000 -a 3 ?u?l?l?l?l?l?d?d        # Xxxxx99
# ?l=a-z ?u=A-Z ?d=0-9 ?s=สัญลักษณ์ ?a=ทั้งหมด

# 4. Combinator (-a 1) — รวมสอง wordlist
hashcat -m 22000 hash.22000 -a 1 words1.txt words2.txt

# ดูสถานะ/ผล
hashcat -m 22000 hash.22000 --show
ดูหัวข้อ Hashcat Playbook สำหรับ mask/rule เชิงลึก; WPA ขั้นต่ำ 8 ตัว → mask 8+ ตำแหน่ง

4. กลยุทธ์เลือก attack สำหรับ Wi-Fi

ลักษณะรหัสที่คาดattack ที่เหมาะ
รหัสทั่วไป/คำdictionary (rockyou) + best64 rule
เบอร์โทร (เช่น 08xxxxxxxx)mask ?d x10 หรือ pattern เบอร์
วันเกิด (ddmmyyyy)mask ?d?d?d?d?d?d?d?d
ค่า default ของ ISPwordlist เฉพาะรุ่น router / pattern ที่รู้
คำ + ตัวเลขท้ายdictionary + rule (append digits)
รหัสยาว/สุ่มมัก crack ไม่ได้ (ออกแบบมาดี)
ลำดับที่คุ้ม: rockyou + best64 rule ก่อน (ครอบคลุมรหัสที่คนใช้จริงเยอะ) → ถ้าไม่ได้ค่อย mask ตาม pattern ที่เดา (เบอร์/วันเกิด) → wordlist เฉพาะรุ่น router

5. Quick Reference

  • WPA crack บน GPU เร็วกว่า CPU มาก — mode 22000
  • เตรียม: hcxpcapngtool -o hash.22000 capture.pcapng
  • dictionary: hashcat -m 22000 hash.22000 rockyou.txt
  • + rule: -r rules/best64.rule
  • mask: -a 3 ?d?d?d?d?d?d?d?d (8 หลักเลข)
  • กลยุทธ์: rockyou+rule → mask(เบอร์/วันเกิด) → router wordlist

🧭 จับมือทำทีละขั้น (มีแค่ Kali) + ถ้าติดไปไหนต่อ

สมมติมี hash.22000 พร้อมแล้ว (แปลงจาก capture มาแล้ว) แต่ยังไม่รู้จะเลือก attack แบบไหนก่อนถึงจะคุ้มเวลา — ทำตามลำดับนี้ ไล่จากถูกสุด/เร็วสุดไปยากสุด

  1. 1เช็คว่า GPU พร้อมใช้: hashcat -I — ควรเห็น device (GPU) อย่างน้อย 1 ตัว
  2. 2เช็คว่า hash format ถูกต้อง: cat hash.22000 — ต้องขึ้นต้นด้วย WPA*01* (PMKID) หรือ WPA*02* (handshake)
  3. 3เริ่ม dictionary attack ก่อนเสมอ: hashcat -m 22000 hash.22000 /usr/share/wordlists/rockyou.txt
  4. 4ถ้าไม่เจอ ลองเพิ่ม rule (แปลง word เพิ่มเลข/สัญลักษณ์): hashcat -m 22000 hash.22000 rockyou.txt -r /usr/share/hashcat/rules/best64.rule
  5. 5เช็คผลลัพธ์เสมอด้วย: hashcat -m 22000 hash.22000 --show
  6. 6ถ้าโจทย์ให้ hint ว่ารหัสเป็นตัวเลข (เบอร์โทร/วันเกิด) ลอง mask: hashcat -m 22000 hash.22000 -a 3 ?d?d?d?d?d?d?d?d
  7. 7ยังไม่เจอ → โหลด wordlist ใหญ่ขึ้นจาก weakpass.com หรือลอง combinator (-a 1)
  8. 8ยังไม่เจออีก → หยุดแล้วย้อนกลับไปดูว่า handshake ที่ใช้ถูกต้องครบจริงไหม ก่อนเสียเวลา brute เพิ่ม
มี hash.22000 แล้ว — เลือก attack ทีละขั้น
เช็ค GPU/driver พร้อมใช้ไหม
hashcat -I
✅ เจอ GPU→ ไป dictionary attack
❌ ไม่มี/ error driver→ ใช้ --force รันบน CPU (ช้ากว่ามาก) หรือใช้ aircrack-ng แทน
dictionary + rule (rockyou + best64)
hashcat -m 22000 hash.22000 rockyou.txt -r best64.rule
✅ เจอ (Cracked)จบ — ดูผลด้วย --show
❌ ไม่เจอ→ ลอง mask ตาม pattern ที่คาด
mask attack ตาม pattern ที่คาด (เบอร์โทร/วันเกิด)
hashcat -m 22000 hash.22000 -a 3 ?d?d?d?d?d?d?d?d
✅ เจอจบ
❌ ไม่เจอ→ ขยาย wordlist / combinator
wordlist ใหญ่ขึ้น + combinator
weakpass.com wordlist, hashcat -a 1
✅ เจอจบ
❌ ยังไม่เจอ→ ทวนว่า handshake ถูกต้องครบจริงไหม
ขั้นตอน/งานเครื่องมือใน Kaliติดตั้งเพิ่ม (ถ้าไม่มี)เครื่องมือออนไลน์
crack ด้วย GPUhashcat-hashcat.net/wiki (mode/reference)
wordlist มาตรฐานrockyou.txt (/usr/share/wordlists, gunzip ก่อนใช้)-weakpass.com (wordlist ใหญ่กว่า/เฉพาะทาง)
rule setbest64.rule (มากับ hashcat)apt install hashcat-
mask/เดา patternhashcat -a 3--
แปลง capture เป็น hash-apt install hcxtools-
เช็คว่าเคยมีคน crack SSID/handshake นี้แล้ว--wpa-sec.stanev.org
ตรวจ hex/format ของ hash แปลกๆ--cyberchef.org
🚑 ถ้าตันสนิท ลองท่าถัดไป: Handshake Analysis — ก่อนบอกว่า crack ไม่ได้ ให้ทวนว่า handshake ที่ใช้ถูกต้อง/ครบจริง; Aircrack-ng — ถ้าต้องจับ capture ใหม่ทั้งชุด; WPA2 — ถ้าอยากทบทวนช่องทาง PMKID ที่ไม่ต้องรอ client; WPA3 — ถ้า hash เป็น SAE ไม่ใช่ WPA2 (โหมด 22000 ใช้กับ WPA3-SAE ตรงๆ ไม่ได้)

โน้ตของฉัน

ยังไม่มีโน้ตสำหรับหัวข้อนี้