diff --git a/content/secu_logicielle/td5-stackoverflow_shellcode/files/q3/Makefile b/content/secu_logicielle/td5-stackoverflow_shellcode/files/q3/Makefile index 8dd34dd..1507d49 100644 --- a/content/secu_logicielle/td5-stackoverflow_shellcode/files/q3/Makefile +++ b/content/secu_logicielle/td5-stackoverflow_shellcode/files/q3/Makefile @@ -27,15 +27,30 @@ $(BUILD_DIR)/%: %.S build: $(addprefix $(BUILD_DIR)/, $(TGT)) -PHONY: gdb -gdb: build/shellcode configure +PHONY: gdb_shellcode +gdb_shellcode: build/shellcode configure PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \ setarch -R gdb ./$(BUILD_DIR)/shellcode +PHONY: gdb_anodin +gdb_anodin: build/anodin configure + PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \ + setarch -R gdb ./$(BUILD_DIR)/anodin + +PHONY: gdb_exploit +gdb_exploit: build/exploit build/anodin configure +ifeq ($(A_ADDR),) + $(error A_ADDR must be defined, launch setarch -R gdb ./build/anodin to retriece it) +endif + echo '$(A_ADDR)' | ./$(BUILD_DIR)/exploit > hack.txt + PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \ + setarch -R gdb ./$(BUILD_DIR)/anodin --command=anodin.gdb + rm hack.txt + PHONY: opcode opcode: build/shellcode readelf -x .text build/shellcode | sed -e '$$ d' -e '1,2 d' \ - | awk '{$$1=$$6=""; print $$0}' \ + | awk -F ' ' '{$$1=$$6=""; print $$0}' \ | tr -d '[ \n]' \ | sed 's/../0x&,/g' > opcode.txt