31 lines
1.2 KiB
Markdown
31 lines
1.2 KiB
Markdown
|
# Python3 Cheatsheet
|
||
|
|
||
|
|
||
|
## Strings
|
||
|
|
||
|
* Python3 Strings ... just follow [fuckpep8](https://github.com/zardus/fuckpy3) 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
|
||
|
```sh
|
||
|
from pwn import *
|
||
|
xor()
|
||
|
```
|
||
|
|