Skip to content

Commit 90627ee

Browse files
committed
V1.4 修复第三方包没引入造成的fofa搜索无结果的bug
1 parent 5194f77 commit 90627ee

14 files changed

+219
-77
lines changed

META-INF/MANIFEST.MF

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Manifest-Version: 1.4
2+
Class-Path: lib/fastjson-1.2.76.jar lib/guava-19.0.jar
3+
Main-Class: com.yhy.Main
4+

.idea/uiDesigner.xml

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

ExpDemo-JavaFX.iml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module type="JAVA_MODULE" version="4" />
2+
<module type="JAVA_MODULE" version="8" />

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## 更新
22

3+
### V1.4
4+
5+
修复生成的jar文件,fofa查询时无反应(mvn生成jar时没有加载第三方包,添加MANIFEST.MF文件指定加载)
6+
37
### V1.3
48

59
1. 增加fofa查询模块,并且fofa高级会员可以通过输入icon的url,计算hash值,查询相同icon的网站

fofa.conf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[email protected]:fdbcccdbeb87421ce408ccdf868ce86b

lib/fastjson-1.2.76.jar

643 KB
Binary file not shown.

lib/guava-19.0.jar

2.2 MB
Binary file not shown.

pom.xml

+15-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<groupId>com.yhy</groupId>
88
<artifactId>ExpDemo-JavaFX</artifactId>
99
<packaging>jar</packaging>
10-
<version>1.3</version>
10+
<version>1.4</version>
1111

1212
<name>ExpDemo-JavaFX</name>
1313
<!-- FIXME change it to the project's website -->
14-
<url>https://github.com/yhy0</url>
14+
<url>https://github.com/yhy0/ExpDemo-JavaFX</url>
1515

1616
<properties>
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -35,18 +35,26 @@
3535
<artifactId>javafx-fxml</artifactId>
3636
<version>11.0.2</version>
3737
</dependency>
38-
<dependency>
39-
<groupId>org.json</groupId>
40-
<artifactId>json</artifactId>
41-
<version>20160212</version>
42-
</dependency>
4338

4439
<dependency>
4540
<groupId>com.google.guava</groupId>
4641
<artifactId>guava</artifactId>
4742
<version>19.0</version>
4843
</dependency>
4944

45+
46+
<dependency>
47+
<groupId>com.alibaba</groupId>
48+
<artifactId>fastjson</artifactId>
49+
<version>1.2.76</version>
50+
</dependency>
51+
52+
<dependency>
53+
<groupId>org.springframework</groupId>
54+
<artifactId>spring-core</artifactId>
55+
<version>4.1.6.RELEASE</version>
56+
</dependency>
57+
5058
</dependencies>
5159

5260
<build>

src/main/java/com/yhy/Controller.java

+30-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.yhy;
22

3+
import com.alibaba.fastjson.JSONObject;
34
import com.google.common.hash.Hashing;
45
import com.yhy.core.Constants;
56
import com.yhy.core.ExploitInterface;
@@ -21,7 +22,6 @@
2122
import javafx.scene.input.ClipboardContent;
2223
import javafx.scene.layout.GridPane;
2324
import javafx.scene.layout.HBox;
24-
import javafx.scene.layout.Region;
2525
import javafx.scene.text.Text;
2626
import javafx.stage.FileChooser;
2727
import javafx.stage.Stage;
@@ -34,9 +34,7 @@
3434
import java.net.PasswordAuthentication;
3535
import java.net.Proxy;
3636
import java.nio.charset.StandardCharsets;
37-
import java.util.HashMap;
38-
import java.util.HashSet;
39-
import java.util.Map;
37+
import java.util.*;
4038
import java.util.concurrent.ExecutorService;
4139
import java.util.concurrent.Executors;
4240
import java.util.concurrent.Future;
@@ -484,7 +482,7 @@ public void get_execute_cmd() {
484482
this.cmd_info.setText(result);
485483
System.out.println(result);
486484
} catch (Exception var4) {
487-
this.cmd_info.setText(var4.toString());
485+
this.cmd_info.setText("error: " + var4.toString());
488486
}
489487

