Repository: tangxiaofeng7/Fofa-collect Branch: master Commit: 59bb3a4acc1b Files: 38 Total size: 52.3 KB Directory structure: gitextract_zno1ssb6/ ├── .idea/ │ ├── .gitignore │ ├── .name │ ├── artifacts/ │ │ └── FofaCollect_jar.xml │ ├── compiler.xml │ ├── jarRepositories.xml │ ├── libraries/ │ │ ├── Maven__cn_hutool_hutool_core_5_7_3.xml │ │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_12_4.xml │ │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_12_4.xml │ │ └── Maven__com_fasterxml_jackson_core_jackson_databind_2_12_4.xml │ ├── misc.xml │ ├── modules.xml │ └── vcs.xml ├── FofaCollect.iml ├── META-INF/ │ └── MANIFEST.MF ├── README.md ├── pom.xml └── src/ ├── META-INF/ │ └── MANIFEST.MF └── main/ └── java/ ├── META-INF/ │ └── MANIFEST.MF └── com/ └── suyu/ ├── Main.java ├── controller/ │ ├── FofaController.java │ ├── FofaPwdController.java │ └── MainController.java ├── core/ │ ├── DO/ │ │ ├── FofaData.java │ │ ├── User.java │ │ └── UserLogin.java │ ├── client/ │ │ └── FofaClient.java │ ├── constants/ │ │ ├── FofaClientConsts.java │ │ ├── FofaFieldsConsts.java │ │ └── UserConsts.java │ ├── enmus/ │ │ └── UserVipLevelEnum.java │ ├── exception/ │ │ └── FofaException.java │ └── util/ │ └── HttpUtils.java ├── utils/ │ ├── FileTools.java │ ├── Path.java │ └── Tools.java └── views/ ├── FoFa.fxml ├── Main.fxml └── fofa_pwd.fxml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .idea/.gitignore ================================================ # 默认忽略的文件 /shelf/ /workspace.xml # 数据源本地存储已忽略文件 /dataSources/ /dataSources.local.xml # 基于编辑器的 HTTP 客户端请求 /httpRequests/ ================================================ FILE: .idea/.name ================================================ FofaCollect ================================================ FILE: .idea/artifacts/FofaCollect_jar.xml ================================================ $PROJECT_DIR$/out/artifacts/FofaCollect_jar ================================================ FILE: .idea/compiler.xml ================================================ ================================================ FILE: .idea/jarRepositories.xml ================================================ ================================================ FILE: .idea/libraries/Maven__cn_hutool_hutool_core_5_7_3.xml ================================================ ================================================ FILE: .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_12_4.xml ================================================ ================================================ FILE: .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_12_4.xml ================================================ ================================================ FILE: .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_12_4.xml ================================================ ================================================ FILE: .idea/misc.xml ================================================ ================================================ FILE: .idea/modules.xml ================================================ ================================================ FILE: .idea/vcs.xml ================================================ ================================================ FILE: FofaCollect.iml ================================================ ================================================ FILE: META-INF/MANIFEST.MF ================================================ Manifest-Version: 1.0 Main-Class: com.suyu.Main ================================================ FILE: README.md ================================================ # Fofa-collect ### 版本说明 支持jdk8直接运行 jdk11因为没有javafx这个依赖需要自己再加上参数 ``` java -Dfile.encoding="UTF-8" --module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" --add-modules "javafx.controls,javafx.fxml,javafx.web" -jar "xxx.jar" ```

