Skip to content

Instantly share code, notes, and snippets.

@codeskipper
Created February 27, 2024 14:00
Show Gist options
  • Save codeskipper/0ac5992de2722d87477920d65e21f6ca to your computer and use it in GitHub Desktop.
Save codeskipper/0ac5992de2722d87477920d65e21f6ca to your computer and use it in GitHub Desktop.
create NTLM hash from Mac pasteboard secret and copy to pasteboard
#!/usr/bin/python3
## ntlm-hash.py
# create a NTLM hash from user input (or input redirect)
# thanks to https://stackoverflow.com/a/15603809
# usage:
# - put this content in ~/dev/ntlm-hash.py
# - append next line (without comment) to ~/.zprofile
# alias 2ntlm="pbpaste | /usr/bin/python3 ~/dev/ntlm-hash.py | pbcopy"
# source ~/.zprofile
# - copy password from password manager
# 2ntlm
# - paste password into its destination
import sys, hashlib
input = sys.stdin.read()
print(hashlib.new('md4', input.encode('utf-16le')).hexdigest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment