คลัง
playbooks

Hashcat Playbook

Hashcat เป็น password cracker ที่ใช้ GPU เร็วที่สุด รองรับ hash หลายร้อยชนิด คู่มือนี้ครอบคลุมการระบุชนิด hash, attack modes ทั้งหมด (dictionary/rule/mask/combinator/hybrid), mask syntax, และกลยุทธ์เลือก attack แบบใช้งานจริง

IntermediateAdvanced#hashcat#cracking#hash#mask#rules#playbook#ctf

1. ระบุชนิด hash + mode

หา hash modeLinux
# ระบุชนิด hash
hashid 'HASH_HERE'
# หรือ name-that-hash (ละเอียดกว่า)
nth --text 'HASH_HERE'

# mode ที่พบบ่อย (-m)
# 0     = MD5
# 100   = SHA1
# 1400  = SHA256
# 1800  = sha512crypt ($6$) — Linux shadow
# 3200  = bcrypt ($2a$/$2y$)
# 1000  = NTLM (Windows)
# 5600  = NetNTLMv2
# 13100 = Kerberoast (TGS)
# 18200 = AS-REP
# 22000 = WPA/WPA2
# 16500 = JWT
ดู hash mode ครบที่ hashcat --help | grep -i <type> หรือ hashcat wiki example hashes

2. Attack modes (-a)

modeชื่อการทำงาน
-a 0Dictionaryลองแต่ละคำใน wordlist
-a 1Combinatorรวมสอง wordlist (word1+word2)
-a 3Mask (brute)ลองทุก combination ตาม pattern
-a 6Hybrid wordlist+maskword ตามด้วย mask (word123)
-a 7Hybrid mask+wordlistmask ตามด้วย word (123word)
ตัวอย่างแต่ละ modeLinux
# Dictionary
hashcat -m 0 hashes.txt rockyou.txt

# Dictionary + rules (ทรงพลังสุดสำหรับรหัสจริง)
hashcat -m 0 hashes.txt rockyou.txt -r rules/best64.rule

# Mask brute-force
hashcat -m 0 hashes.txt -a 3 ?l?l?l?l?l?l        # 6 lowercase
hashcat -m 0 hashes.txt -a 3 ?u?l?l?l?l?d?d?d     # Abcde123

# Hybrid: word + 3 ตัวเลข
hashcat -m 0 hashes.txt -a 6 rockyou.txt ?d?d?d

# แสดงผลที่ crack ได้
hashcat -m 0 hashes.txt --show

3. Mask syntax

charsetความหมาย
?la-z (lowercase)
?uA-Z (uppercase)
?d0-9 (digits)
?sสัญลักษณ์ (special)
?a?l?u?d?s (ทั้งหมด)
?b0x00-0xff (ทุก byte)
custom charset + incrementLinux
# custom charset (-1, -2, ...)
hashcat -m 0 hashes.txt -a 3 -1 ?l?d "?1?1?1?1?1?1"   # lowercase+digit 6 ตำแหน่ง

# increment (ลองความยาว 1 ถึง 8)
hashcat -m 0 hashes.txt -a 3 ?a?a?a?a?a?a?a?a --increment --increment-min 1
custom charset ลดพื้นที่ค้นหา ทำให้เร็วขึ้นเมื่อรู้ว่ารหัสใช้อักขระแบบไหน

4. กลยุทธ์ (เรียงตามความคุ้ม)

  1. 1rockyou.txt ตรงๆ (-a 0) — เร็ว ครอบคลุมรหัสที่หลุดบ่อย
  2. 2rockyou + best64.rule — แปลง word (เพิ่มเลข/สัญลักษณ์ที่คนนิยม)
  3. 3rockyou + rules ใหญ่ขึ้น (d3ad0ne, OneRuleToRuleThemAll)
  4. 4hybrid -a 6: word + ?d?d?d (รหัสแบบ password123)
  5. 5mask -a 3 ตาม pattern ที่เดา (ความยาว/charset)
  6. 6ถ้ารู้ policy รหัส → custom mask ตรงตาม policy
OneRuleToRuleThemAll เป็น rule ครอบจักรวาลที่นิยมมาก — rockyou.txt -r OneRuleToRuleThemAll.rule ครอบคลุม transformation เยอะในรอบเดียว

5. Decision Tree — crack ไม่แตกทำอะไรต่อ

Hashcat — เลือกกลยุทธ์ crack
ระบุชนิด hash ก่อน
hashid / hash-identifier → ได้ -m mode
เริ่มด้วย wordlist
hashcat -m MODE hash rockyou.txt
แตกไหม?
ไม่แตก+ rules (best64, dive)
ยังไม่แตกmask attack (รู้ pattern)
รู้บางส่วนhybrid (wordlist+mask)
hash ช้ามาก (bcrypt)?
ใช่ลด keyspace / ใช้ GPU แรง
ได้ password

5. Quick Reference

  • ระบุ hash: hashid / nth → หา -m mode
  • dictionary: hashcat -m MODE hashes rockyou.txt
  • + rule: -r rules/best64.rule (ทรงพลังสุด)
  • mask: -a 3 ?l?u?d?s; custom: -1 ?l?d '?1?1?1'
  • hybrid: -a 6 wordlist ?d?d?d
  • กลยุทธ์: rockyou → +rule → hybrid → mask
  • ผล: --show; mode เด่น 0/100/1800/1000/22000/13100

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

