Java程序集成fofa
fofa官网:https://fofa.so
1. Maven 添加依赖
<!--fofa-->
<dependency>
<groupId>com.r4v3zn.fofa</groupId>
<artifactId>fofa-core</artifactId>
<version>1.0.4.RELEASE</version>
</dependency>
2. 使用方法
key 在个人中心的个人资料中,地址:https://fofa.so/userInfo
public static void main(String[] args) throws Exception {
// 邮箱账号
String email = "[email protected]";
//
String key = "4aXXXXXXXXXXXXXXXX6927b76f83963";
String q = "ip=\"8.8.8.8\"";
String fields = "host,ip,port,country_name,as_organization,latitude,longitude";
FofaClient client = new FofaClient(email, key);
System.out.println(JSON.toJSONString(client.getUser()));
System.out.println(JSON.toJSONString(client.getData(q, 1, 10, fields)));
}
其中的查询参数q可以以多种形式查询,fofa首页有多种查询语法
默认不加fields
参数的话,返回的只有对应的IP地址
fields
参数可携带多个参数,对应参数值查询之后可返回
3. 获取的结果