### star趋势 [![Stargazers over time](https://starchart.cc/tangxiaofeng7/Fofa-collect.svg)](https://starchart.cc/tangxiaofeng7/Fofa-collect) ================================================ FILE: pom.xml ================================================ 4.0.0 com.suyu FofaConllect 3.0 jar FofaCollect org.apache.maven.plugins maven-jar-plugin 3.0.2 ${project.build.directory} true libs/ com.suyu.Main org.apache.maven.plugins maven-compiler-plugin 6 6 src/main/java **/*.properties **/*.fxml **/*.ini false com.fasterxml.jackson.core jackson-core 2.12.4 com.fasterxml.jackson.core jackson-databind 2.12.4 cn.hutool hutool-core 5.7.3 ================================================ FILE: src/META-INF/MANIFEST.MF ================================================ Manifest-Version: 1.0 Main-Class: com.suyu.Main ================================================ FILE: src/main/java/META-INF/MANIFEST.MF ================================================ Manifest-Version: 1.0 Main-Class: com.suyu.Main ================================================ FILE: src/main/java/com/suyu/Main.java ================================================ 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("com/suyu/views/Main.fxml")); primaryStage.setTitle("FofaCollect by txf"); primaryStage.setScene(new Scene(root)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } ================================================ FILE: src/main/java/com/suyu/controller/FofaController.java ================================================ package com.suyu.controller; import com.fasterxml.jackson.core.JsonProcessingException; import com.suyu.Main; import com.suyu.core.DO.FofaData; import com.suyu.core.client.FofaClient; import com.suyu.utils.FileTools; import com.suyu.utils.Path; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import java.net.URL; import java.util.ResourceBundle; 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", "500", "999", "9999"}); 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() throws JsonProcessingException { String pa = Path.getRootPath() + "fofa.ini"; String pstr = FileTools.readFileAllContent(pa, "utf-8"); if (pstr.equals("")) { this.syslog("提示:在使用本工具前,请先在配置您的Fofa账号和KEY"); } 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); try { System.out.println(client.getUser()); } catch (Exception e) { e.printStackTrace(); } for (int i = 1; i < p; ++i) { processbar.setProgress((float) i / (float) p); FofaData a = new FofaData(); try { a = client.getData(q, i); } catch (Exception ex) { this.syslog(ex.toString()); } String b = String.valueOf(a.getResults()); String c = b.substring(b.indexOf("[") + 1,b.indexOf("]")).replace(", ", "\n").replace("https://", "").replace("http://", "."); this.syslog(c); } } 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() { try { go(); } catch (JsonProcessingException e) { e.printStackTrace(); } } } } ================================================ FILE: src/main/java/com/suyu/controller/FofaPwdController.java ================================================ 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) { } } ================================================ FILE: src/main/java/com/suyu/controller/MainController.java ================================================ 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("唐小风 \n Wechat: suyu401"); 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("com/suyu/views/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("com/suyu/views/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) { } } ================================================ FILE: src/main/java/com/suyu/core/DO/FofaData.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.DO; import java.util.List; /** * Title: FofaData * Descrption: this is fofa datas * Date:2019-06-08 17:49 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public class FofaData { /** * mode */ private String mode; /** * current page no */ private Integer page; /** * total size */ private Integer size; /** * total page */ private Integer totalPage; /** * query */ private String query; /** * results */ private List> results; public void setQuery(String query) { this.query = query; } public String getQuery() { return query; } public void setTotalPage(Integer totalPage) { this.totalPage = totalPage; } public Integer getTotalPage() { return totalPage; } public String getMode() { return mode; } public Integer getPage() { return page; } public Integer getSize() { return size; } public List> getResults() { return results; } public void setResults(List> results) { this.results = results; } public void setMode(String mode) { this.mode = mode; } public void setPage(Integer page) { this.page = page; } public void setSize(Integer size) { this.size = size; } @Override public String toString() { return "FofaData{" + "mode='" + mode + '\'' + ", page=" + page + ", size=" + size + ", totalPage=" + totalPage + ", query='" + query + '\'' + ", results=" + results + '}'; } } ================================================ FILE: src/main/java/com/suyu/core/DO/User.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.DO; import com.suyu.core.enmus.UserVipLevelEnum; /** * Title: User * Descrption: this is User * Date:2019-06-07 16:00 * Email:woo0nise@gmail.com * Company:www.j2ee.app * @author R4v3zn * @version 1.0.0 */ public class User { /** * user email */ private String email; /** * username; */ private String userName; /** * fcion */ private Integer fCoin; /** * vip */ private Boolean isVip; /** * vip level */ private UserVipLevelEnum vipLevel; /** * is verified */ private Boolean isVerified; /** * avatar */ private String avatar; /** * message count */ private Integer message; /** * fofacli version */ private String fofacliVersion; /** * fofa server */ private Boolean fofaServer; /** * User * @param email email * @param userName name * @param fCoin FCoin * @param isVip is vip * @param vipLevel vip level * @param isVerified is verified * @param avatar avatar link * @param message message count * @param fofacliVersion fofacli version * @param fofaServer fofaServer */ public User(String email, String userName, Integer fCoin, Boolean isVip, UserVipLevelEnum vipLevel, Boolean isVerified, String avatar, Integer message, String fofacliVersion, Boolean fofaServer) { this.email = email; this.userName = userName; this.fCoin = fCoin; this.isVip = isVip; this.vipLevel = vipLevel; this.isVerified = isVerified; this.avatar = avatar; this.message = message; this.fofacliVersion = fofacliVersion; this.fofaServer = fofaServer; } public void setEmail(String email) { this.email = email; } public void setUserName(String userName) { this.userName = userName; } public void setfCoin(Integer fCoin) { this.fCoin = fCoin; } public void setVip(Boolean vip) { isVip = vip; } public void setVipLevel(UserVipLevelEnum vipLevel) { this.vipLevel = vipLevel; } public void setVerified(Boolean verified) { isVerified = verified; } public void setAvatar(String avatar) { this.avatar = avatar; } public void setMessage(Integer message) { this.message = message; } public void setFofacliVersion(String fofacliVersion) { this.fofacliVersion = fofacliVersion; } public void setFofaServer(Boolean fofaServer) { this.fofaServer = fofaServer; } public String getEmail() { return email; } public String getUserName() { return userName; } public Integer getfCoin() { return fCoin; } public Boolean getVip() { return isVip; } public UserVipLevelEnum getVipLevel() { return vipLevel; } public Boolean getVerified() { return isVerified; } public String getAvatar() { return avatar; } public Integer getMessage() { return message; } public String getFofacliVersion() { return fofacliVersion; } public Boolean getFofaServer() { return fofaServer; } @Override public String toString() { return "User{" + "email='" + email + '\'' + ", userName='" + userName + '\'' + ", fCoin=" + fCoin + ", isVip=" + isVip + ", vipLevel=" + vipLevel + ", isVerified=" + isVerified + ", avatar='" + avatar + '\'' + ", message=" + message + ", fofacliVersion='" + fofacliVersion + '\'' + ", fofaServer=" + fofaServer + '}'; } } ================================================ FILE: src/main/java/com/suyu/core/DO/UserLogin.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.DO; /** * Title: UserLogin * Descrption: UserLogin DO * Date:2019-06-07 16:13 * Email:woo0nise@gmail.com * Company:www.j2ee.app * @author R4v3zn * @version 1.0.0 */ public class UserLogin { /** * this is FOFA Pro email */ private String email; /** * this is FOFA Pro key */ private String key; /** * Constructor * @param email user email * @param key user key */ public UserLogin(String email, String key) { this.email = email; this.key = key; } public String getEmail() { return email; } public String getKey() { return key; } public void setEmail(String email) { this.email = email; } public void setKey(String key) { this.key = key; } } ================================================ FILE: src/main/java/com/suyu/core/client/FofaClient.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.client; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.suyu.core.DO.FofaData; import com.suyu.core.DO.User; import com.suyu.core.DO.UserLogin; import com.suyu.core.enmus.UserVipLevelEnum; import com.suyu.core.exception.FofaException; import com.suyu.core.util.HttpUtils; import java.util.*; import static cn.hutool.core.codec.Base64.encode; import static com.suyu.core.constants.FofaClientConsts.*; import static com.suyu.core.constants.FofaFieldsConsts.FIELDS_LIST; /** * Title: FofaClient * Descrption: this is FOFA Pro client * Date:2019-06-07 14:21 * Email:woo0nise@gmail.com * Company:www.j2ee.app * @author R4v3zn * @version 1.0.0 */ public class FofaClient { private String email; private String key; /** * Constructor * @param email email * @param key key */ public FofaClient(String email, String key){ this.email = email; this.key = key; } /** * Jackson mapper */ private ObjectMapper mapper = new ObjectMapper(); /** * getUserLogin * @return */ public UserLogin getUserLogin(){ return new UserLogin(email, key); } /** * get user info * @return */ public User getUser() throws Exception{ String loginEmail = this.email; String loginKey = this.key; // get user String url = BASE_URL + GET_USER_INFO_URI; Map map = new HashMap(); map.put("email", loginEmail); map.put("key", loginKey); String rsp = HttpUtils.doGet(url, map); JsonNode node = mapper.readTree(rsp); JsonNode errorNode = node.get("error"); if(errorNode != null && errorNode.asBoolean()){ throw new FofaException(node.get("errmsg").asText()); } String email = node.get("email").asText(); String userName = node.get("username").asText(); Integer fCoin = node.get("fcoin").asInt(); Boolean isVip = node.get("isvip").asBoolean(); Integer vipLevel = node.get("vip_level").asInt(); Boolean isVerified = node.get("is_verified").asBoolean(); String avatar = node.get("avatar").asText(); Integer message = node.get("message").asInt(); String fofacliVersion = node.get("fofacli_ver").asText(); Boolean fofaServer = node.get("fofacli_ver").asBoolean(); UserVipLevelEnum vipLevelEnum = vipLevel == 1?UserVipLevelEnum.VIP:UserVipLevelEnum.SVIP; User user = new User(email,userName,fCoin,isVip,vipLevelEnum,isVerified,avatar,message,fofacliVersion, fofaServer); return user; } /** * get data *

