killchain-compendium/Miscellaneous/Python3 Cheatsheet.md

1.2 KiB

Python3 Cheatsheet

Strings

  • Python3 Strings ... just follow fuckpep8 or read on further and die ~S~trying
What? Function
String -> Bytes encode()
String <- Bytes decode()
ASCII -> Dec ord()
ASCII <- Dec chr()
HexString -> Bytes binascii.unhexlify()
HexBytes <- Bytes binascii.hexlify()
HexString -> Bytes bytes.fromhex()
HexString <- Bytes hex()
Base64 -> HexString base64.b64encode(bytes.fromhex())
Base64 <- Bytes base64.b64decode()
Bytes -> Long Crypto.Util.number.bytes_to_long()
Bytes <- Long Crypto.Util.number.long_to_bytes()

Exculsionary OR

Either use ^ or for ByteStrings while you are already pwning do

from pwn import *
xor()