# pythonfofa - 一个方便你在Python中使用fofa的库
### FOFA API
[`FOFA API`](https://fofa.info/api) 是资产搜索引擎 [`FOFA `](https://fofa.info/) 为开发者提供的 RESTful API接口, 允许开发者在自己的项目中集成 FOFA 的功能。
------
### Pythonfofa
以[Pyfofa](https://github.com/Moxin1044/pyfofa)构建的Python包,命名为pythonfofa
# 调用方法
## 安装
```python
pip install pythonfofa
```
## 使用
```python
import pythonfofa
handle = pythonfofa.Client('email','key') # 如果需要定义代理,则需要使用pythonfofa.Client('email','key',p,proxy)
print(handle.userinfo())
```
| `Email` | 用户登陆 `FOFA ` 使用的`Email` |
| :-------: | :----------------------------------------------------------- |
| `Key` | 前往 [**`个人中心`**](https://fofa.info/userInfo) 查看 `API Key` |
| `api_url` | 没有事情请不要修改哦,这里是FOFA的API请求地址 |
| `proxy` | 用户定义的代理,格式为`127.0.0.1:8080`,如无需代理,请设置为空 |
#### 检查Fofa配置
------
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.check_fofa_config())
```
只需要按照上述方法配置,即可检查配置信息。会在控制台输出你当前的`email`、`key`和`proxy`。
当然,每次执行前都会自动执行一次get_userinfo(),会根据您在config.json中填写的email和key进行获取信息。
# 调用示例
---
## 读取用户信息
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.userinfo())
```
### 返回信息
```json
{
"error": false,
"email": "****@qq.com",
"username": "***",
"fcoin": 48,
"isvip": true,
"vip_level": 2,
"is_verified": false,
"avatar": "https://i.nosec.org/avatar/system/****",
"message": "",
"fofacli_ver": "4.0.3",
"fofa_server": true
}
```
---
## 查询接口
提供搜索主机、获取详细信息的方法,使开发更容易。
### 代码示例
```Python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.search('title="bing"'))
```
### 返回信息
```json
{
"error": false,
"size": 8683,
"page": 1,
"mode": "extended",
"query": "title\u003d\"bing\"",
"results": [
[
"46.101.204.107",
"hotel-bing.hotels-rimini-it.com",
"80"
],
[
"104.21.32.129",
"https://peapix.com",
"443"
],
[
"193.8.37.83",
"https://www.thorsmindecamping.dk",
"443"
]
]
}
```
**注意:这里因为返回结果过多,所以修改了一下**
### 说明
`handle.search(query_text)`中,可以指定的传参如下:
```python
handle.search(query_text, field, page, size, full)
```
| 参数名 | 是否可空 | 默认值 | 传参类型 | 解释 |
| :--------: | :------: | :----------------------: | :------: | ------------------------------------------------------------ |
| query_text | 否 | 无 | string | 需要进行查询的语句,即输入的查询内容 |
| field | 是 | `['ip', 'host', 'port']` | list | 可选字段,默认host,ip,port,详见[附录1](https://fofa.info/api)或文末附录 |
| page | 是 | 1 | int | 是否翻页,默认为第一页,按照更新时间排序 |
| size | 是 | 100 | int | 每页查询数量,默认为100条,最大支持10,000条/页 |
| full | 是 | False | boolean | 默认搜索一年内的数据,指定为true即可搜索全部数据 |
**注意:这里的field参数需要使用list传参哦**,query_text无需再base64编码。
#### 演示1.查询域名“qq.com”
```python
handle.search('domain="qq.com"')
```
#### 演示2.查询域名“qq.com”的第二页
```python
handle.search('domain="qq.com"',page=2)
```
#### 演示3.查询10个域名有关“qq.com”的资产
```python
handle.search('domain="qq.com"',size=10)
```
#### 演示4.查询10个域名有关“qq.com”的资产,并且获取其IP、端口、标题和ICP备案号
```python
field = ['ip','port','title','icp']
handle.search('domain="qq.com"',field=field,size=10)
```
**注意:handle为`handle = fofa.Client()`,在环境中请不要忘了加上他哦!**
------
## 统计聚合
根据当前的查询内容,生成全球统计信息,当前可统计每个字段的前5排名。该接口限制请求并发为 5秒/次。
### 代码示例
```Python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.search_stats('ip="103.35.168.38"'))
```
### 返回信息
```json
{
"error": false,
"distinct": {
"ip": 1,
"title": 1
},
"aggs": {
"countries": [],
"title": [
{
"count": 1,
"name": "RouterOS router configuration page"
}
]
},
"lastupdatetime": "2022-06-11 07:00:00"
}
```
| 字段名 | 描述 |
| :------: | :-------------------------------------------------------: |
| distinct | 唯一计数 支持字段: ip, server, icp, domain,title,host,fid |
| aggs | 聚合信息 |
### 说明
`handle.search_stats(query_text)`中,可以指定的传参如下:
```python
handle.search(query_text, field)
```
| 参数名 | 是否可空 | 默认值 | 传参类型 | 解释 |
| :--------: | :------: | :----------------------: | :------: | ------------------------------------------------------------ |
| query_text | 否 | 无 | string | 需要进行查询的语句,即输入的查询内容 |
| field | 是 | `['ip', 'host', 'port']` | list | 可选字段,默认title,详见[附录2](https://fofa.info/api/stats/statistical)或文末附录 |
## Host聚合
根据当前的查询内容,生成聚合信息,host通常是ip,包含基础信息和IP标签。该接口限制请求并发为 1s/次。
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.search_host('78.48.50.249'))
```
### 返回信息
```json
{
"error": false,
"host": "78.48.50.249",
"ip": "78.48.50.249",
"asn": 6805,
"org": "Telefonica Germany",
"country_name": "Germany",
"country_code": "DE",
"protocol": [
"http",
"sip",
"https"
],
"port": [
8089,
5060,
7170,
80,
443
],
"category": [
"CMS"
],
"product": [
"Synology-WebStation"
],
"update_time": "2022-12-29 05:00:00"
}
```
当detail=false时,默认为普通模式,返回结果如下:
| 字段名 | 描述 |
| :------: | :------: |
| port | 端口列表 |
| protocol | 协议列表 |
| domain | 域名列表 |
| categor | 分类标签 |
| product | 产品标签 |
当detail=true时,默认为详情模式,返回结果如下:
| 字段名 | 描述 |
| :------------: | :----------------------------------------------------------: |
| products | 产品详情列表 |
| product | 产品名 |
| category | 产品分类 |
| leve | l产品分层: 5 应用层, 4 支持层, 3 服务层,2 系统层, 1 硬件层, 0 无组件分层 |
| soft_hard_code | 产品是否为硬件;值为 1 是硬件,否则为非硬件 |
### 说明
`handle.search_stats(query_text)`中,可以指定的传参如下:
```python
handle.search_host(host, detail=False)
```
| 参数名 | 是否可空 | 默认值 | 传参类型 | 解释 |
| :----: | :------: | :----: | :------: | ---------------- |
| host | 否 | 无 | string | host名,通常是ip |
| detail | 是 | false | boolean | 显示端口详情 |
## 获取用户名
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.username)
```
### 返回信息
```
Moxin
```
**(具体会返回用户名)**
## 获取F币数量
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.fcoin)
```
### 返回信息
```
48
```
**(这里是整数型哦)**
## 获取VIP状态
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.isvip)
```
### 返回信息
```
true
```
**(这里是布尔型)**
## 获取VIP等级
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.viplevel)
```
### 返回信息
```
2
```
**(这里是整数型哦)**
## 获取头像链接
### 代码示例
```python
import pythonfofa
handle = pythonfofa.Client('email','key')
print(handle.avatar)
```
### 返回信息
```http
https://i.nosec.org/avatar/system/users/avatars/100/083/883/medium/3774a8c7500fc0a110aa957a1a3040c2_1.jpg?1671089293
```
**(这里是String哦)**
> **声明:通过上述方法进行`获取用户名`、`获取F币数量`、`获取VIP状态`、`获取VIP等级`、`获取头像链接`均不需要再次请求,变量是在初始化Client中默认进行并存储的,所以不会再次产生资源消耗。**
# 使用
------
### 依赖
------
#### 需要安装的库
```bash
pip install requests
```
#### 一般不需要安装的库
```
json、base64、urllib
```
------
### 环境
------
#### 开发环境
```
Win11 + Python3.10 + PyCharm 2022.2.3 (Professional Edition)
```
#### 使用环境
支持`python2.7+` 、`Python 3.x`环境
# 附录
## 查询接口(FOFA附录1)
| 序号 | 字段名 | 描述 | 权限 |
| :--: | :-------------: | :---------------------------------------------: | :------: |
| 1 | ip | ip地址 | 无 |
| 2 | port | 端口 | 无 |
| 3 | protocol | 协议名 | 无 |
| 4 | country | 国家代码 | 无 |
| 5 | country_name | 国家名 | 无 |
| 6 | region | 区域 | 无 |
| 7 | city | 城市 | 无 |
| 8 | longitude | 地理位置 经度 | 无 |
| 9 | latitude | 地理位置 纬度 | 无 |
| 10 | as_number | asn编号 | 无 |
| 11 | as_organization | asn组织 | 无 |
| 12 | host | 主机名 | 无 |
| 13 | domain | 域名 | 无 |
| 14 | os | 操作系统 | 无 |
| 15 | server | 网站server | 无 |
| 16 | icp | icp备案号 | 无 |
| 17 | title | 网站标题 | 无 |
| 18 | jarm | jarm 指纹 | 无 |
| 19 | header | 网站header | 无 |
| 20 | banner | 协议 banner | 无 |
| 21 | cert | 证书 | 无 |
| 22 | body | 网站正文内容 | 企业会员 |
| 23 | fid | fid | 企业会员 |
| 24 | structinfo | 结构化信息 (部分协议支持、比如elastic、mongodb) | 企业会员 |
## 聚合接口统计(FOFA附录2)
| 序号 | 字段名 | 描述 | 权限 |
| :--: | :-------------: | :-------------: | :--: |
| 1 | protocol | 协议 | 无 |
| 2 | domain | 域名 | 无 |
| 3 | port | 端口 | 无 |
| 4 | title | http 标题 | 无 |
| 5 | os | 操作系统 | 无 |
| 6 | server | http server信息 | 无 |
| 7 | country | 国家、城市统计 | 无 |
| 8 | as_number | asn编号 | 无 |
| 9 | as_organization | asn组织 | 无 |
| 10 | asset_type | 资产类型 | 无 |
| 11 | fid | fid 统计 | 无 |
| 12 | icp | icp备案信息 | 无 |
# pythonfofa
pythonfofa是在PyPi中的一个库,与本仓库类似,但是只是定义email、key和proxy的方式不同,等待更新。
Raw data
{
"_id": null,
"home_page": "https://github.com/Moxin1044/pythonfofa",
"name": "pythonfofa",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Moxin",
"author_email": "1044631097@qq.com",
"download_url": "https://files.pythonhosted.org/packages/68/04/4235a63ac5a557a516b7cfe040dc3c69e701e56a03733a6d4c277b70c672/pythonfofa-1.0.8.tar.gz",
"platform": null,
"description": "# pythonfofa - \u4e00\u4e2a\u65b9\u4fbf\u4f60\u5728Python\u4e2d\u4f7f\u7528fofa\u7684\u5e93\r\n\r\n### FOFA API\r\n\r\n[`FOFA API`](https://fofa.info/api) \u662f\u8d44\u4ea7\u641c\u7d22\u5f15\u64ce [`FOFA `](https://fofa.info/) \u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u7684 RESTful API\u63a5\u53e3, \u5141\u8bb8\u5f00\u53d1\u8005\u5728\u81ea\u5df1\u7684\u9879\u76ee\u4e2d\u96c6\u6210 FOFA \u7684\u529f\u80fd\u3002\r\n\r\n------\r\n\r\n### Pythonfofa\r\n\r\n\u4ee5[Pyfofa](https://github.com/Moxin1044/pyfofa)\u6784\u5efa\u7684Python\u5305\uff0c\u547d\u540d\u4e3apythonfofa\r\n\r\n# \u8c03\u7528\u65b9\u6cd5\r\n\r\n## \u5b89\u88c5\r\n\r\n```python\r\npip install pythonfofa\r\n```\r\n\r\n## \u4f7f\u7528\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key') # \u5982\u679c\u9700\u8981\u5b9a\u4e49\u4ee3\u7406\uff0c\u5219\u9700\u8981\u4f7f\u7528pythonfofa.Client('email','key'\uff0cp,proxy)\r\nprint(handle.userinfo())\r\n```\r\n\r\n| `Email` | \u7528\u6237\u767b\u9646 `FOFA ` \u4f7f\u7528\u7684`Email` |\r\n| :-------: | :----------------------------------------------------------- |\r\n| `Key` | \u524d\u5f80 [**`\u4e2a\u4eba\u4e2d\u5fc3`**](https://fofa.info/userInfo) \u67e5\u770b `API Key` |\r\n| `api_url` | \u6ca1\u6709\u4e8b\u60c5\u8bf7\u4e0d\u8981\u4fee\u6539\u54e6\uff0c\u8fd9\u91cc\u662fFOFA\u7684API\u8bf7\u6c42\u5730\u5740 |\r\n| `proxy` | \u7528\u6237\u5b9a\u4e49\u7684\u4ee3\u7406\uff0c\u683c\u5f0f\u4e3a`127.0.0.1:8080`\uff0c\u5982\u65e0\u9700\u4ee3\u7406\uff0c\u8bf7\u8bbe\u7f6e\u4e3a\u7a7a |\r\n\r\n#### \u68c0\u67e5Fofa\u914d\u7f6e\r\n\r\n------\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.check_fofa_config())\r\n```\r\n\r\n\u53ea\u9700\u8981\u6309\u7167\u4e0a\u8ff0\u65b9\u6cd5\u914d\u7f6e\uff0c\u5373\u53ef\u68c0\u67e5\u914d\u7f6e\u4fe1\u606f\u3002\u4f1a\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u4f60\u5f53\u524d\u7684`email`\u3001`key`\u548c`proxy`\u3002\r\n\r\n\u5f53\u7136\uff0c\u6bcf\u6b21\u6267\u884c\u524d\u90fd\u4f1a\u81ea\u52a8\u6267\u884c\u4e00\u6b21get_userinfo()\uff0c\u4f1a\u6839\u636e\u60a8\u5728config.json\u4e2d\u586b\u5199\u7684email\u548ckey\u8fdb\u884c\u83b7\u53d6\u4fe1\u606f\u3002\r\n\r\n# \u8c03\u7528\u793a\u4f8b\r\n\r\n---\r\n\r\n## \u8bfb\u53d6\u7528\u6237\u4fe1\u606f\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.userinfo())\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```json\r\n{\r\n \"error\": false,\r\n \"email\": \"****@qq.com\",\r\n \"username\": \"***\",\r\n \"fcoin\": 48,\r\n \"isvip\": true,\r\n \"vip_level\": 2,\r\n \"is_verified\": false,\r\n \"avatar\": \"https://i.nosec.org/avatar/system/****\",\r\n \"message\": \"\",\r\n \"fofacli_ver\": \"4.0.3\",\r\n \"fofa_server\": true\r\n}\r\n```\r\n\r\n---\r\n\r\n## \u67e5\u8be2\u63a5\u53e3\r\n\r\n\u63d0\u4f9b\u641c\u7d22\u4e3b\u673a\u3001\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u7684\u65b9\u6cd5\uff0c\u4f7f\u5f00\u53d1\u66f4\u5bb9\u6613\u3002\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```Python\r\nimport pythonfofa\r\n\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.search('title=\"bing\"'))\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```json\r\n{\r\n \"error\": false,\r\n \"size\": 8683,\r\n \"page\": 1,\r\n \"mode\": \"extended\",\r\n \"query\": \"title\\u003d\\\"bing\\\"\",\r\n \"results\": [\r\n [\r\n \"46.101.204.107\",\r\n \"hotel-bing.hotels-rimini-it.com\",\r\n \"80\"\r\n ],\r\n [\r\n \"104.21.32.129\",\r\n \"https://peapix.com\",\r\n \"443\"\r\n ],\r\n [\r\n \"193.8.37.83\",\r\n \"https://www.thorsmindecamping.dk\",\r\n \"443\"\r\n ]\r\n ]\r\n}\r\n```\r\n\r\n**\u6ce8\u610f\uff1a\u8fd9\u91cc\u56e0\u4e3a\u8fd4\u56de\u7ed3\u679c\u8fc7\u591a\uff0c\u6240\u4ee5\u4fee\u6539\u4e86\u4e00\u4e0b**\r\n\r\n\r\n\r\n### \u8bf4\u660e\r\n\r\n`handle.search(query_text)`\u4e2d\uff0c\u53ef\u4ee5\u6307\u5b9a\u7684\u4f20\u53c2\u5982\u4e0b\uff1a\r\n\r\n```python\r\nhandle.search(query_text, field, page, size, full)\r\n```\r\n\r\n| \u53c2\u6570\u540d | \u662f\u5426\u53ef\u7a7a | \u9ed8\u8ba4\u503c | \u4f20\u53c2\u7c7b\u578b | \u89e3\u91ca |\r\n| :--------: | :------: | :----------------------: | :------: | ------------------------------------------------------------ |\r\n| query_text | \u5426 | \u65e0 | string | \u9700\u8981\u8fdb\u884c\u67e5\u8be2\u7684\u8bed\u53e5,\u5373\u8f93\u5165\u7684\u67e5\u8be2\u5185\u5bb9 |\r\n| field | \u662f | `['ip', 'host', 'port']` | list | \u53ef\u9009\u5b57\u6bb5\uff0c\u9ed8\u8ba4host,ip,port\uff0c\u8be6\u89c1[\u9644\u5f551](https://fofa.info/api)\u6216\u6587\u672b\u9644\u5f55 |\r\n| page | \u662f | 1 | int | \u662f\u5426\u7ffb\u9875\uff0c\u9ed8\u8ba4\u4e3a\u7b2c\u4e00\u9875\uff0c\u6309\u7167\u66f4\u65b0\u65f6\u95f4\u6392\u5e8f |\r\n| size | \u662f | 100 | int | \u6bcf\u9875\u67e5\u8be2\u6570\u91cf\uff0c\u9ed8\u8ba4\u4e3a100\u6761\uff0c\u6700\u5927\u652f\u630110,000\u6761/\u9875 |\r\n| full | \u662f | False | boolean | \u9ed8\u8ba4\u641c\u7d22\u4e00\u5e74\u5185\u7684\u6570\u636e\uff0c\u6307\u5b9a\u4e3atrue\u5373\u53ef\u641c\u7d22\u5168\u90e8\u6570\u636e |\r\n\r\n**\u6ce8\u610f\uff1a\u8fd9\u91cc\u7684field\u53c2\u6570\u9700\u8981\u4f7f\u7528list\u4f20\u53c2\u54e6**\uff0cquery_text\u65e0\u9700\u518dbase64\u7f16\u7801\u3002\r\n\r\n#### \u6f14\u793a1.\u67e5\u8be2\u57df\u540d\u201cqq.com\u201d\r\n\r\n```python\r\nhandle.search('domain=\"qq.com\"')\r\n```\r\n\r\n#### \u6f14\u793a2.\u67e5\u8be2\u57df\u540d\u201cqq.com\u201d\u7684\u7b2c\u4e8c\u9875\r\n\r\n```python\r\nhandle.search('domain=\"qq.com\"',page=2)\r\n```\r\n\r\n#### \u6f14\u793a3.\u67e5\u8be210\u4e2a\u57df\u540d\u6709\u5173\u201cqq.com\u201d\u7684\u8d44\u4ea7\r\n\r\n```python\r\nhandle.search('domain=\"qq.com\"',size=10)\r\n```\r\n\r\n#### \u6f14\u793a4.\u67e5\u8be210\u4e2a\u57df\u540d\u6709\u5173\u201cqq.com\u201d\u7684\u8d44\u4ea7\uff0c\u5e76\u4e14\u83b7\u53d6\u5176IP\u3001\u7aef\u53e3\u3001\u6807\u9898\u548cICP\u5907\u6848\u53f7\r\n\r\n```python\r\nfield = ['ip','port','title','icp']\r\nhandle.search('domain=\"qq.com\"',field=field,size=10)\r\n```\r\n\r\n**\u6ce8\u610f\uff1ahandle\u4e3a`handle = fofa.Client()`\uff0c\u5728\u73af\u5883\u4e2d\u8bf7\u4e0d\u8981\u5fd8\u4e86\u52a0\u4e0a\u4ed6\u54e6\uff01**\r\n\r\n------\r\n\r\n## \u7edf\u8ba1\u805a\u5408\r\n\r\n\u6839\u636e\u5f53\u524d\u7684\u67e5\u8be2\u5185\u5bb9\uff0c\u751f\u6210\u5168\u7403\u7edf\u8ba1\u4fe1\u606f\uff0c\u5f53\u524d\u53ef\u7edf\u8ba1\u6bcf\u4e2a\u5b57\u6bb5\u7684\u524d5\u6392\u540d\u3002\u8be5\u63a5\u53e3\u9650\u5236\u8bf7\u6c42\u5e76\u53d1\u4e3a 5\u79d2/\u6b21\u3002\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```Python\r\nimport pythonfofa\r\n\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.search_stats('ip=\"103.35.168.38\"'))\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```json\r\n{\r\n \"error\": false,\r\n \"distinct\": {\r\n \"ip\": 1,\r\n \"title\": 1\r\n },\r\n \"aggs\": {\r\n \"countries\": [],\r\n \"title\": [\r\n {\r\n \"count\": 1,\r\n \"name\": \"RouterOS router configuration page\"\r\n }\r\n ]\r\n },\r\n \"lastupdatetime\": \"2022-06-11 07:00:00\"\r\n}\r\n```\r\n\r\n| \u5b57\u6bb5\u540d | \u63cf\u8ff0 |\r\n| :------: | :-------------------------------------------------------: |\r\n| distinct | \u552f\u4e00\u8ba1\u6570 \u652f\u6301\u5b57\u6bb5: ip, server, icp, domain,title,host,fid |\r\n| aggs | \u805a\u5408\u4fe1\u606f |\r\n\r\n### \u8bf4\u660e\r\n\r\n`handle.search_stats(query_text)`\u4e2d\uff0c\u53ef\u4ee5\u6307\u5b9a\u7684\u4f20\u53c2\u5982\u4e0b\uff1a\r\n\r\n```python\r\nhandle.search(query_text, field)\r\n```\r\n\r\n| \u53c2\u6570\u540d | \u662f\u5426\u53ef\u7a7a | \u9ed8\u8ba4\u503c | \u4f20\u53c2\u7c7b\u578b | \u89e3\u91ca |\r\n| :--------: | :------: | :----------------------: | :------: | ------------------------------------------------------------ |\r\n| query_text | \u5426 | \u65e0 | string | \u9700\u8981\u8fdb\u884c\u67e5\u8be2\u7684\u8bed\u53e5,\u5373\u8f93\u5165\u7684\u67e5\u8be2\u5185\u5bb9 |\r\n| field | \u662f | `['ip', 'host', 'port']` | list | \u53ef\u9009\u5b57\u6bb5\uff0c\u9ed8\u8ba4title\uff0c\u8be6\u89c1[\u9644\u5f552](https://fofa.info/api/stats/statistical)\u6216\u6587\u672b\u9644\u5f55 |\r\n\r\n## Host\u805a\u5408\r\n\r\n\u6839\u636e\u5f53\u524d\u7684\u67e5\u8be2\u5185\u5bb9\uff0c\u751f\u6210\u805a\u5408\u4fe1\u606f\uff0chost\u901a\u5e38\u662fip\uff0c\u5305\u542b\u57fa\u7840\u4fe1\u606f\u548cIP\u6807\u7b7e\u3002\u8be5\u63a5\u53e3\u9650\u5236\u8bf7\u6c42\u5e76\u53d1\u4e3a 1s/\u6b21\u3002\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.search_host('78.48.50.249'))\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```json\r\n{\r\n \"error\": false,\r\n \"host\": \"78.48.50.249\",\r\n \"ip\": \"78.48.50.249\",\r\n \"asn\": 6805,\r\n \"org\": \"Telefonica Germany\",\r\n \"country_name\": \"Germany\",\r\n \"country_code\": \"DE\",\r\n \"protocol\": [\r\n \"http\",\r\n \"sip\",\r\n \"https\"\r\n ],\r\n \"port\": [\r\n 8089,\r\n 5060,\r\n 7170,\r\n 80,\r\n 443\r\n ],\r\n \"category\": [\r\n \"CMS\"\r\n ],\r\n \"product\": [\r\n \"Synology-WebStation\"\r\n ],\r\n \"update_time\": \"2022-12-29 05:00:00\"\r\n}\r\n```\r\n\r\n\u5f53detail=false\u65f6\uff0c\u9ed8\u8ba4\u4e3a\u666e\u901a\u6a21\u5f0f\uff0c\u8fd4\u56de\u7ed3\u679c\u5982\u4e0b\uff1a\r\n\r\n| \u5b57\u6bb5\u540d | \u63cf\u8ff0 |\r\n| :------: | :------: |\r\n| port | \u7aef\u53e3\u5217\u8868 |\r\n| protocol | \u534f\u8bae\u5217\u8868 |\r\n| domain | \u57df\u540d\u5217\u8868 |\r\n| categor | \u5206\u7c7b\u6807\u7b7e |\r\n| product | \u4ea7\u54c1\u6807\u7b7e |\r\n\r\n\u5f53detail=true\u65f6\uff0c\u9ed8\u8ba4\u4e3a\u8be6\u60c5\u6a21\u5f0f\uff0c\u8fd4\u56de\u7ed3\u679c\u5982\u4e0b\uff1a\r\n\r\n| \u5b57\u6bb5\u540d | \u63cf\u8ff0 |\r\n| :------------: | :----------------------------------------------------------: |\r\n| products | \u4ea7\u54c1\u8be6\u60c5\u5217\u8868 |\r\n| product | \u4ea7\u54c1\u540d |\r\n| category | \u4ea7\u54c1\u5206\u7c7b |\r\n| leve | l\u4ea7\u54c1\u5206\u5c42\uff1a 5 \u5e94\u7528\u5c42\uff0c 4 \u652f\u6301\u5c42\uff0c 3 \u670d\u52a1\u5c42\uff0c2 \u7cfb\u7edf\u5c42\uff0c 1 \u786c\u4ef6\u5c42\uff0c 0 \u65e0\u7ec4\u4ef6\u5206\u5c42 |\r\n| soft_hard_code | \u4ea7\u54c1\u662f\u5426\u4e3a\u786c\u4ef6\uff1b\u503c\u4e3a 1 \u662f\u786c\u4ef6\uff0c\u5426\u5219\u4e3a\u975e\u786c\u4ef6 |\r\n\r\n\r\n\r\n### \u8bf4\u660e\r\n\r\n`handle.search_stats(query_text)`\u4e2d\uff0c\u53ef\u4ee5\u6307\u5b9a\u7684\u4f20\u53c2\u5982\u4e0b\uff1a\r\n\r\n```python\r\nhandle.search_host(host, detail=False)\r\n```\r\n\r\n| \u53c2\u6570\u540d | \u662f\u5426\u53ef\u7a7a | \u9ed8\u8ba4\u503c | \u4f20\u53c2\u7c7b\u578b | \u89e3\u91ca |\r\n| :----: | :------: | :----: | :------: | ---------------- |\r\n| host | \u5426 | \u65e0 | string | host\u540d\uff0c\u901a\u5e38\u662fip |\r\n| detail | \u662f | false | boolean | \u663e\u793a\u7aef\u53e3\u8be6\u60c5 |\r\n\r\n## \u83b7\u53d6\u7528\u6237\u540d\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.username)\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```\r\nMoxin\r\n```\r\n\r\n**(\u5177\u4f53\u4f1a\u8fd4\u56de\u7528\u6237\u540d)**\r\n\r\n## \u83b7\u53d6F\u5e01\u6570\u91cf\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.fcoin)\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```\r\n48\r\n```\r\n\r\n**\uff08\u8fd9\u91cc\u662f\u6574\u6570\u578b\u54e6\uff09**\r\n\r\n## \u83b7\u53d6VIP\u72b6\u6001\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.isvip)\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```\r\ntrue\r\n```\r\n\r\n**\uff08\u8fd9\u91cc\u662f\u5e03\u5c14\u578b\uff09**\r\n\r\n## \u83b7\u53d6VIP\u7b49\u7ea7\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.viplevel)\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```\r\n2\r\n```\r\n\r\n**\uff08\u8fd9\u91cc\u662f\u6574\u6570\u578b\u54e6\uff09**\r\n\r\n## \u83b7\u53d6\u5934\u50cf\u94fe\u63a5\r\n\r\n### \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nimport pythonfofa\r\n\r\nhandle = pythonfofa.Client('email','key')\r\nprint(handle.avatar)\r\n```\r\n\r\n### \u8fd4\u56de\u4fe1\u606f\r\n\r\n```http\r\nhttps://i.nosec.org/avatar/system/users/avatars/100/083/883/medium/3774a8c7500fc0a110aa957a1a3040c2_1.jpg?1671089293\r\n```\r\n\r\n**\uff08\u8fd9\u91cc\u662fString\u54e6\uff09**\r\n\r\n> **\u58f0\u660e\uff1a\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u8fdb\u884c`\u83b7\u53d6\u7528\u6237\u540d`\u3001`\u83b7\u53d6F\u5e01\u6570\u91cf`\u3001`\u83b7\u53d6VIP\u72b6\u6001`\u3001`\u83b7\u53d6VIP\u7b49\u7ea7`\u3001`\u83b7\u53d6\u5934\u50cf\u94fe\u63a5`\u5747\u4e0d\u9700\u8981\u518d\u6b21\u8bf7\u6c42\uff0c\u53d8\u91cf\u662f\u5728\u521d\u59cb\u5316Client\u4e2d\u9ed8\u8ba4\u8fdb\u884c\u5e76\u5b58\u50a8\u7684\uff0c\u6240\u4ee5\u4e0d\u4f1a\u518d\u6b21\u4ea7\u751f\u8d44\u6e90\u6d88\u8017\u3002**\r\n\r\n# \u4f7f\u7528\r\n\r\n------\r\n\r\n### \u4f9d\u8d56\r\n\r\n------\r\n\r\n#### \u9700\u8981\u5b89\u88c5\u7684\u5e93\r\n\r\n```bash\r\npip install requests\r\n```\r\n\r\n#### \u4e00\u822c\u4e0d\u9700\u8981\u5b89\u88c5\u7684\u5e93\r\n\r\n```\r\njson\u3001base64\u3001urllib\r\n```\r\n\r\n------\r\n\r\n### \u73af\u5883\r\n\r\n------\r\n\r\n#### \u5f00\u53d1\u73af\u5883\r\n\r\n```\r\nWin11 + Python3.10 + PyCharm 2022.2.3 (Professional Edition)\r\n```\r\n\r\n#### \u4f7f\u7528\u73af\u5883\r\n\r\n\u652f\u6301`python2.7+` \u3001`Python 3.x`\u73af\u5883\r\n\r\n# \u9644\u5f55\r\n\r\n## \u67e5\u8be2\u63a5\u53e3\uff08FOFA\u9644\u5f551\uff09\r\n\r\n| \u5e8f\u53f7 | \u5b57\u6bb5\u540d | \u63cf\u8ff0 | \u6743\u9650 |\r\n| :--: | :-------------: | :---------------------------------------------: | :------: |\r\n| 1 | ip | ip\u5730\u5740 | \u65e0 |\r\n| 2 | port | \u7aef\u53e3 | \u65e0 |\r\n| 3 | protocol | \u534f\u8bae\u540d | \u65e0 |\r\n| 4 | country | \u56fd\u5bb6\u4ee3\u7801 | \u65e0 |\r\n| 5 | country_name | \u56fd\u5bb6\u540d | \u65e0 |\r\n| 6 | region | \u533a\u57df | \u65e0 |\r\n| 7 | city | \u57ce\u5e02 | \u65e0 |\r\n| 8 | longitude | \u5730\u7406\u4f4d\u7f6e \u7ecf\u5ea6 | \u65e0 |\r\n| 9 | latitude | \u5730\u7406\u4f4d\u7f6e \u7eac\u5ea6 | \u65e0 |\r\n| 10 | as_number | asn\u7f16\u53f7 | \u65e0 |\r\n| 11 | as_organization | asn\u7ec4\u7ec7 | \u65e0 |\r\n| 12 | host | \u4e3b\u673a\u540d | \u65e0 |\r\n| 13 | domain | \u57df\u540d | \u65e0 |\r\n| 14 | os | \u64cd\u4f5c\u7cfb\u7edf | \u65e0 |\r\n| 15 | server | \u7f51\u7ad9server | \u65e0 |\r\n| 16 | icp | icp\u5907\u6848\u53f7 | \u65e0 |\r\n| 17 | title | \u7f51\u7ad9\u6807\u9898 | \u65e0 |\r\n| 18 | jarm | jarm \u6307\u7eb9 | \u65e0 |\r\n| 19 | header | \u7f51\u7ad9header | \u65e0 |\r\n| 20 | banner | \u534f\u8bae banner | \u65e0 |\r\n| 21 | cert | \u8bc1\u4e66 | \u65e0 |\r\n| 22 | body | \u7f51\u7ad9\u6b63\u6587\u5185\u5bb9 | \u4f01\u4e1a\u4f1a\u5458 |\r\n| 23 | fid | fid | \u4f01\u4e1a\u4f1a\u5458 |\r\n| 24 | structinfo | \u7ed3\u6784\u5316\u4fe1\u606f (\u90e8\u5206\u534f\u8bae\u652f\u6301\u3001\u6bd4\u5982elastic\u3001mongodb) | \u4f01\u4e1a\u4f1a\u5458 |\r\n\r\n\r\n\r\n## \u805a\u5408\u63a5\u53e3\u7edf\u8ba1\uff08FOFA\u9644\u5f552\uff09\r\n\r\n| \u5e8f\u53f7 | \u5b57\u6bb5\u540d | \u63cf\u8ff0 | \u6743\u9650 |\r\n| :--: | :-------------: | :-------------: | :--: |\r\n| 1 | protocol | \u534f\u8bae | \u65e0 |\r\n| 2 | domain | \u57df\u540d | \u65e0 |\r\n| 3 | port | \u7aef\u53e3 | \u65e0 |\r\n| 4 | title | http \u6807\u9898 | \u65e0 |\r\n| 5 | os | \u64cd\u4f5c\u7cfb\u7edf | \u65e0 |\r\n| 6 | server | http server\u4fe1\u606f | \u65e0 |\r\n| 7 | country | \u56fd\u5bb6\u3001\u57ce\u5e02\u7edf\u8ba1 | \u65e0 |\r\n| 8 | as_number | asn\u7f16\u53f7 | \u65e0 |\r\n| 9 | as_organization | asn\u7ec4\u7ec7 | \u65e0 |\r\n| 10 | asset_type | \u8d44\u4ea7\u7c7b\u578b | \u65e0 |\r\n| 11 | fid | fid \u7edf\u8ba1 | \u65e0 |\r\n| 12 | icp | icp\u5907\u6848\u4fe1\u606f | \u65e0 |\r\n\r\n# pythonfofa\r\n\r\npythonfofa\u662f\u5728PyPi\u4e2d\u7684\u4e00\u4e2a\u5e93\uff0c\u4e0e\u672c\u4ed3\u5e93\u7c7b\u4f3c\uff0c\u4f46\u662f\u53ea\u662f\u5b9a\u4e49email\u3001key\u548cproxy\u7684\u65b9\u5f0f\u4e0d\u540c\uff0c\u7b49\u5f85\u66f4\u65b0\u3002\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "FOFA.info Python SDK",
"version": "1.0.8",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5442d26ba5eec418decbf4123d66ad20ea494d8205f6ceb57c12275f99a492ba",
"md5": "d8d11c39cda4d4cb62ac6aca91f3c1ca",
"sha256": "876dc51a92d31e3e0e44b7f8493ea45ba10fadbf9ff63874b39a8853673014c3"
},
"downloads": -1,
"filename": "pythonfofa-1.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8d11c39cda4d4cb62ac6aca91f3c1ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8652,
"upload_time": "2023-01-02T23:53:27",
"upload_time_iso_8601": "2023-01-02T23:53:27.918966Z",
"url": "https://files.pythonhosted.org/packages/54/42/d26ba5eec418decbf4123d66ad20ea494d8205f6ceb57c12275f99a492ba/pythonfofa-1.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "68044235a63ac5a557a516b7cfe040dc3c69e701e56a03733a6d4c277b70c672",
"md5": "23868320286e74b44aa54a68178c8d20",
"sha256": "ebe7a29bcb713cf1ecce60a869900d594a6b0f0168e25e758accd84e6c1167ad"
},
"downloads": -1,
"filename": "pythonfofa-1.0.8.tar.gz",
"has_sig": false,
"md5_digest": "23868320286e74b44aa54a68178c8d20",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7704,
"upload_time": "2023-01-02T23:53:29",
"upload_time_iso_8601": "2023-01-02T23:53:29.983108Z",
"url": "https://files.pythonhosted.org/packages/68/04/4235a63ac5a557a516b7cfe040dc3c69e701e56a03733a6d4c277b70c672/pythonfofa-1.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-02 23:53:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Moxin1044",
"github_project": "pythonfofa",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pythonfofa"
}