Skip to content

Commit d013a52

Browse files
committed
hello world
Signed-off-by: degrigis <[email protected]>
0 parents  commit d013a52

File tree

7 files changed

+197
-0
lines changed

7 files changed

+197
-0
lines changed

angr

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
3+
4+
# Converting a SimActionObject to claripy BVV
5+
ipdb> string_address
6+
<SAO <BV64 0x555555755060>>
7+
ipdb> string_address.to_claripy()
8+
<BV64 0x555555755060>
9+
10+
# Reading from memory
11+
ipdb> real_addr
12+
<BV64 0x555555755060>
13+
data = current_state.memory._read_from(current_state.solver.eval(real_addr),8)
14+
15+
# Printing instruction
16+
new_concrete_state.block(addr=0x4049bc).capstone.pp()
17+
18+
# Printing SimStates generated by exploration technique
19+
sim_manager.py
20+
-----------------
21+
328: for state in self._fetch_states(stash=stash):
22+
print(state)
23+
24+
25+
# Hook an address with a SimProc object
26+
new_concrete_state.project.hook(0x405337,angr.procedures.libc.strstr)
27+
28+
29+
# Get 1 instruction from BB
30+
current_state.block(addr=act.ins_addr, num_inst=1).capstone.pp()
31+
32+
# Get a solution for a conditions over a variable
33+
# n is the number of solutions you want!
34+
state.solver._eval(data,n)
35+
36+
37+
# Create a BVV
38+
weird_nine = state.solver.BVV(9, 27)
39+
40+
41+
# Dump constraints
42+
next_state.solver.constraints
43+
44+
# Set a breakpoint on a specific instruction
45+
next_state.inspect.b('instruction', when=angr.BP_BEFORE, instruction= 0x40a75a)
46+
47+
# Drop all constraints
48+
next_state.solver._stored_solver.constraints = []
49+
next_state.solver.reload_solver()
50+
51+
#ERROR TROUBLESHOOTING
52+
53+
#==========================================
54+
#PROBLEM
55+
File "/home/degrigis/Projects/angr/angr-dev/claripy/claripy/backends/backend_z3.py", line 81, in _z3_decl_name_str
56+
AttributeError: module 'z3' has no attribute 'Z3_get_symbol_string_bytes'
57+
58+
#SOLUTION
59+
pip uninstall claripy && pip install -e ./claripy
60+
#==========================================
61+
62+
63+
64+

ctf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# quickly patch alarm and sleep in a file
2+
cat upload_center | sed 's/sleep/isinf/g' > upload_center.patched

docker

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
3+
# Fix permission error to connect to docker daemon
4+
# issue this command and reboot the machine
5+
sudo usermod -a -G docker $USER
6+
7+
8+
# Example of a DockerFile
9+
from ubuntu:latest
10+
copy example_1_nonet.bin /
11+
copy libc.so.6 /
12+
copy ld-linux-x86-64.so.2 /
13+
14+
entrypoint [ "/ld-linux-x86-64.so.2", "--library-path", "/", "/example_1_nonet.bin", "secret_of_life", "supersecretpassword" ]
15+
16+
17+
# Build a docker container given a DockerFile
18+
# give the folder that contains the DockerFile and all the binaries
19+
# you need.
20+
# This will give you a docker container id -> f.i. be3ced322578
21+
docker build example_1_nonet/
22+
23+
24+
# List all images
25+
docker image ls
26+
27+
# List all running containers
28+
docker container ls
29+
30+
# Run a container
31+
docker run c185416be9f3
32+
33+
# Run a container interactively
34+
docker run -it c185416be9f3
35+
36+
# Run a container and spawn a shell inside it
37+
# Remember to remove any entry_point in the DockerFile
38+
docker run -it c185416be9f3 bash
39+
40+
# Execute a command in a running container
41+
docker exec -it "id of running container" bash
42+
43+
# Remove a specific image
44+
docker rmi "id of image"
45+
46+
# Remove all images
47+
docker system prune

gdb

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# stop when eax has that value
3+
watch $eax == 0xdeadbeef
4+
5+
# set zero flag ( only with gef )
6+
edit-flags +zero
7+
8+
9+
# Displays list of threads
10+
info threads - Displays a list of threads
11+
12+
# Sets thread with ID of X to the selected thread
13+
thread X - Sets thread with ID of X to the selected thread
14+
15+
# Applies the command Y to a list of threads, for instance 'thread apply 3 4 step"
16+
thread apply X Y
17+
18+
# Applies the command Y to all active threads
19+
thread apply all Y

pwntools

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
# enable logs of data received and sent
3+
context.log_level = "DEBUG"
4+
5+
# create a process
6+
r = process("./baby_tcache")
7+
8+
# create a remote process
9+
conn = remote(sys.argv[1], sys.argv[2])
10+
11+
# send input to process
12+
r.sendline("1")
13+
14+
# read until a string
15+
r.readuntil("Your choice: ")
16+
17+
# attach gdb and set breakpoint at that address
18+
gdb.attach(r,'b* 0x0000555555554C6B')
19+
20+
# get an interactive session with gdb
21+
r.interactive()
22+
23+
# crafting shellcode assembly
24+
assembly = shellcraft.i386.linux.readfile("./flag", 1) + shellcraft.i386.linux.exit()
25+
26+
# converting asm to hex
27+
shellcode = asm(assembly, arch = 'i386', os = 'linux')
28+
29+
# getting a formatted p32 word
30+
stack_address_leak = output.split("\n")[2].split(" ")[-2] # getting the string
31+
stack_address_leak = int(stack_address_leak) # getting the integer associated
32+
p32(stack_address_leak) # format according to the architecture in the context
33+
34+
35+
36+

rr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# TO BUILD
2+
git clone [email protected]:mozilla/rr.git
3+
cd rr
4+
./configure
5+
make -j
6+
7+
# TO USE
8+
rr record -n <binary> [<arg1> ...]
9+
# -n means no syscall buffer, makes it easier to see what's happening when single stepping
10+
11+
rr replay [~/.local/share/rr/<replay_dir_you_wanna_see>]

wsym

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# WHAT'S THIS
2+
Adds symbols to an ELF file. Sort of the opposite of strip.
3+
4+
# TO SETUP
5+
git clone https://github.com/wapiflapi/wsym
6+
7+
8+
# TO USE
9+
python wsym.py -f ./symbols ./binary.bin ./binary_sym.bin
10+
# -f read the symbols from a file formatted in this way:
11+
#
12+
# 000000012c symbol_name
13+
# 000000055b symbol_name2
14+
15+
python wsym.py -i ./symbols.map ./binary.bin ./binary_sym.bin
16+
# -i read the symbols from an IDA .map file ( local and segments )
17+
# to export the .map from IDA:
18+
# File -> Produce -> .MAP file

0 commit comments

Comments
 (0)