Android Open Source - android-ssl-bypass Jython Plugin Service






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  .java 2 s.  c  o m*/
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;

import org.apache.log4j.Logger;
import org.python.util.PythonInterpreter;

public class JythonPluginService extends AbstractPluginService {
  private final static org.apache.log4j.Logger LOGGER = Logger
      .getLogger(JythonPluginService.class.getName());

  private static JythonPluginService pluginService = null;
  private Iterator<JDIPlugin> plugins = null;

  private JythonPluginService(File dir) {
    super(dir);
  }

  public static JythonPluginService getInstance(File dir) {
    //not really working as singleton because not reloading when load plugins is called again ...
    JythonPluginService.pluginService = new JythonPluginService(dir);
    return JythonPluginService.pluginService;
  }

  public Object getJythonObject(String interfaceName,
      String pathToJythonModule) {

    Object javaInt = null;
    PythonInterpreter interpreter = new PythonInterpreter();
    interpreter.execfile(pathToJythonModule);

    int start = pathToJythonModule.lastIndexOf(File.separator) + 1;
    int end = pathToJythonModule.lastIndexOf(".");
    String tempName = pathToJythonModule.substring(start, end);
    LOGGER.info("tempname: " + tempName);
    String javaClassName = tempName;
    String instanceName = tempName.toLowerCase();
    String objectDef = "=" + javaClassName + "()";
    interpreter.exec(instanceName + objectDef);
    try {
      Class JavaInterface = Class.forName(interfaceName);
      javaInt = interpreter.get(instanceName).__tojava__(JavaInterface);
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace(); // Add logging here
    }

    return javaInt;
  }

  @Override
  public Iterator<JDIPlugin> getPlugins() {
    ArrayList<JDIPlugin> pluginsArray = new ArrayList<JDIPlugin>();
    for (File f : this.pluginsDir.listFiles()) {
      if (f.getAbsolutePath().endsWith(".py")) {
        JDIPlugin plugin = (JDIPlugin) this.getJythonObject(
            JDIPlugin.class.getName(), f.getAbsolutePath());
        pluginsArray.add(plugin);
      }
    }
    return this.plugins = pluginsArray.iterator();
  }
}




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