# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from pyadb.adb import ADB try: adb = ADB() process = "com.android.chrome" activity = "com.google.android.apps.chrome.Main" print "@ Pushing files to /data/local/tmp ..." adb.sh("rm -rf /data/local/tmp/injector /data/local/tmp/libhook.so") adb.push("injector/injector", "/data/local/tmp/injector") adb.push("libhook/libhook.so", "/data/local/tmp/libhook.so") adb.sh("chmod 777 /data/local/tmp/injector") print "@ Starting %s/%s ..." % (process, activity) # we need to set selinux to permissive in order to make ptrace work adb.set_selinux_level("permissive") adb.clear_log() pid = adb.start_activity(process, activity) print "@ Injection into PID %d starting ..." % pid adb.sudo("/data/local/tmp/injector %d /data/local/tmp/libhook.so" % pid) adb.logcat("LIBHOOK")
from pyadb.adb import ADB import sys if len(sys.argv) != 2: print "Usage: python %s <pid>" % sys.argv[0] quit() pid = int(sys.argv[1]) try: adb = ADB() print "@ Pushing files to /data/local/tmp ..." adb.sh("rm -rf /data/local/tmp/injector /data/local/tmp/libElfHook.so") adb.push("libs/armeabi-v7a/injector", "/data/local/tmp/injector") adb.push("libs/armeabi-v7a/libElfHook.so", "/data/local/tmp/libElfHook.so") adb.sh("chmod 777 /data/local/tmp/injector") # we need to set selinux to permissive in order to make ptrace work adb.set_selinux_level(0) adb.clear_log() print "@ Injection into PID %d starting ..." % pid adb.sudo("/data/local/tmp/injector %d /data/local/tmp/libElfHook.so" % pid) adb.logcat("LIBHOOK") except KeyboardInterrupt: pass
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. from pyadb.adb import ADB try: adb = ADB() process = "com.android.chrome" activity = "com.google.android.apps.chrome.Main" print "@ Pushing files to /data/local/tmp ..." adb.sh( "rm -rf /data/local/tmp/injector /data/local/tmp/libhook.so" ) adb.push( "injector/injector", "/data/local/tmp/injector" ) adb.push( "libhook/libhook.so", "/data/local/tmp/libhook.so" ) adb.sh( "chmod 777 /data/local/tmp/injector" ) print "@ Starting %s/%s ..." % ( process, activity ) # we need to set selinux to permissive in order to make ptrace work adb.set_selinux_level( 0 ) adb.clear_log() pid = adb.start_activity( process, activity ) print "@ Injection into PID %d starting ..." % pid adb.sudo( "/data/local/tmp/injector %d /data/local/tmp/libhook.so" % pid ) adb.logcat("LIBHOOK")
from pyadb.adb import ADB import sys if len(sys.argv) != 2: print "Usage: python %s <pid>" % sys.argv[0] quit() pid = int(sys.argv[1]) try: adb = ADB() print "@ Pushing files to /data/local/tmp ..." adb.sh( "rm -rf /data/local/tmp/injector /data/local/tmp/libhook.so" ) adb.push( "libs/armeabi-v7a/injector", "/data/local/tmp/injector" ) adb.push( "libs/armeabi-v7a/libhook.so", "/data/local/tmp/libhook.so" ) adb.sh( "chmod 777 /data/local/tmp/injector" ) # we need to set selinux to permissive in order to make ptrace work adb.set_selinux_level( 0 ) adb.clear_log() print "@ Injection into PID %d starting ..." % pid adb.sudo( "/data/local/tmp/injector %d /data/local/tmp/libhook.so" % pid ) adb.logcat("LIBHOOK") except KeyboardInterrupt: pass