สมมติได้ hash มาจากโจทย์ (dump จาก DB, shadow file, หรือ capture) มีแค่ Kali เปล่าๆ ยังไม่รู้จะ crack ยังไง ทำตามนี้ทีละขั้น

  1. 1เช็คว่ามี hashcat ไหม: `hashcat --version` — Kali มีติดมาให้แล้ว ถ้าไม่มี `sudo apt install hashcat -y`
  2. 2ระบุชนิด hash ก่อนเสมอ: `hashid 'HASH_HERE'` หรือกรณีไม่ชัวร์ ลองแปะที่เว็บ hashes.com/en/tools/hash_identifier
  3. 3ได้ mode (-m) แล้ว → ลอง dictionary attack พื้นฐาน: `hashcat -m 0 hash.txt /usr/share/wordlists/rockyou.txt`
  4. 4ถ้า rockyou.txt ยังไม่มี (ถูกบีบอัดอยู่): `sudo gunzip /usr/share/wordlists/rockyou.txt.gz`
  5. 5รอผล — ถ้าเห็น error 'No hashes loaded' แปลว่า mode ผิดหรือ format hash ผิด ลองเช็ค format ใหม่ (ตัด header/newline เกิน)
  6. 6crack ไม่แตก → เพิ่ม rule: `hashcat -m 0 hash.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule`
  7. 7ยังไม่แตกและรู้ pattern บางส่วน (เช่นรู้ว่ามีตัวเลขต่อท้าย 3 ตัว) → ลอง hybrid: `hashcat -m 0 hash.txt -a 6 rockyou.txt ?d?d?d`
  8. 8ยังไม่แตกเลยและไม่รู้ pattern → ลอง mask brute (จำกัดความยาว/charset): `hashcat -m 0 hash.txt -a 3 ?a?a?a?a?a?a?a`
  9. 9ดูผลที่ crack ได้: `hashcat -m 0 hash.txt --show`
  10. 10ได้ password แล้ว → เอาไปใช้กับ service ที่เกี่ยวข้องต่อ (SSH/AD/ZIP อื่นๆ)
จับมือ crack hash ด้วย Hashcat
เช็ค hashcat พร้อมใช้ไหม
hashcat --version
✅ ใช้ได้→ ไประบุชนิด hash
❌ ไม่มี/error→ sudo apt install hashcat -y
ระบุชนิด hash
hashid 'HASH' หรือลองที่ hashes.com
รู้ mode (-m) ชัดเจนไหม
✅ รู้ชัด→ ไป dictionary attack
❌ ไม่ชัวร์/หลาย candidate→ ลองทีละ mode ที่เป็นไปได้ หรือดู hint ในโจทย์
dictionary attack
hashcat -m MODE hash.txt rockyou.txt
แตกไหม?
✅ แตก→ hashcat --show ดู password
❌ ไม่แตก→ เพิ่ม -r best64.rule ลองใหม่
ใส่ rule แล้วยังไม่แตก?
✅ รู้ pattern บางส่วน→ hybrid -a 6/-a 7
❌ ไม่รู้ pattern เลย→ mask brute -a 3 (จำกัด keyspace)
mask/hybrid ก็ยังไม่แตก + hash ช้า (bcrypt/sha512crypt)
❌ ตันจริง→ ทบทวน wordlist/policy หรือข้ามไปหาช่องทางอื่นในโจทย์
ขั้นตอน/งานเครื่องมือใน Kaliติดตั้งเพิ่ม (ถ้าไม่มี)เครื่องมือออนไลน์
เช็ค hash เป็นชนิดไหนhashidpip install name-that-hashhashes.com, crackstation.net
crack แบบ dictionaryhashcat -m 0 -a 0--
wordlist มาตรฐาน/usr/share/wordlists/rockyou.txtgunzip rockyou.txt.gz-
เพิ่ม rule แปลง wordhashcat -r best64.rulegit clone OneRuleToRuleThemAll-
mask brute-forcehashcat -a 3--
crack offline อีกทางjohn-crackstation.net (lookup rainbow table)
ดูรายละเอียด mode/wikihashcat --help-hashcat.net/wiki
hash เป็น WPA handshakehashcat -m 22000aircrack-ng suite-
🚑 ถ้าตันสนิท ลองท่าถัดไป: (1) ไฟล์มีรหัส (zip/pdf/ssh key) ไม่ใช่ raw hash → ไป John The Ripper Playbook ใช้ชุด *2john แปลงก่อน (2) hash เป็น WPA/WPA2 handshake → ไป Handshake Analysis / Aircrack-ng (3) crack ไม่ออกเพราะ rockyou ไม่พอ → ลองหา wordlist เฉพาะทาง (SecLists) หรือดู context โจทย์ว่ามี hint ชื่อ/วันเกิด (4) ได้ password แล้วแต่ยังเข้าไม่ได้ → กลับไปดู service ที่ hash มาจาก (AD → Kerberoasting, SSH → ลอง login ตรง)

หัวข้อที่เชื่อมโยง

โน้ตของฉัน

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