-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOthersController.java
More file actions
257 lines (211 loc) · 8.34 KB
/
Copy pathOthersController.java
File metadata and controls
257 lines (211 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
package fun.fireline.controller;
import fun.fireline.core.Constants;
import fun.fireline.core.ExploitInterface;
import fun.fireline.core.Job;
import fun.fireline.core.VulCheckTask;
import fun.fireline.tools.Tools;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* @author yhy
* @date 2021/7/3 13:15
* @github https://github.com/yhy0
*/
// JavaFX图形化界面的控制类
public class OthersController extends MainController{
@FXML
private ChoiceBox<String> choice_cve;
@FXML
private ChoiceBox<String> encoding;
@FXML
private ChoiceBox<String> platform;
@FXML
private TextArea basic_info;
@FXML
private TextArea cmd_info;
@FXML
private TextField cmd;
@FXML
private TextArea upload_info;
@FXML
private TextField upload_path;
@FXML
private TextArea upload_msg;
@FXML
private TextField url;
private ExploitInterface ei;
public static String BASICINFO = Constants.SECURITYSTATEMENT +
"支持检测: \r\n" +
"\tF5-CVE-2021-22986: \tF5 BIG-IP/BIG-IQ iControl REST 未授权远程代码执行漏洞 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22986 \r\n" +
"\t用友NC-CNVD-2021-30167: \t \r\n" +
"\r\n" + Constants.UPDATEINFO;
public static String[] OTHERS = {
"all",
"F5-CVE-2021-22986",
"用友NC-CNVD-2021-30167",
};
// 界面显示 一些默认的基本信息,漏洞列表、编码选项、线程、shell、页脚
public void defaultInformation() {
this.choice_cve.setValue(OTHERS[0]);
for (String cve : OTHERS) {
this.choice_cve.getItems().add(cve);
}
this.encoding.setValue(Constants.ENCODING[0]);
for (String coding : Constants.ENCODING) {
this.encoding.getItems().add(coding);
}
// 默认为冰蝎3 的shell
this.upload_info.setText(Constants.SHELL);
this.upload_info.setWrapText(true);
// 命令执行
this.cmd_info.setText(" ");
this.cmd_info.setWrapText(true);
this.upload_msg.setText("默认为 冰蝎3 Bate 11 的shell.jsp , 密码:rebeyond");
this.platform.setValue("Linux");
this.platform.getItems().add("Linux");
this.platform.getItems().add("Windows");
}
// 基本信息
public void basic() {
// 切换界面保留原来的记录
// 基本信息的历史记录
if(history.containsKey("Others_url")) {
this.url.setText((String) history.get("Others_url"));
}
if(history.containsKey("Others_vulName")) {
this.choice_cve.setValue((String) history.get("Others_vulName"));
}
if(history.containsKey("Others_ei")) {
this.ei = (ExploitInterface) history.get("Others_ei");
}
if(history.containsKey("Others_basic_info")) {
this.basic_info.setText((String) history.get("Others_basic_info"));
} else {
this.basic_info.setText(BASICINFO);
}
this.basic_info.setWrapText(true);
// 命令执行的历史记录
if(history.containsKey("Others_cmd")) {
this.cmd.setText((String) history.get("Others_cmd"));
}
if(history.containsKey("Others_encoding")) {
this.encoding.setValue((String) history.get("Others_encoding"));
}
if(history.containsKey("Others_cmd_info")) {
this.cmd_info.setText((String) history.get("Others_cmd_info"));
}
// 文件上传的历史记录
if(history.containsKey("Others_upload_info")) {
this.upload_info.setText((String) history.get("Others_upload_info"));
}
if(history.containsKey("Others_upload_path")) {
this.upload_path.setText((String) history.get("Others_upload_path"));
}
if(history.containsKey("Others_platform")) {
this.platform.setValue((String) history.get("Others_platform"));
}
if(history.containsKey("Others_upload_msg")) {
this.upload_msg.setText((String) history.get("Others_upload_msg"));
}
}
// 点击检测,获取url 和 要检测的漏洞
@FXML
public void check() {
String url = Tools.urlParse(this.url.getText().trim());
history.put("Others_url", this.url.getText());
String vulName = this.choice_cve.getValue().toString().trim();
history.put("Others_vulName", this.choice_cve.getValue());
try {
if (vulName.equals("all")) {
this.basic_info.setText("");
for (String vul : this.choice_cve.getItems()) {
if (!vul.equals("all")) {
VulCheckTask vulCheckTask = new VulCheckTask(this.url.getText(), vul);
vulCheckTask.messageProperty().addListener((observable, oldValue, newValue) -> {
this.basic_info.appendText("\t" + newValue + "\r\n\r\n");
if(newValue.contains("目标存在")) {
this.choice_cve.setValue(vul);
this.ei = Tools.getExploit(vul);
this.ei.checkVul(url);
}
});
(new Thread(vulCheckTask)).start();
}
}
} else {
this.ei = Tools.getExploit(vulName);
String result = this.ei.checkVul(url);
this.basic_info.setText("\r\n\t" + result + "\r\n\r\n\twebPath:\r\n\t\t" + this.ei.getWebPath());
}
} catch (Exception e) {
this.basic_info.setText("\r\n\t检测异常 \r\n\t\t\t" + e.toString());
}
history.put("Others_ei", this.ei);
history.put("Others_basic_info", this.basic_info.getText());
}
// 命令执行
@FXML
public void get_execute_cmd() {
String cmd = this.cmd.getText();
String encoding = this.encoding.getValue().toString().trim();
history.put("Others_cmd", this.cmd.getText());
history.put("Others_encoding", this.encoding.getValue());
if(cmd.length() == 0) {
cmd = "whoami";
}
try {
if(this.ei.isVul()) {
String result = this.ei.exeCmd(cmd, encoding);
this.cmd_info.setText(result);
} else {
this.cmd_info.setText("请先进行漏洞检测,确认漏洞存在");
}
} catch (Exception var4) {
this.cmd_info.setText("请先进行漏洞检测,确认漏洞存在\r\n");
this.cmd_info.appendText("error: " + var4.toString());
}
history.put("Others_cmd_info", this.cmd_info.getText());
}
// 点击上传文件,获取上传的文件信息
@FXML
public void get_shell_file() {
String shell_info = this.upload_info.getText();
String upload_path = this.upload_path.getText();
String platform = this.platform.getValue().toString().trim();
history.put("Others_upload_info", this.upload_info.getText());
history.put("Others_upload_path", this.upload_path.getText());
history.put("Others_platform", this.platform.getValue());
if(upload_path.length() == 0) {
upload_path = "test.jsp";
}
if(shell_info.length() > 0) {
if(this.ei.isVul()) {
try {
String result = this.ei.uploadFile(shell_info, upload_path, platform);
this.upload_msg.setText(result);
} catch (Exception var4) {
this.upload_msg.setText(var4.toString());
}
} else {
this.upload_msg.setText("文件上传失败!");
}
history.put("Others_upload_msg", this.upload_msg.getText());
} else {
Tools.alert("文件上传", "上传的文件不能为空");
}
}
// 加载
public void initialize() {
try {
this.defaultInformation();
this.basic();
} catch (Exception e) {
e.printStackTrace();
}
}
}