Skip to content

Instantly share code, notes, and snippets.

@ISTweak
Created September 17, 2014 13:38
Show Gist options
  • Save ISTweak/c84874169293de94e0e9 to your computer and use it in GitHub Desktop.
Save ISTweak/c84874169293de94e0e9 to your computer and use it in GitHub Desktop.
とりあえず動いたっぽい
--- C:/Android/app/android_get_essential_address/main.c Wed Sep 17 20:56:43 2014
+++ C:/Android/app/android_get_essential_address_/main.c Wed Sep 17 22:28:26 2014
@@ -9,7 +9,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
-
+#include <dlfcn.h>
#include <sys/system_properties.h>
#include "device_database.h"
#include "cred.h"
@@ -25,9 +25,11 @@
{
char device[PROP_VALUE_MAX];
char build_id[PROP_VALUE_MAX];
+ void *handle = dlopen("/system/lib/libcutils.so", RTLD_LAZY);
+ int (*property_get)(const char *key, char *value, const char *default_value) = dlsym(handle, "property_get");
- __system_property_get("ro.product.model", device);
- __system_property_get("ro.build.display.id", build_id);
+ property_get("ro.product.model", device, "");
+ property_get("ro.build.display.id", build_id, "");
printf("\n\nDevice detected: %s (%s)\n\n", device, build_id);
}
--- C:/Android/app/android_get_essential_address/Android.mk Wed Sep 17 20:56:43 2014
+++ C:/Android/app/android_get_essential_address_/Android.mk Wed Sep 17 22:34:24 2014
@@ -15,7 +15,6 @@
LOCAL_STATIC_LIBRARIES += libexploit
LOCAL_STATIC_LIBRARIES += libkallsyms
LOCAL_STATIC_LIBRARIES += libcutils libc
-LOCAL_LDFLAGS += -static
TOP_SRCDIR := $(abspath $(LOCAL_PATH))
TARGET_C_INCLUDES += \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment