|
1 | 1 | package com.drops.ui; |
2 | 2 |
|
3 | 3 | import com.drops.entity.ControllersFactory; |
| 4 | +import com.drops.utils.HTTPUtils; |
| 5 | +import com.drops.utils.LDAPUtil; |
| 6 | +import com.drops.utils.URLUtil; |
| 7 | +import com.drops.utils.Utils; |
| 8 | +import javafx.beans.value.ChangeListener; |
| 9 | +import javafx.beans.value.ObservableValue; |
4 | 10 | import javafx.collections.FXCollections; |
| 11 | +import javafx.collections.ObservableList; |
5 | 12 | import javafx.event.ActionEvent; |
6 | 13 | import javafx.fxml.FXML; |
7 | 14 | import javafx.geometry.Insets; |
@@ -31,17 +38,112 @@ public class MainController { |
31 | 38 | @FXML |
32 | 39 | private MenuItem proxySetupBtn; |
33 | 40 | public static Map currentProxy = new HashMap(); |
| 41 | + // 设置 目标地址 |
| 42 | + @FXML |
| 43 | + private TextField targetAddress; |
| 44 | + // 设置超时 |
| 45 | + @FXML |
| 46 | + private TextField httpTimeout; |
| 47 | + @FXML |
| 48 | + private TextField vps; |
| 49 | + @FXML |
| 50 | + private Button crackKeyBtn; |
| 51 | + @FXML |
| 52 | + private Button crackSpcKeyBtn; |
| 53 | + @FXML |
| 54 | + public ComboBox<String> gadgetOpt; |
| 55 | + @FXML |
| 56 | + public ComboBox<String> echoOpt; |
| 57 | + @FXML |
| 58 | + private Button crackGadgetBtn; |
| 59 | + @FXML |
| 60 | + private Button crackSpcGadgetBtn; |
| 61 | + @FXML |
| 62 | + public TextArea logTextArea; |
| 63 | + @FXML |
| 64 | + private Label proxyStatusLabel; |
| 65 | + @FXML |
| 66 | + private TextField exCommandText; |
| 67 | + @FXML |
| 68 | + public TextArea execOutputArea; |
| 69 | + @FXML |
| 70 | + private Button executeCmdBtn; |
| 71 | + @FXML |
| 72 | + public ComboBox<String> memShellOpt; |
| 73 | + @FXML |
| 74 | + private TextField shellPathText; |
| 75 | + @FXML |
| 76 | + private TextField shellPassText; |
| 77 | + @FXML |
| 78 | + private Button injectShellBtn; |
| 79 | + @FXML |
| 80 | + public TextArea InjOutputArea; |
| 81 | + |
| 82 | + LDAPUtil ldapUtil = null; |
34 | 83 |
|
35 | 84 |
|
36 | 85 |
|
37 | 86 | @FXML |
38 | 87 | void initialize() { |
39 | 88 | this.initToolbar(); |
40 | | -// this.initComBoBox(); |
| 89 | + this.initComBoBox(); |
41 | 90 | // this.initContext(); |
| 91 | + this.initConnect(); |
| 92 | +// this.initAttack(); |
42 | 93 | ControllersFactory.controllers.put(MainController.class.getSimpleName(), this); |
43 | 94 | } |
44 | 95 |
|
| 96 | + private void initAttack() { |
| 97 | + String target = this.targetAddress.getText(); |
| 98 | + String vps = this.vps.getText(); |
| 99 | + String timeout = this.httpTimeout.getText(); |
| 100 | + if (this.connect()){ |
| 101 | + |
| 102 | + } |
| 103 | + |
| 104 | + } |
| 105 | + |
| 106 | + private void initConnect() { |
| 107 | + this.vps.setText("1.116.32.76"); |
| 108 | + this.httpTimeout.setText("5"); |
| 109 | + this.targetAddress.setText("http://127.0.0.1:9092"); |
| 110 | + } |
| 111 | + |
| 112 | +// private void initContext() { |
| 113 | +// |
| 114 | +// } |
| 115 | + |
| 116 | + private void initComBoBox() { |
| 117 | + ObservableList<String> gadgets = FXCollections.observableArrayList(new String[]{ "SnakeYAMLRCE", "EurekaXstreamRCE", "JolokiaLogbackRCE", "JolokiaRealmRCE", "H2DatabaseConsoleJNDIRCE", "RestartH2DatabaseQueryRCE", "", ""}); |
| 118 | + this.gadgetOpt.setPromptText("SnakeYAMLRCE"); |
| 119 | + this.gadgetOpt.setValue("SnakeYAMLRCE"); |
| 120 | + this.gadgetOpt.setItems(gadgets); |
| 121 | + ObservableList<String> echoes =FXCollections.observableArrayList(new String[]{"TomcatEcho","SpringEcho"}); |
| 122 | + this.echoOpt.setPromptText("TomcatEcho"); |
| 123 | + this.echoOpt.setValue("TomcatEcho"); |
| 124 | + this.echoOpt.setItems(echoes); |
| 125 | + this.shellPassText.setText("cat666"); |
| 126 | + this.shellPathText.setText("/catcat66"); |
| 127 | + final ObservableList<String> memShells = FXCollections.observableArrayList(new String[]{"哥斯拉[Filter]", "蚁剑[Filter]", "冰蝎[Filter]", "NeoreGeorg[Filter]", "reGeorg[Filter]", "哥斯拉[Servlet]", "蚁剑[Servlet]", "冰蝎[Servlet]", "NeoreGeorg[Servlet]", "reGeorg[Servlet]"}); |
| 128 | + this.memShellOpt.setPromptText("冰蝎[Filter]"); |
| 129 | + this.memShellOpt.setValue("冰蝎[Filter]"); |
| 130 | + this.memShellOpt.setItems(memShells); |
| 131 | + this.memShellOpt.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { |
| 132 | + @Override |
| 133 | + public void changed(ObservableValue<? extends Number> observableValue, Number number, Number number2) { |
| 134 | + if (((String)memShells.get(number2.intValue())).contains("reGeorg")) { |
| 135 | + MainController.this.shellPassText.setDisable(true); |
| 136 | + } else { |
| 137 | + MainController.this.shellPassText.setDisable(false); |
| 138 | + } |
| 139 | + |
| 140 | + } |
| 141 | + }); |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + } |
| 146 | + |
45 | 147 | private void initToolbar() { |
46 | 148 | this.proxySetupBtn.setOnAction((event) -> { |
47 | 149 | Alert inputDialog = new Alert(Alert.AlertType.NONE); |
@@ -166,8 +268,36 @@ public void crackSpcGadgetBtn(ActionEvent actionEvent) { |
166 | 268 |
|
167 | 269 | public void crackGadgetBtn(ActionEvent actionEvent) { |
168 | 270 | } |
| 271 | + // 验证服务端是否配置成功 |
| 272 | + public boolean connect() { |
| 273 | + try { |
| 274 | + String vps = this.vps.getText(); |
| 275 | + if(!vps.isEmpty()){ |
| 276 | + |
| 277 | + // 判断http 服务是否生效 |
| 278 | + if(HTTPUtils.getRequest(vps + ":3456" ,"isOK.txt").getStatus() == 200){ |
| 279 | + this.logTextArea.appendText(Utils.log("HTTP Server Is OK!")); |
| 280 | + this.logTextArea.appendText(Utils.log("HTTP Server Is Working " + vps + " 的 3456 Port!")); |
| 281 | + // 判断 ldap 服务是否生效 |
| 282 | +// if(ldapUtil.sendLDAPRequest(vps)){ |
| 283 | +// this.logTextArea.appendText(Utils.log("LDAP Server Is OK!")); |
| 284 | +// this.logTextArea.appendText(Utils.log("LDAP Server Is Working " + vps + " 的 1389 Port!")); |
| 285 | +// return true; |
| 286 | +// }else { |
| 287 | +// this.logTextArea.appendText(Utils.log("LDAP Server 绑定 1389 端口失败!")); |
| 288 | +// this.logTextArea.appendText(Utils.log("请检查 " + vps + " 的 1389端口是否被占用!")); |
| 289 | +// } |
| 290 | + return true; |
| 291 | + }else { |
| 292 | + this.logTextArea.appendText(Utils.log("HTTP Server 绑定 3456 端口失败!")); |
| 293 | + this.logTextArea.appendText(Utils.log("请检查 " + vps + "的3456端口是否被占用!")); |
| 294 | + } |
| 295 | + } |
| 296 | + }catch (Exception e){ |
| 297 | + this.logTextArea.appendText(Utils.log(e.getMessage())); |
| 298 | + } |
169 | 299 |
|
170 | | - public void connect(ActionEvent actionEvent) { |
| 300 | + return false; |
171 | 301 | } |
172 | 302 |
|
173 | 303 | public void executeCmdBtn(ActionEvent actionEvent) { |
|
0 commit comments