From 1a0a1376957ca54113ad036b8fcaa386d017fc7c Mon Sep 17 00:00:00 2001 From: jam1garner Date: Tue, 11 Feb 2020 17:52:47 -0500 Subject: [PATCH] Set Makefiles to use 'python' if 'python3' not present --- Makefile | 8 ++++++-- homebrew/Makefile | 12 ++++++++---- kexploit/Makefile | 10 +++++++--- poc/Makefile | 12 ++++++++---- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index e3041d7..db61c7b 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ -python := python3 +PYTHON := python3 +ifeq (, $(shell which python3)) + # if no python3 alias, fall back to `python` and hope it's py3 + PYTHON := python +endif EXPLOIT_DIR := homebrew EXPLOIT_PATH := $(EXPLOIT_DIR)/exploit.mscsb homebrew: $(EXPLOIT_PATH) - $(python) inject.py $< + $(PYTHON) inject.py $< clean: rm -r data diff --git a/homebrew/Makefile b/homebrew/Makefile index fccdcef..a0c2fdf 100644 --- a/homebrew/Makefile +++ b/homebrew/Makefile @@ -1,4 +1,8 @@ -python=python3 +PYTHON := python3 +ifeq (, $(shell which python3)) + # if no python3 alias, fall back to `python` and hope it's py3 + PYTHON := python +endif all: exploit.mscsb @@ -6,15 +10,15 @@ clean: rm -f exploit.mscsb payload.s payload.bin main.s exploit.mscsb: payload.s Scripts main.s - $(python) ../pymsc/asm.py + $(PYTHON) ../pymsc/asm.py payload.s: payload.bin - $(python) generate_payload.py + $(PYTHON) generate_payload.py payload.bin: crashText.txt cp -f crashText.txt payload.bin printf "\0" >> payload.bin main.s: rop_setup.s - $(python) generate_rop.py + $(PYTHON) generate_rop.py diff --git a/kexploit/Makefile b/kexploit/Makefile index b5ea3ca..54851b3 100644 --- a/kexploit/Makefile +++ b/kexploit/Makefile @@ -1,7 +1,11 @@ wiiuhaxx_common_path := ../wiiuhaxx_common/wiiu_browserhax_common.php wiiuhaxx_common_cfg := wiiuhaxx_common_cfg.php pymsc_asm_py := ../pymsc/asm.py -python=python3 +PYTHON := python3 +ifeq (, $(shell which python3)) + # if no python3 alias, fall back to `python` and hope it's py3 + PYTHON := python +endif all: clean exploit.mscsb @@ -9,10 +13,10 @@ clean: rm -f exploit.mscsb payload.s main.s exploit.mscsb: $(pymsc_asm_py) payload.s Scripts main.s - $(python) ../pymsc/asm.py + $(PYTHON) ../pymsc/asm.py payload.s: payload.bin - $(python) generate_payload.py + $(PYTHON) generate_payload.py main.s: rop_setup.s $(wiiuhaxx_common_cfg) $(wiiuhaxx_common_path) php generatepayload.php > main.s diff --git a/poc/Makefile b/poc/Makefile index fccdcef..a0c2fdf 100644 --- a/poc/Makefile +++ b/poc/Makefile @@ -1,4 +1,8 @@ -python=python3 +PYTHON := python3 +ifeq (, $(shell which python3)) + # if no python3 alias, fall back to `python` and hope it's py3 + PYTHON := python +endif all: exploit.mscsb @@ -6,15 +10,15 @@ clean: rm -f exploit.mscsb payload.s payload.bin main.s exploit.mscsb: payload.s Scripts main.s - $(python) ../pymsc/asm.py + $(PYTHON) ../pymsc/asm.py payload.s: payload.bin - $(python) generate_payload.py + $(PYTHON) generate_payload.py payload.bin: crashText.txt cp -f crashText.txt payload.bin printf "\0" >> payload.bin main.s: rop_setup.s - $(python) generate_rop.py + $(PYTHON) generate_rop.py