Android Open Source - android-ssl-bypass Control






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;
/*from   ww  w  .  ja va 2  s.  c o m*/
import java.util.ArrayList;

import org.apache.log4j.Logger;

import com.isecpartners.android.jdwp.common.Message;
import com.isecpartners.android.jdwp.common.QueueAgent;
import com.isecpartners.android.jdwp.connection.NoAttachingConnectorException;
import com.isecpartners.android.jdwp.pluginservice.JDIPlugin;

public class Control extends QueueAgent {
  private final static org.apache.log4j.Logger LOGGER = Logger
      .getLogger(Control.class.getName());
  private static final String DEFAULT_HOST = "localhost";
  private String host = null;
  private String port = null;
  private VirtualMachineSession vmSession = null;
  private boolean connected = false;
  private ArrayList<JDIPlugin> vmHandlers = new ArrayList<JDIPlugin>();

  public Control(String host, String port, ArrayList<JDIPlugin> vmHandlers) {
    this.host = host;
    this.port = port;
    this.vmHandlers  = vmHandlers;
  }
  
  public Control(String port, ArrayList<JDIPlugin> handlerPlugins) {
    this.host = DEFAULT_HOST;
    this.port = port;
    this.vmHandlers  = handlerPlugins;
  }

  public boolean isConnected(){
    return this.connected;
  }

  @Override
  public void run() {
    boolean done = false;
    try {
      
      this.vmSession = new VirtualMachineSession(this.host, this.port,
          this.vmHandlers);
      this.setQueueAgentListener(this.vmSession);
      
      Control.LOGGER.info("starting debugger session");
      this.vmSession.start();

      this.sendMessage(new Message(Message.Type.CONNECT, "attempting to start new vm session"));
      while (!done) {
        Message msg;
        try {
          msg = this.getMessage();

          switch (msg.getType()) {
          case SESSION_STARTED:
            Control.LOGGER
                .info("VM successfully connected, session starting ...");
            this.connected  = true;
            break;
            
          case DISCONNECTED:
            Control.LOGGER.info("VM disconected, quitting: " + msg.getObject());
            this.connected = false;
            // could also wait for it to start again?
            done = true;
            break;

          case OUTPUT:
            LOGGER.info("got message: " + msg.getObject());
            //TODO this might cause problems - not really thread safe right?
            System.out.println(msg.getObject());
            break;
            
          default:
            Control.LOGGER.info("got message:"
                + msg.getType().name());
            break;

          }
        } catch (InterruptedException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
          done = true;
        }
      }

    } catch (NoAttachingConnectorException e) {
      Control.LOGGER
          .error("NoAttachingConnectorException: currently only supports attaching connector.");

    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

  }

  public ArrayList<JDIPlugin> getPlugins() throws NoVMSessionException {
    if(this.vmSession == null){
      throw new NoVMSessionException();
    }
    return this.vmSession.getPlguins();
  }

  public VirtualMachineEventManager getVMEM() throws NoVMSessionException {
    if(this.vmSession == null){
      throw new NoVMSessionException();
    }
    return this.vmSession.getVMEventManager();
  }

  public void setHandlerPlugins(ArrayList<JDIPlugin> handlerPlugins) {
    this.vmHandlers = handlerPlugins;
  }
}




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