You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.7 KiB

  1. # Must be configured by the user
  2. ANDROID_NDK := /opt/android-ndk
  3. # Constants and makefile shit used in build
  4. mkfile_path = $(abspath $(lastword $(MAKEFILE_LIST)))
  5. current_dir = $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
  6. ## NDK configuration.
  7. PLATFORM_VERSION = 19
  8. NDK_ARCH = arm
  9. NDK_ABI = linux-androideabi
  10. NDK = $(ANDROID_NDK)
  11. NDK_COMP_VER = 4.9
  12. NDK_HOSTARCH = linux-x86_64
  13. NDK_TOOLS = $(NDK)/toolchains/$(NDK_ARCH)-$(NDK_ABI)-$(NDK_COMP_VER)/prebuilt/$(NDK_HOSTARCH)/bin
  14. NDK_SYSROOT = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)
  15. NDK_INC = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)/usr/include
  16. NDK_LIB = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)/usr/lib
  17. ## Compiler and compilation flags
  18. CC = $(NDK_TOOLS)/$(NDK_ARCH)-$(NDK_ABI)-gcc
  19. CFLAGS = --sysroot=$(NDK_SYSROOT) -fPIE -pie -mthumb -O3 -DNO_SECCOMP -I$(NDK_INC) \
  20. -std=gnu99 -Wall -Werror
  21. LDFLAGS = --sysroot=$(NDK_SYSROOT) -fPIE -pie
  22. # Exploit
  23. OUT = $(current_dir)/Out/Bin
  24. RADAMSA_SRC = src
  25. all: clone bin
  26. .PHONY: all radamsa.c
  27. clone:
  28. git clone https://github.com/aoh/radamsa.git $(RADAMSA_SRC)
  29. #Checkout revision to make sure whole solution compiles
  30. cd src && git checkout 1a9cc03fda47dd3706ef69f4ad971f66b273a324
  31. radamsa.c:
  32. $(MAKE) -C $(RADAMSA_SRC) radamsa.c
  33. patch -p1 < android.patch
  34. bin: radamsa.c
  35. mkdir -p $(OUT)
  36. $(CC) $(CFLAGS) -o $(OUT)/radamsa.o -c $(RADAMSA_SRC)/radamsa.c
  37. $(CC) $(LDFLAGS) -o $(OUT)/radamsa $(OUT)/radamsa.o -ldl
  38. clean:
  39. rm -rf $(OUT)
  40. rm -rf $(RADAMSA_SRC)
  41. push:
  42. adb push $(OUT)/radamsa /data/app/