Skip to content

Instantly share code, notes, and snippets.

@xiispace
Created May 25, 2018 07:14
Show Gist options
  • Save xiispace/74989747aece9c3ba307f3cec6082130 to your computer and use it in GitHub Desktop.
Save xiispace/74989747aece9c3ba307f3cec6082130 to your computer and use it in GitHub Desktop.
python kernel crypt
from socket import socket, AF_ALG, SOCK_SEQPACKET, SOL_ALG, ALG_SET_KEY
from binascii import hexlify
with socket(AF_ALG, SOCK_SEQPACKET, 0) as alg:
alg.bind(('hash', 'hmac(sha512)'))
alg.setsockopt(SOL_ALG, ALG_SET_KEY, b'key')
op, _ = alg.accept()
with open('/etc/passwd', 'rb') as f:
op.sendfile(f)
print(hexlify(op.recv(64)))
op.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment