From 1c7e97782ff784ade910b07e8693fe6d26cf8530 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sun, 30 Oct 2022 21:23:32 +0100 Subject: [PATCH] Add hashcat's notes to the KB --- knowledge base/hashcat.md | 36 ++++++++++++++++++++++++++++++++++++ knowledge base/mkpasswd.md | 18 ++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 knowledge base/hashcat.md create mode 100644 knowledge base/mkpasswd.md diff --git a/knowledge base/hashcat.md b/knowledge base/hashcat.md new file mode 100644 index 0000000..9f63baa --- /dev/null +++ b/knowledge base/hashcat.md @@ -0,0 +1,36 @@ +# Hashcat + +## TL;DR + +```sh +# Install it. +sudo zypper install hashcat + +# Add your user to the 'video' group to be able to use the GPU. +sudo usermod -a -G 'video' 'username' +sudo gpasswd -a 'username' 'video' + +# hashcat [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]... + +# Run a benchmark. +hashcat -b + +# Run a benchmark on all hash modes. +hashcat -b --benchmark-all + +# Show the expected speed for a particular hash mode. +hashcat \ + -m 1800 -a3 -O -w4 --speed-only \ + $(mkpasswd -m sha512crypt '1029384756') \ + ?a?a?a?a?a?a?a?a + +# Try to brute-force (-a3) a `sha512crypt`ed (-m1800) string. +# Only test 10-digits strings (--increment --increment-min 10 +# --increment-max 10 ?d?d?d?d?d?d?d?d?d?d). +# Use all the available resources possible (-w4), including optimized kernel +# code (-O). +hashcat \ + -m 1800 -a3 -O -w4 --increment --increment-min 10 --increment-max 10 \ + $(mkpasswd -m sha512crypt '1029384756') \ + ?d?d?d?d?d?d?d?d?d?d +``` diff --git a/knowledge base/mkpasswd.md b/knowledge base/mkpasswd.md new file mode 100644 index 0000000..6095791 --- /dev/null +++ b/knowledge base/mkpasswd.md @@ -0,0 +1,18 @@ +# Debian's mkpasswd + +Crypts a given password using crypt(3). + +```sh +mkpasswd [OPTIONS]... [PASSWORD [SALT]] +``` + +## TL;DR + +```sh +# List available encrypting methods. +mkpasswd -m -h + +# Return a hash of a specific method. +mkpasswd -m 'nt' 'password' +mkpasswd -m 'sha512crypt' 'password' +```