+ TomcatJdbcController

This commit is contained in:
qi4L
2024-05-16 11:01:45 +08:00
parent cc44392ddd
commit 2302b0d48e
3 changed files with 192 additions and 19 deletions
@@ -2,7 +2,6 @@ package com.qi4l.jndi.controllers;
import com.qi4l.jndi.enumtypes.GadgetType;
import com.qi4l.jndi.exceptions.IncorrectParamsException;
import com.qi4l.jndi.exceptions.UnSupportedGadgetTypeException;
import com.qi4l.jndi.exceptions.UnSupportedPayloadTypeException;
import com.qi4l.jndi.gadgets.Config.Config;
import com.qi4l.jndi.gadgets.utils.Gadgets;
@@ -13,7 +12,6 @@ import com.unboundid.ldap.listener.interceptor.InMemoryInterceptedSearchResult;
import com.unboundid.ldap.sdk.Entry;
import com.unboundid.ldap.sdk.LDAPResult;
import com.unboundid.ldap.sdk.ResultCode;
import org.apache.commons.cli.CommandLine;
import org.apache.naming.ResourceRef;
import javax.naming.StringRefAddr;
@@ -25,18 +23,10 @@ import static org.fusesource.jansi.Ansi.ansi;
@LdapMapping(uri = {"/tomcatbypass"})
public class TomcatBypassController implements LdapController {
public static CommandLine cmdLine;
private String payloadType;
private String[] params;
private GadgetType gadgetType;
/**
* 发送LDAP ResourceRef结果和重定向URL
*
* @param result InMemoryInterceptedSearchResult类型的结果
* @param base 基本远程参考负载字符串
* @throws Exception 异常
*/
@Override
public void sendResult(InMemoryInterceptedSearchResult result, String base) throws Exception {
try {
@@ -86,14 +76,6 @@ public class TomcatBypassController implements LdapController {
}
}
/**
* 处理传入的参数 base
*
* @param base 传入的参数
* @throws UnSupportedPayloadTypeException 不支持的载荷类型异常
* @throws IncorrectParamsException 错误的参数异常
* @throws UnSupportedGadgetTypeException 不支持的 Gadget 类型异常
*/
@Override
public void process(String base) throws UnSupportedPayloadTypeException, IncorrectParamsException {
try {
@@ -108,7 +90,9 @@ public class TomcatBypassController implements LdapController {
} catch (IllegalArgumentException e) {
throw new UnSupportedPayloadTypeException("UnSupportedPayloadType : " + base.substring(fistIndex + 1, secondIndex));
}
int thirdIndex = base.indexOf("/", secondIndex + 1);
if (thirdIndex != -1) {
if (thirdIndex < 0) thirdIndex = base.length();
try {