Android Open Source - android-ssl-bypass Abstract J D I Plugin






From Project

Back to project page android-ssl-bypass.

License

The source code is released under:

Copyright (c) 2012, iSEC Partners. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the ...

If you think the Android project android-ssl-bypass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.isecpartners.android.jdwp.pluginservice;
/* ww  w. j av  a2  s .com*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.isecpartners.android.jdwp.LocationNotFoundException;
import com.isecpartners.android.jdwp.ReferenceTypeNotFoundException;
import com.isecpartners.android.jdwp.VirtualMachineEventManager;
import com.isecpartners.android.jdwp.common.Message;
import com.isecpartners.android.jdwp.common.QueueAgent;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.event.Event;
import com.sun.jdi.request.BreakpointRequest;
import com.sun.jdi.request.ClassPrepareRequest;
import com.sun.jdi.request.EventRequest;
import com.sun.jdi.request.MethodEntryRequest;
import com.sun.jdi.request.MethodExitRequest;
import com.sun.jdi.request.StepRequest;

public abstract class AbstractJDIPlugin extends QueueAgent implements JDIPlugin {
  private final static org.apache.log4j.Logger LOGGER = Logger
      .getLogger(AbstractJDIPlugin.class.getName());

  protected static final String DEFAULT_JAVA_PLUGIN_DIR = "plugins";

  protected Event currentEvent = null;
  protected ArrayList<EventRequest> eventRequestList = new ArrayList<EventRequest>();
  protected boolean mDone = false;

  protected String name = null;

  protected Properties properties = new Properties();

  protected String propsPath = null;

  protected VirtualMachineEventManager vmem = null;

  protected String basePath = null;

  private File propsFile = null;

  public AbstractJDIPlugin(String name){
    this.name = name;
    String fname = DEFAULT_JAVA_PLUGIN_DIR + File.separator
        + this.name + ".prop";
    this.propsFile = new File(fname);
    FileInputStream fis;
    try {
      fis = new FileInputStream(this.propsFile);
      this.properties.load(fis);
    } catch (FileNotFoundException e) {
      LOGGER.error("could not load properties file, may cause problems for plugins that require it!");
      LOGGER.error(e.toString());
    } catch (IOException e) {
      LOGGER.error("could not load properties file, may cause problems for plugins that require it!");
      LOGGER.error(e.toString());
    }
    
  }
  
  public void output(String message){
    LOGGER.info(message);
    try {
      this.sendMessage(new Message(Message.Type.OUTPUT,message));
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  
  public void createBreakpointRequest(String locationString)
      throws LocationNotFoundException {

    BreakpointRequest req = this.vmem.createBreakpointRequest(
        locationString, this);
    this.eventRequestList.add(req);
  }

  public void createClassPrepareRequest(String classFilter)
      throws LocationNotFoundException, ReferenceTypeNotFoundException {
    ClassPrepareRequest req = this.vmem.createClassPrepareRequest(
        classFilter, this);
    this.eventRequestList.add(req);
  }

  public void createMethodEntryRequest(String classFilter)
      throws LocationNotFoundException, ReferenceTypeNotFoundException {
    MethodEntryRequest req = this.vmem.createMethodEntryRequest(
        classFilter, this);
    this.eventRequestList.add(req);
  }

  public void createMethodExitRequest(String classFilter)
      throws LocationNotFoundException, ReferenceTypeNotFoundException {
    MethodExitRequest req = this.vmem.createMethodExitRequest(classFilter,
        this);
    this.eventRequestList.add(req);
  }

  public void createStepRequest(ThreadReference tr, int depth, int type)
      throws LocationNotFoundException {
    StepRequest req = this.vmem.createStepRequest(tr, depth, type, this);
    this.eventRequestList.add(req);
  }

  public Event getCurrentEvent() {
    return this.currentEvent;
  }

  @Override
  public String getPluginName() {
    return this.name;
  }

  @Override
  public abstract void handleEvent(Event event);

  @Override
  public void init(VirtualMachineEventManager vmem, String path)
      throws LocationNotFoundException, FileNotFoundException,
      IOException {
    this.vmem = vmem;
    this.basePath = path;
    this.propsPath = path + File.separator + this.getPluginName() + ".prop";
    
    URL pathURL = ClassLoader.getSystemResource(this.propsPath);
    if(pathURL != null) {
         this.propsFile = new File(pathURL.getPath());
    }
    this.setupEvents();
  }

  public void resumeEventSet() {
    this.vmem.resumeEventSet();
  }

  public void setCurrentEvent(Event currentEvent) {
    this.currentEvent = currentEvent;
  }

  @Override
  public abstract void setupEvents();

  @Override
  public void tearDownEvents() {
    for (EventRequest ereq : this.eventRequestList) {
      this.vmem.deleteEventRequest(ereq);
    }
  }

  @Override
  public String toString() {
    return this.name;
  }

}




Java Source Code List

com.isec.helperapp.EasySSLSocketFactory.java
com.isec.helperapp.EasyX509TrustManager.java
com.isec.helperapp.MainActivity.java
com.isec.helperapp.TrustAllTrustManager.java
com.isec.ssltest.SSLTestActivity.java
com.isecpartners.android.jdwp.ADBInterface.java
com.isecpartners.android.jdwp.ClassLoaderUtils.java
com.isecpartners.android.jdwp.ClassWrapper.java
com.isecpartners.android.jdwp.CommandLine.java
com.isecpartners.android.jdwp.Constants.java
com.isecpartners.android.jdwp.Control.java
com.isecpartners.android.jdwp.DalvikUtils.java
com.isecpartners.android.jdwp.DexClassLoaderNotFoundException.java
com.isecpartners.android.jdwp.LocationNotFoundException.java
com.isecpartners.android.jdwp.NoLoadClassMethodException.java
com.isecpartners.android.jdwp.NoVMSessionException.java
com.isecpartners.android.jdwp.NotImplementedException.java
com.isecpartners.android.jdwp.ReferenceTypeNotFoundException.java
com.isecpartners.android.jdwp.VirtualMachineEventManager.java
com.isecpartners.android.jdwp.VirtualMachineSession.java
com.isecpartners.android.jdwp.common.Message.java
com.isecpartners.android.jdwp.common.QueueAgentInterface.java
com.isecpartners.android.jdwp.common.QueueAgent.java
com.isecpartners.android.jdwp.connection.AbstractConnection.java
com.isecpartners.android.jdwp.connection.AttachingConnection.java
com.isecpartners.android.jdwp.connection.DVMConnectionProvider.java
com.isecpartners.android.jdwp.connection.DefaultConnectionFactory.java
com.isecpartners.android.jdwp.connection.NoAttachingConnectorException.java
com.isecpartners.android.jdwp.connection.NoListeningConnectorException.java
com.isecpartners.android.jdwp.plugin.JythonConsoleJDIPlugin.java
com.isecpartners.android.jdwp.plugin.SSLBypassJDIPlugin.java
com.isecpartners.android.jdwp.plugin.TestJDIPlugin.java
com.isecpartners.android.jdwp.plugin.TraceMethodsJDIPlugin.java
com.isecpartners.android.jdwp.pluginservice.AbstractJDIPlugin.java
com.isecpartners.android.jdwp.pluginservice.AbstractJythonConsolePlugin.java
com.isecpartners.android.jdwp.pluginservice.AbstractPluginService.java
com.isecpartners.android.jdwp.pluginservice.ClasspathUtils.java
com.isecpartners.android.jdwp.pluginservice.JDIPluginServiceFactory.java
com.isecpartners.android.jdwp.pluginservice.JDIPluginService.java
com.isecpartners.android.jdwp.pluginservice.JDIPlugin.java
com.isecpartners.android.jdwp.pluginservice.JythonPluginServiceFactory.java
com.isecpartners.android.jdwp.pluginservice.JythonPluginService.java
com.isecpartners.android.jdwp.pluginservice.PluginNotFoundException.java
com.isecpartners.android.jdwp.pluginservice.PluginService.java