490488
}
@@ -655,19 +653,19 @@ public void export() {
655653
@FXML
656654
// fofa 搜索
657655
public void fofa_search() {
656+
String result = "";
657+
try {
658+
int page = (int) this.fofa_size.getValue();
658659

659-
int page = (int) this.fofa_size.getValue();
660+
String fofa_info = this.fofa_info.getText();
660661

661-
String fofa_info = this.fofa_info.getText();
662+
if(fofa_info.length() == 0) {
663+
fofa_info = "app=\"Solr\"";
664+
}
662665

663-
if(fofa_info.length() == 0) {
664-
fofa_info = "app=\"Solr\"";
665-
}
666+
File file = new File(Constants.FOFAPATH);
666667

667-
String result = "";
668668

669-
File file = new File(Constants.FOFAPATH);
670-
try {
671669
if (file.exists()) {
672670
String values = Tools.read(Constants.FOFAPATH,"UTF-8", false).toString();
673671
values = values.substring(1,values.length()-1);;
@@ -677,11 +675,20 @@ public void fofa_search() {
677675
if(EmaliKey.length == 2) {
678676
String email = EmaliKey[0];
679677
String key = EmaliKey[1];
680-
result = Tools.fofaHTTP(email, key, fofa_info, page);
681678

682-
String[] str = result.split("\r\n");
683-
for (String s:str) {
684-
fofa_result.add(s);
679+
680+
String fResult = Tools.fofaHTTP(email, key, fofa_info, page, fofa_result_info);
681+
682+
// 不清楚为啥生成的jar文件,这里json不能解析,也不报错,在IDEA中运行就可以
683+
JSONObject object = (JSONObject) JSONObject.parse(fResult);
684+
List<String> listStr = object.parseArray(object.getJSONArray("results").toJSONString(), String.class);
685+
686+
for (String s:listStr) {
687+
s = s.replace("\"","").replace("\\r\\n","").replace("\\t","");
688+
String host = s.split(",", 2)[0].replace("[","");
689+
String title = s.split(",", 2)[1].replace("]","");
690+
result += host + "\t\t\t" + title + "\r\n";
691+
this.fofa_result.add(host);
685692
}
686693

687694
this.proxyStatusLabel.setText("fofa查询完成");
@@ -693,23 +700,28 @@ public void fofa_search() {
693700
alert.setContentText("fofa 配置错误\n");
694701

695702
alert.showAndWait();
703+
704+
this.proxyStatusLabel.setText("asasdadas配置错误");
696705
}
706+
} else {
707+
this.fofa_result_info.setText("fofa.conf文件没找到!!!!!\r\n");
697708
}
698709

699710

700711
} catch (Exception e) {
701712
e.printStackTrace();
702713
result = e.getStackTrace().toString();
714+
703715
}
704716

717+
this.fofa_result_info.setText(result);
705718

706719
fofa_check.setOnAction((e) -> {
707720
table_view(fofa_result);
708721
this.proxyStatusLabel.setText("批量检查完成,请到批量检查界面查看");
709722

710723
});
711724

712-
this.fofa_result_info.setText(result);
713725

714726
}
715727

@@ -737,17 +749,10 @@ public void fofa_icon() {
737749

738750

739751
iconHash.setOnAction((e) -> {
740-
741752
String ste = HttpTool.ImageToBase64ByOnline(iconUrlText.getText());
742-
743753
int hashcode = Hashing.murmur3_32().hashString(ste.replaceAll("\r", "") + "\n", StandardCharsets.UTF_8).asInt();
744-
745754
iconHashText.setText("icon_hash=\"" + hashcode + "\"");
746755

747-
748-
System.out.println(ste);
749-
System.out.println(hashcode);
750-
751756
});
752757

753758

src/main/java/com/yhy/core/CVE_2021_22986.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.yhy.core;
22

3+
import com.alibaba.fastjson.JSONObject;
34
import com.yhy.tools.HttpTool;
45
import com.yhy.tools.Tools;
5-
import org.json.JSONObject;
66

77
import java.util.HashMap;
88
import java.util.UUID;
@@ -71,9 +71,8 @@ public String exeCMD(String cmd, String encoding) throws Exception {
7171
String payload = String.format("{\"command\":\"run\",\"utilCmdArgs\":\"-c %s\"}", cmd);
7272
String result = HttpTool.postHttpReuest(path, payload, encoding, map, "application/json");
7373

74-
JSONObject jsonObj = new JSONObject(result);
75-
result = jsonObj.getString("commandResult");
76-
74+
JSONObject object = JSONObject.parseObject(result);
75+
result = object.getString("commandResult");
7776

7877
return result + "\r\n 命令执行成功";
7978

src/main/java/com/yhy/core/Constants.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
public class Constants {
1010
public static String NAME = "图形化漏洞利用Demo-JavaFx版";
1111

12-
public static String VERSION = "v1.3 ";
12+
public static String VERSION = "v1.4 ";
1313

1414
public static String AUTHOR = "yhy";
1515

1616
public static String BASICINFO = "本工具提供给安全测试人员,安全工程师,进行安全自查使用,请勿非法使用\r\n\r\n" +
1717
"版本: " + VERSION + "\r\n\r\n" +
1818
"Bug反馈: https://github.com/yhy0/ExpDemo-JavaFX\r\n\r\n" +
19+
"V1.4\r\n" +
20+
"\t修复生成的jar文件,fofa查询时无反应(mvn生成jar时没有加载第三方包,添加MANIFEST.MF文件指定加载)\r\n" +
1921
"V1.3\r\n" +
20-
"\t增加fofa查询功能\r\n" +
22+
"\t增加fofa查询模块,并且fofa高级会员可以通过输入icon的url,计算hash值,查询相同icon的网站\r\n" +
2123
"V1.2\n" +
2224
"\t批量扫描模块,添加对存在漏洞的url导出功能\r\n" +
2325
"\t修改检测漏洞后的显示,存在、不存在、异常\r\n" +

0 commit comments

Comments
 (0)