如何使用ODBParser搜索Elasticsearch和MongoDB目錄數(shù)據(jù)
關(guān)于ODBParser
ODBParser是一款公開資源情報工具,可以幫助廣大研究人員從Elasticsearch和MongoDB目錄中搜索、解析并導(dǎo)出我們感興趣的數(shù)據(jù)。除此之外,這款工具還可以幫助廣大研究人員從開放數(shù)據(jù)庫中搜索出曝光的個人可標(biāo)識信息(PII)。
ODBParser的主要目標(biāo)是創(chuàng)建一個一站式公開資源情報工具,用于搜索、解析和分析開放數(shù)據(jù)庫,以便識別第三方服務(wù)器上的PII泄漏。
功能介紹
(1) 識別開放數(shù)據(jù)庫
- 使用所有可行的參數(shù)查詢Shodan和BinaryEdge,可通過國家、端口號和其他內(nèi)容過濾查詢結(jié)果;
- 指定單個IP地址;
- 加載IP地址列表文件;
- 從剪貼板粘貼IP地址列表;
導(dǎo)出選項:
- 解析所有的數(shù)據(jù)庫/集合來識別指定的數(shù)據(jù);
- 獲取目標(biāo)服務(wù)器中托管的所有數(shù)據(jù);
- 獲取集合/索引數(shù)據(jù);
- 使用Ctrl + C跳過特定索引;
(2) 后滲透處理
- 將JSON導(dǎo)出數(shù)據(jù)轉(zhuǎn)換為CSV;
- 從CSV中移除特定的列;
(3) 其他功能
- 跟蹤查詢的所有IP地址和數(shù)據(jù)庫以及有關(guān)每個服務(wù)器的信息;
- 對于每個記錄總數(shù)超過限制的數(shù)據(jù)庫,腳本將在一個特殊文件中創(chuàng)建一個條目以及5個示例記錄,以便你可以查看并決定數(shù)據(jù)庫是否值得抓取;
- 默認(rèn)輸出是行分隔的JSON文件,每行上有一個JSON對象。你可以使用“properjson”標(biāo)志選擇讓它輸出一個“適當(dāng)?shù)腏SON”文件;
工具安裝
首先,我們需要使用下列命令將該項目源碼克隆至本地:
- git clone https://github.com/citcheese/ODBParser.git
接下來,我們需要自行獲取Shodan和BinaryEdge的API密鑰,并在ODBconfig.py文件中配置相應(yīng)的參數(shù)。
最后,根據(jù)項目目錄中的requirements.txt安裝并配置該工具所需的依賴組件。
我建議廣大研究人員創(chuàng)建一個ODBParser的虛擬環(huán)境,該工具目前盡在Windows 10(Python 3.7.3)環(huán)境中進(jìn)行過測試。
工具使用
- Examples: python ODBParser.py -cn US -p 8080 -t users --elastic --shodan --csv --limit 100
- python ODBParser.py -ip 192.168.2:8080 --mongo --ignorelogs --nosizelimits
- Damage to-date: 0 servers parsed | 0 databases dumped | 0 records pulled
- _____________________________________________________________________________
- optional arguments:
- -h, --help show this help message and exit
- Query Options:
- --shodan, -sh Add this flag if using Shodan. Specify ES or MDB w/
- flags.
- --binary, -be Add this flag if using BinaryEdge. Specify ES or MDB
- w/ flags.
- --ip , -ip Query one server. Add port like so '192.165.2.1:8080'
- or will use default ports for each db type. Add ES or
- MDB flags to specify parser.
- --file , -f Load line-separated IPs from file. Add port or will
- assume default ports for each db type. Add ES or MDB
- flags to specify parser.
- --paste, -v Query line-separated IPs from clipboard. Add port or
- will assume default ports for each db type, e.g. 9200
- for ES. Add ES or MDB flags to specify parser.
- Shodan/BinaryEdge Options:
- --limit , -l Max number of results per query. Default is
- 500.
- --port , -p Filter by port.
- --country , -cn Filter by country (two-letter country code).
- --terms , -t Enter any additional query terms you want here, e.g.
- 'users'
- Dump Options:
- --mongo, -mdb Use for IP, Shodan, BinaryEdge & Paste methods to
- specify parser.
- --elastic, -es Use for IP, Shodan, BinaryEdge & Paste methods to
- specify parser.
- --properjson, -pj Add this flag if would like out put to be proper JSON
- file. Default is one JSON string object per line.
- --database , -db Specify database you want to grab. For MDB must be in
- format format 'db:collection'. Use with IP arg & 'es'
- or 'mdb' flag
- --getall, -g Get all indices regardless of fields and
- collection/index names (overrides selections in config
- file).
- --ignorelogs Connect to a server you've already checked out.
- --nosizelimits, -n Dump index no matter how big it is. Default max doc
- count is 800,000.
- --csv Convert JSON dumps into CSV format on the fly. (Puts
- JSON files in backup folder in case there is issue
- with coversion)
- CSV/Post-processing Options:
- --convertToCSV , -c Convert JSON file or folder of JSON dumps to CSVs
- after the fact. Enter full path or folder name in
- current working directory
- --dontflatten Use if run into memory issues converting JSON files to
- CSV during post-processing.
- --basic Use with --convertToCSV flag if your JSON dumps are
- not true JSON files, but rather line separated JSON
- objects that you got from other sources.
- --dontclean, -dc Choose if want to keep useless data when convert to
- CSV. See docs for more info.
項目地址
ODBParser:【GitHub傳送門】