* page default 1 * size default 100 * fields default host * full default false *

* @param q search query(not encode) * @return fofa search result data * @throws Exception search Expection */ public FofaData getData(String q) throws Exception { return getData(q, 1,100,"host",false); } /** * get data *

* size default 100 * fields default host * full default false *

* @param q search query(not encode) * @param page page * @return fofa search result data * @exception Exception search Expection */ public FofaData getData(String q,Integer page) throws Exception { return getData(q, page,100,"host",false); } /** * get data *

* fields default host * full default false *

* @param q search query(not encode) * @param page page * @param size page size * @return fofa search result data * @exception Exception search Expection */ public FofaData getData(String q,Integer page,Integer size) throws Exception{ return getData(q, page,size,"host",false); } /** * get data *

* full default false *

* @param q search query(not encode) * @param page page * @param size page size * @param fields fields * @return fofa search result data * @throws Exception search Expection */ public FofaData getData(String q,Integer page,Integer size,String fields)throws Exception{ return getData(q,page,size,fields,false); } /** * get data * @param q search query(not encode) * @param page page no * @param size page size * @param fields fields * @param full is full * @return fofa search result data */ public FofaData getData(String q, Integer page, Integer size, String fields, Boolean full) throws Exception{ checkParam(q,size,fields); // check page page = page < 0 ? 1:page; // check full is not null full = full == null ? false:full; String url = BASE_URL+SEARCH_URI; Map map = new HashMap(); map.put("qbase64", encode(q)); map.put("page", page); map.put("size", size); map.put("fields", fields); map.put("full",full); map.put("key", key); map.put("email", email); String rsp = HttpUtils.doGet(url, map); JsonNode node = mapper.readTree(rsp); JsonNode errorNode = node.get("error"); if(errorNode != null && errorNode.asBoolean()){ throw new FofaException(node.get("errmsg").asText()); } String mode = node.get("mode").asText(); String query = node.get("query").asText(); Integer rspPage = node.get("page").asInt(); Integer totalSize = node.get("size").asInt(); String results = node.get("results").toString(); Integer totalPage = totalSize%size == 0 ? totalSize/size:totalSize/size + 1; FofaData fofaData = new FofaData(); fofaData.setMode(mode); fofaData.setPage(rspPage); fofaData.setSize(totalSize); fofaData.setQuery(query); fofaData.setTotalPage(totalPage); List> list = mapper.readValue(results, List.class); fofaData.setResults(list); return fofaData; } /** * check param * @param q search query * @param size size * @param fields fields * @throws FofaException */ public void checkParam(String q,Integer size, String fields)throws FofaException{ // check search query if(q == null || "".equals(q)){ throw new FofaException("search query cannot be empty"); } // check max size if(size > MAX_SIZE){ throw new FofaException("max size "+MAX_SIZE); } // check fields List splitList = Arrays.asList(fields.split(",")); splitList = new ArrayList(splitList); splitList.removeAll(FIELDS_LIST); if(splitList.size() > 0){ throw new FofaException(splitList+" not's fields,please delte that"); } } } ================================================ FILE: src/main/java/com/suyu/core/constants/FofaClientConsts.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.constants; /** * Title: FofaClientConsts * Descrption: this is Fofo Pro Client Constants * Date:2019-06-07 21:56 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public class FofaClientConsts { /** * Base FOFA Pro Api */ // public static final String BASE_URL = "https://fofa.so"; public static final String BASE_URL = "https://fofa.info"; /** * get user info uri */ public static final String GET_USER_INFO_URI = "/api/v1/info/my"; /** * search uri */ public static final String SEARCH_URI = "/api/v1/search/all"; /** * max size */ public static final Integer MAX_SIZE = 10000; } ================================================ FILE: src/main/java/com/suyu/core/constants/FofaFieldsConsts.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.constants; import java.util.Arrays; import java.util.List; /** * Title: FofaFieldsConsts * Descrption: this is FOFA Pro fields Constants * Date:2019-06-08 18:53 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public class FofaFieldsConsts { /** * FOFA Pro fields list */ public static final List FIELDS_LIST = Arrays.asList(new String[]{"host","title","ip","domain","port","country","province","city","country_name","header","protocol","banner","cert","isp","as_number","as_organization","latitude","longitude"}); } ================================================ FILE: src/main/java/com/suyu/core/constants/UserConsts.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.constants; /** * Title: UserConsts * Descrption: this is User Consts * Date:2019-06-07 20:36 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public class UserConsts { } ================================================ FILE: src/main/java/com/suyu/core/enmus/UserVipLevelEnum.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.enmus; /** * Title: UserVipLevelEnum * Descrption: TODO * Date:2019-06-07 20:45 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public enum UserVipLevelEnum { /** * Senior member, Free member */ SVIP(2,"高级会员"),VIP(1,"普通会员"); private String levelName; private Integer code; UserVipLevelEnum(Integer code,String levelName){ this.code = code; this.levelName = levelName; } } ================================================ FILE: src/main/java/com/suyu/core/exception/FofaException.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.exception; /** * Title: FofaException * Descrption: FofaException * Date:2019-06-07 16:12 * Email:woo0nise@gmail.com * Company:www.j2ee.app * * @author R4v3zn * @version 1.0.0 */ public class FofaException extends Exception{ /** * Constructor * @param msg message */ public FofaException(String msg){ super(msg); } } ================================================ FILE: src/main/java/com/suyu/core/util/HttpUtils.java ================================================ /* * Copyright (c) 2019. r4v3zn. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.suyu.core.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.*; import java.util.Map; /** * Title: HttpUtils * Descrption: HttpUtils * Date:2019-06-10 19:10 * Email:woo0nise@gmail.com * Company:www.j2ee.app * @author R4v3zn * @version 1.0.0 */ public class HttpUtils { /** * private */ private HttpUtils(){} /** * do get * @param url requests url * @return response info */ public static String doGet(String url){ return doGet(url,null); } /** * do get * @param actionUrl requests url * @param map requests param * @return response info */ public static String doGet(String actionUrl,Map map) { String result = ""; try { if(map != null && map.size() > 0){ actionUrl += "?"; for (String key: map.keySet()) { actionUrl += key + "="+URLEncoder.encode(map.get(key).toString(), "UTF-8")+"&"; } } URL url = new URL(actionUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); BufferedReader reader = null; if(HttpURLConnection.HTTP_OK == connection.getResponseCode()){ reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8")); }else{ reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "utf-8")); } String s = ""; String temp = ""; while ((temp = reader.readLine()) != null) { s += temp; } result = s; reader.close(); } catch (ProtocolException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return result; } } ================================================ FILE: src/main/java/com/suyu/utils/FileTools.java ================================================ 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(); } } ================================================ FILE: src/main/java/com/suyu/utils/Path.java ================================================ 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; } } ================================================ FILE: src/main/java/com/suyu/utils/Tools.java ================================================ 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"); } } ================================================ FILE: src/main/java/com/suyu/views/FoFa.fxml ================================================ ================================================ FILE: src/main/java/com/suyu/views/fofa_pwd.fxml ================================================