diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..1ced6d1
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..081b737
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 数据源本地存储已忽略文件
+/dataSources/
+/dataSources.local.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..f8f2957
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+FofaCollect
\ No newline at end of file
diff --git a/.idea/artifacts/FofaCollect_jar.xml b/.idea/artifacts/FofaCollect_jar.xml
new file mode 100644
index 0000000..7d8b24c
--- /dev/null
+++ b/.idea/artifacts/FofaCollect_jar.xml
@@ -0,0 +1,16 @@
+
+
+ $PROJECT_DIR$/out/artifacts/FofaCollect_jar
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..0fff4bf
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..be5f5c6
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_10.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_10.xml
new file mode 100644
index 0000000..7a63983
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_10.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_9.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_9.xml
new file mode 100644
index 0000000..063d419
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_9.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_10_4.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_10_4.xml
new file mode 100644
index 0000000..754f320
--- /dev/null
+++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_10_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_r4v3zn_fofa_fofa_core_1_0_2_RELEASE.xml b/.idea/libraries/Maven__com_r4v3zn_fofa_fofa_core_1_0_2_RELEASE.xml
new file mode 100644
index 0000000..77b9701
--- /dev/null
+++ b/.idea/libraries/Maven__com_r4v3zn_fofa_fofa_core_1_0_2_RELEASE.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/fofa_core_1_0_2_RELEASE.xml b/.idea/libraries/fofa_core_1_0_2_RELEASE.xml
new file mode 100644
index 0000000..1adb4f6
--- /dev/null
+++ b/.idea/libraries/fofa_core_1_0_2_RELEASE.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..4361200
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ece4c34
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FofaCollect.iml b/FofaCollect.iml
new file mode 100644
index 0000000..f4acf95
--- /dev/null
+++ b/FofaCollect.iml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f5da85a
--- /dev/null
+++ b/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.suyu.Main
+
diff --git a/README.md b/README.md
index 86179eb..ff13b4e 100644
--- a/README.md
+++ b/README.md
@@ -4,20 +4,27 @@
V3.0
-有小伙伴提示Fofa更新了,返回的格式会乱掉,我这边抽空重写一下,因为源代码都没了,所以大家稍微等等。。。
+只支持jdk8
+因为接口问题,删除ip查询功能
+增加Fofa采集进度条
-V2.0
+公开工具源码
+
+![test](./test.gif)
+V2.0
增加修改账号配置文件
+
增加ip批量查询定位
![工具截图](https://upload-images.jianshu.io/upload_images/14134003-116498e08c97b1fe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
V1.0
+
提供接口查询资产
最大支持1000页查询
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 0000000..b40648e
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/src/main/.DS_Store b/src/main/.DS_Store
new file mode 100644
index 0000000..a7bcd45
Binary files /dev/null and b/src/main/.DS_Store differ
diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store
new file mode 100644
index 0000000..88b20f2
Binary files /dev/null and b/src/main/java/.DS_Store differ
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f5da85a
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.suyu.Main
+
diff --git a/src/main/java/com/suyu/Main.java b/src/main/java/com/suyu/Main.java
new file mode 100644
index 0000000..85811fa
--- /dev/null
+++ b/src/main/java/com/suyu/Main.java
@@ -0,0 +1,22 @@
+package com.suyu;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("Main.fxml"));
+ primaryStage.setTitle("FofaCollect by 苏宇@涂鸦智能安全团队");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/src/main/java/com/suyu/controller/FofaController.java b/src/main/java/com/suyu/controller/FofaController.java
new file mode 100644
index 0000000..583e13c
--- /dev/null
+++ b/src/main/java/com/suyu/controller/FofaController.java
@@ -0,0 +1,109 @@
+package com.suyu.controller;
+
+import com.suyu.Main;
+import com.suyu.utils.*;
+import javafx.fxml.*;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.control.*;
+import javafx.collections.*;
+import com.r4v3zn.fofa.core.client.*;
+import javafx.event.*;
+import javafx.stage.Modality;
+import javafx.stage.Stage;
+import javafx.stage.StageStyle;
+
+import java.net.*;
+import java.util.*;
+
+public class FofaController extends Main implements Initializable {
+ @FXML
+ private Button stop_btn;
+ @FXML
+ private TextArea result_text;
+ @FXML
+ private ComboBox> page_cbx;
+ @FXML
+ private TextField fofa_q;
+ @FXML
+ private Button search_btn;
+ @FXML
+ private Button clear_btn;
+ @FXML
+ private ProgressBar processbar;
+
+ private MainController main;
+ private GoThread t;
+
+ public FofaController() {
+ }
+
+ public MainController getMain() {
+ return this.main;
+ }
+
+ public void setMain(MainController main) {
+ ObservableList products = FXCollections.observableArrayList((Object[])new String[] { "1", "99", "1000" });
+ this.page_cbx.setItems(products);
+ this.page_cbx.getSelectionModel().select(2);
+ this.main = main;
+ this.syslog("在使用本工具前,请先在配置您的Fofa账号和KEY");
+ }
+
+
+ public void syslog(String log) {
+ this.result_text.appendText(log + "\r\n");
+ }
+
+ private void go() {
+ String pa = Path.getRootPath() + "fofa.ini";
+ String pstr = FileTools.readFileAllContent(pa, "utf-8");
+ String[] ps = pstr.split(":");
+ String email = ps[0];
+ String key = ps[1].replace("\n", "");
+ String q = this.fofa_q.getText();
+ int p = Integer.parseInt(this.page_cbx.getValue().toString());
+ FofaClient client = new FofaClient(email, key);
+
+ for (int i = 1; i < p; ++i) {
+ processbar.setProgress((float)i/(float)p);
+ String a = null;
+ try {
+ a = String.valueOf(client.getData(String.valueOf(client.getData(q, i)))).trim();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ String b = a.substring(a.indexOf("[") + 1, a.indexOf("]")).replace(", ", "\n").replace("https://", "").replace("http://", ".");
+ this.syslog(b);
+ }
+
+ }
+
+ public void fofa_search(ActionEvent actionEvent) {
+ this.result_text.setText("");
+ (t = new GoThread()).start();
+ }
+
+
+ public void fofa_search_stop(ActionEvent actionEvent) {
+ t.stop();
+ processbar.setProgress(1);
+ }
+
+ public void fofa_clear(ActionEvent actionEvent) {
+ this.result_text.setText("");
+ }
+
+
+ @Override
+ public void initialize(URL location, ResourceBundle resources) {
+
+ }
+
+ class GoThread extends Thread{
+ @Override
+ public void run() {
+ go();
+ }
+ }
+}
diff --git a/src/main/java/com/suyu/controller/FofaPwdController.java b/src/main/java/com/suyu/controller/FofaPwdController.java
new file mode 100644
index 0000000..e451f02
--- /dev/null
+++ b/src/main/java/com/suyu/controller/FofaPwdController.java
@@ -0,0 +1,41 @@
+package com.suyu.controller;
+
+import com.suyu.utils.*;
+import javafx.fxml.*;
+import javafx.scene.control.*;
+import javafx.event.*;
+import java.net.*;
+import java.util.*;
+
+public class FofaPwdController implements Initializable {
+ @FXML
+ private Button fofa_save;
+ @FXML
+ private TextField key_id;
+ @FXML
+ private TextArea fofa_acc_text;
+ @FXML
+ private TextField mail_account;
+ private MainController main;
+
+// public void setMain(final MainController main) {
+// this.main = main;
+// }
+
+ public void syslog(final String log) {
+ this.fofa_acc_text.appendText(log + "----" + Tools.getTimeNow() + "\r\n");
+ }
+
+ @FXML
+ public void savefofa(final Event e) {
+ final String pc = this.mail_account.getText() + ":" + this.key_id.getText();
+ FileTools.writeFile(Path.getRootPath() + "fofa.ini", pc);
+ this.syslog("配置文件修改成功");
+ }
+
+
+ @Override
+ public void initialize(URL location, ResourceBundle resources) {
+
+ }
+}
diff --git a/src/main/java/com/suyu/controller/MainController.java b/src/main/java/com/suyu/controller/MainController.java
new file mode 100644
index 0000000..467a9cd
--- /dev/null
+++ b/src/main/java/com/suyu/controller/MainController.java
@@ -0,0 +1,95 @@
+package com.suyu.controller;
+
+import com.suyu.utils.*;
+import javafx.event.*;
+import javafx.stage.*;
+import javafx.fxml.*;
+import javafx.scene.control.*;
+import javafx.scene.*;
+import java.net.*;
+import java.util.*;
+
+
+public class MainController implements Initializable {
+ @FXML
+ private TabPane mainTabPane;
+ @FXML
+ public static TextArea txtlog;
+ @FXML
+ private ToggleButton PortScanStop_btn;
+ @FXML
+ private static TextField Target_port;
+ @FXML
+ private TextArea PortScan_ip;
+ @FXML
+ private ToggleButton PortScanStart_btn;
+ @FXML
+ private ToggleButton PortImport_btn;
+ @FXML
+ private MenuItem close;
+
+ public void syslog(final String log) {
+ MainController.txtlog.appendText(log + "----" + Tools.getTimeNow() + "\r\n");
+ }
+
+ @FXML
+ public void about(final Event e) {
+ try {
+ final DialogPane da = new DialogPane();
+ da.setHeaderText("苏宇@涂鸦");
+ final Stage stage = new Stage();
+ final Scene sc = new Scene((Parent)da);
+ stage.setScene(sc);
+ stage.initStyle(StageStyle.UTILITY);
+ stage.initModality(Modality.WINDOW_MODAL);
+ stage.setTitle("关于我");
+ stage.setAlwaysOnTop(true);
+ stage.show();
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ public void openFofacollect(final Event e) {
+ try {
+ final FXMLLoader fxmlLoader = new FXMLLoader();
+ fxmlLoader.setLocation(getClass().getClassLoader().getResource("FoFa.fxml"));
+ final Parent root = (Parent)fxmlLoader.load();
+ final FofaController fo = (FofaController)fxmlLoader.getController();
+ fo.setMain(this);
+ final Tab tab = new Tab();
+ tab.setText("Fofa查询窗口界面");
+ tab.setContent((Node)root);
+ this.mainTabPane.getTabs().add((Tab) tab);
+ this.mainTabPane.getSelectionModel().select(tab);
+ }
+ catch (Exception var2) {
+ this.syslog(var2.getMessage());
+ }
+ }
+
+ @FXML
+ private void fofa_pwd(final Event event) {
+ try {
+ final FXMLLoader fxmlLoader = new FXMLLoader();
+ fxmlLoader.setLocation(getClass().getClassLoader().getResource("fofa_pwd.fxml"));
+ final Parent root = (Parent)fxmlLoader.load();
+ final Stage stage = new Stage();
+ final Scene sc = new Scene(root);
+ stage.setScene(sc);
+ stage.setAlwaysOnTop(true);
+ stage.show();
+ }
+ catch (Exception var3) {
+ this.syslog(var3.getMessage());
+ }
+ }
+
+
+ @Override
+ public void initialize(URL location, ResourceBundle resources) {
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/suyu/lib/fofa-core-1.0.2.RELEASE.jar b/src/main/java/com/suyu/lib/fofa-core-1.0.2.RELEASE.jar
new file mode 100644
index 0000000..6800d88
Binary files /dev/null and b/src/main/java/com/suyu/lib/fofa-core-1.0.2.RELEASE.jar differ
diff --git a/src/main/java/com/suyu/utils/FileTools.java b/src/main/java/com/suyu/utils/FileTools.java
new file mode 100644
index 0000000..007f02d
--- /dev/null
+++ b/src/main/java/com/suyu/utils/FileTools.java
@@ -0,0 +1,103 @@
+package com.suyu.utils;
+
+import java.io.*;
+
+public class FileTools
+{
+ public static byte[] getBytesByFile(final String filePath) throws IOException {
+ final InputStream in = new FileInputStream(filePath);
+ final byte[] data = toByteArray(in);
+ in.close();
+ return data;
+ }
+
+ public static byte[] toByteArray(final InputStream in) throws IOException {
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ final byte[] buffer = new byte[4096];
+ final boolean var3 = false;
+ int n;
+ while ((n = in.read(buffer)) != -1) {
+ out.write(buffer, 0, n);
+ }
+ return out.toByteArray();
+ }
+
+ public static byte[] readToBytes(final String path) throws IOException {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final File ff = new File(path);
+ final FileInputStream fs = new FileInputStream(ff);
+ final byte[] temp = new byte[4096];
+ final boolean var5 = false;
+ int len;
+ while ((len = fs.read(temp)) != -1) {
+ bos.write(temp, 0, len);
+ }
+ fs.close();
+ final byte[] data = bos.toByteArray();
+ bos.close();
+ return data;
+ }
+
+ public static String readFileToString(final String path) throws IOException {
+ final byte[] data = readToBytes(path);
+ final String str = new String(data, "UTF-8");
+ return str;
+ }
+
+ public static void writeFile(final String filePath, final String content) {
+ try {
+ final OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(filePath), "utf-8");
+ final BufferedWriter writer = new BufferedWriter(write);
+ writer.write(content);
+ writer.close();
+ }
+ catch (IOException var4) {
+ var4.printStackTrace();
+ }
+ }
+
+ public static String readOneLineTxtFile(final String filePath) {
+ try {
+ final String encoding = "utf-8";
+ final File file = new File(filePath);
+ if (file.isFile() && file.exists()) {
+ final InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);
+ final BufferedReader bufferedReader = new BufferedReader(read);
+ final String lineTxt = bufferedReader.readLine();
+ bufferedReader.close();
+ read.close();
+ }
+ else {
+ System.out.println("\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6587\u4ef6,\u67e5\u770b\u6b64\u8def\u5f84\u662f\u5426\u6b63\u786e:" + filePath);
+ }
+ }
+ catch (Exception var6) {
+ System.out.println("\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u51fa\u9519");
+ }
+ return "";
+ }
+
+ public static String readFileAllContent(final String filePath, final String encoding) {
+ final StringBuffer fileContent = new StringBuffer();
+ try {
+ final File file = new File(filePath);
+ if (file.isFile() && file.exists()) {
+ final InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);
+ final BufferedReader bufferedReader = new BufferedReader(read);
+ String lineTxt = null;
+ while ((lineTxt = bufferedReader.readLine()) != null) {
+ fileContent.append(lineTxt);
+ fileContent.append("\n");
+ }
+ read.close();
+ }
+ else {
+ System.out.println("\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6587\u4ef6,\u67e5\u770b\u6b64\u8def\u5f84\u662f\u5426\u6b63\u786e:" + filePath);
+ }
+ }
+ catch (Exception var7) {
+ System.out.println("\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u51fa\u9519");
+ }
+ return fileContent.toString();
+ }
+}
diff --git a/src/main/java/com/suyu/utils/Path.java b/src/main/java/com/suyu/utils/Path.java
new file mode 100644
index 0000000..082d1dd
--- /dev/null
+++ b/src/main/java/com/suyu/utils/Path.java
@@ -0,0 +1,37 @@
+package com.suyu.utils;
+
+import java.net.*;
+import java.io.*;
+
+public class Path
+{
+ public static String getRootPath() {
+ final URL url = Path.class.getProtectionDomain().getCodeSource().getLocation();
+ String filePath = "";
+ try {
+ filePath = URLDecoder.decode(url.getPath(), "UTF-8");
+ }
+ catch (Exception ex) {}
+ filePath = filePath.replace("\\", "/").replace("//", "/");
+ if (filePath.contains(":/") && filePath.startsWith("/")) {
+ filePath = filePath.substring(1);
+ }
+ if (filePath.endsWith(".jar")) {
+ filePath = filePath.substring(0, filePath.lastIndexOf("/") + 1);
+ }
+ return filePath;
+ }
+
+ public static String getClassResources() {
+ String cpath = new Object() {
+ public String getPath() {
+ return this.getClass().getResource("").getPath();
+ }
+ }.getPath();
+ cpath = URLDecoder.decode(cpath.replaceAll("file:/", ""));
+ if (cpath.indexOf(":") != 1) {
+ cpath = File.separator + cpath;
+ }
+ return cpath;
+ }
+}
diff --git a/src/main/java/com/suyu/utils/Tools.java b/src/main/java/com/suyu/utils/Tools.java
new file mode 100644
index 0000000..ada7356
--- /dev/null
+++ b/src/main/java/com/suyu/utils/Tools.java
@@ -0,0 +1,19 @@
+package com.suyu.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Tools
+{
+ public static String date2Str(final Date date, final String format) {
+ if (date != null) {
+ final SimpleDateFormat sdf = new SimpleDateFormat(format);
+ return sdf.format(date);
+ }
+ return "";
+ }
+
+ public static String getTimeNow() {
+ return date2Str(new Date(), "yyyy-MM-dd HH:mm:ss");
+ }
+}
diff --git a/src/main/resources/FoFa.fxml b/src/main/resources/FoFa.fxml
new file mode 100644
index 0000000..b9bb39b
--- /dev/null
+++ b/src/main/resources/FoFa.fxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/Main.fxml b/src/main/resources/Main.fxml
new file mode 100644
index 0000000..288187b
--- /dev/null
+++ b/src/main/resources/Main.fxml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/fofa.ini b/src/main/resources/fofa.ini
new file mode 100644
index 0000000..eb65fa8
--- /dev/null
+++ b/src/main/resources/fofa.ini
@@ -0,0 +1 @@
+netwarks@163.com:93e71b8ad938e58f2bcfcab100dd8c11
\ No newline at end of file
diff --git a/src/main/resources/fofa_pwd.fxml b/src/main/resources/fofa_pwd.fxml
new file mode 100644
index 0000000..ad202d7
--- /dev/null
+++ b/src/main/resources/fofa_pwd.fxml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test.gif b/test.gif
new file mode 100644
index 0000000..03a63f3
Binary files /dev/null and b/test.gif differ