Skip to content

Commit

Permalink
添加360搜索以及修复每日一说.
Browse files Browse the repository at this point in the history
  • Loading branch information
nosafer committed Jan 26, 2022
1 parent 9371e86 commit bdd0f04
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Glass旨在帮助红队人员在资产信息收集期间能够快速从C段、
## 二、更新日志:

### 正式版
* 2.0.7 添加360(Quake)搜索引擎(https://quake.360.cn/quake/welcome),取消默认搜索,必须指定搜索参数`-s`[eye(钟馗之眼)、fofa(Fofa)、qk(Quake)],修复每日一说
* 2.0.6 更改默认搜索设置,添加哪个`api`就会默认调用哪个,不需要指定,如果有多个`api``-s`指定
* 2.0.5 添加自定义搜索(-s,--search)
1. 添加钟馗之眼(https://www.zoomeye.org/)搜索
Expand Down
4 changes: 3 additions & 1 deletion config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
shodanApi = ""

fofaSize = 100
quakeSize = 500

threadNum = 100

ZIPBALL_PAGE = "https://github.com/s7ckTeam/Glass/zipball/main"
GIT_REPOSITORY = "https://github.com/s7ckTeam/Glass.git"
Website = "http://www.s7ck.com/"
Team = "s7ck Team"
Version = "2.0.6"
Version = "2.0.7"

Banner = ['''\033[1;31m
_____ _
Expand Down
8 changes: 4 additions & 4 deletions config/tosay.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def todaySay():
try:
with open(files, 'r', encoding="utf-8") as f:
today = json.load(f)
content = today['data']['content']
translation = today['data']['translation']
author = "--- {0}".format(today['data']['author'])
content = today['content']
translation = today['translation']
author = "--- {0}".format(today['author'])
todaySays = '''
{0}
Expand All @@ -50,7 +50,7 @@ def todaySay():
def getpage(files):
try:
req = requests.get(
"https://rest.shanbay.com/api/v2/quote/quotes/today/", timeout=5)
"https://apiv3.shanbay.com/weapps/dailyquote/quote/", timeout=5)
with open(files, 'w', encoding="utf-8") as f:
f.write(req.text)
except requests.exceptions.ConnectionError:
Expand Down
22 changes: 9 additions & 13 deletions lib/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import prettytable as pt
from mod.fofa import fmain
from mod.zoomeye import zmain
from mod.quake import qmain
from mod.website import mwebs
from mod.rulesCli import ruleMain
from mod.output import outMain
Expand Down Expand Up @@ -89,11 +90,11 @@ def set_confs():
logger.info("Version: {0}".format(Version))
exit(0)
if confs.search:
searchType = ["fofa", "eye"]
searchType = ["fofa", "eye", "qk"]
if confs.search in set(searchType):
pass
else:
logger.error("参数错误,e.g.(-s fofa or -s eye)")
logger.error("参数错误,e.g.(-s fofa or -s eye or -s qk)")
exit(0)
if confs.outputTarget:
outTypes = ["txt", "json", "html", "xls", "csv"]
Expand Down Expand Up @@ -172,20 +173,15 @@ def runmod():
if confs.search == "fofa":
logger.info("调用Fofa接口中")
fmain(Urls.ips)
else:
if confs.search == "eye":
logger.info("调用Zoomeye接口中")
zmain(Urls.ips)
if confs.search == "qk":
logger.info("调用Quake接口中")
qmain(Urls.ips)
else:
if fofaApi['email'] and fofaApi['key']:
logger.info("调用Fofa接口中")
fmain(Urls.ips)
elif zoomeyeApi:
logger.info("调用Zoomeye接口中")
zmain(Urls.ips)
else:
logger.warning(
"请修改配置文件{0}中fofaApi或者zoomeyeApi为您的API地址".format(Paths.config_py))
exit(0)
logger.error("参数错误,e.g.(-s fofa or -s eye or -s qk)")
exit(0)
if Urls.url:
mwebs()
if WebInfos:
Expand Down
125 changes: 125 additions & 0 deletions mod/quake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# /usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : quake.py
@Time : 2022/01/26 16:08:24
@Author: Morker
@Blog : https://96.mk/
@Email : [email protected]
If you don't go through the cold, you can't get the fragrant plum blossom.
'''

import json
import time
import base64
import random
import requests
import threading
import prettytable as pt
from requests.adapters import HTTPAdapter
from config.config import quakeApi, quakeSize
from config.config import USER_AGENTS, pyVersion
from config.colors import mkPut
from config.config import threadNum
from config.data import Urls, Paths, Proxys, logger

lock = threading.Lock()


class Quake(threading.Thread):
def __init__(self, ip, sem):
super(Quake, self).__init__()
self.ip = ip
self.sem = sem
self.url = "https://quake.360.cn/api/v3/search/quake_service"
self.headers = {
"User-Agent": random.choice(USER_AGENTS),
"X-QuakeToken": quakeApi,
}
self.jsonData = {
"query": self.ip,
"start": 0,
"size": quakeSize,
}

def run(self):
try:
req = requests.Session()
req.keep_alive = False
req.headers = self.headers
if Proxys.proxyList:
if pyVersion < "3.8":
req.proxies = {'https': '{0}'.format(
random.choice(Proxys.scheme))}
else:
req.proxies = {
"https": 'https://{0}'.format(random.choice(Proxys.scheme))}
req.mount("https://", HTTPAdapter(max_retries=2))
target = req.post(self.url, json=self.jsonData)
lock.acquire()
logger.info("正在检测IP: {0}".format(self.ip))
logger.info("正在通过API获取信息...")
datas = json.loads(target.text)
if datas['code'] == 1:
logger.warning("接口积分不足")
if datas['code'] == 2:
logger.warning("限速了,请等待")
self.ipInfo(datas['data'])
req.close()
lock.release()
except requests.exceptions.ReadTimeout:
logger.error("请求超时")
except requests.exceptions.ConnectionError:
logger.error("网络超时")
except json.decoder.JSONDecodeError:
logger.error("获取失败,请重试")
lock.release()
self.sem.release()

def ipInfo(self, datas):
logger.info("Success")
tb = pt.PrettyTable()
tb.field_names = ['IP', 'Port', 'Protocol', 'Title']
logger.info("Url信息:")

for data in datas:
ip = data['ip']
port = data['port']
protocol = data['service']['name']
if 'http' in data['service']:
title = data['service']['http']['title']
if protocol == "http":
qkurl = "http://{0}:{1}/".format(ip, port)
if protocol == "http/ssl":
qkurl = "https://{0}:{1}/".format(ip, port)
logger.info(qkurl)
Urls.url.append(qkurl)
else:
title = "None"
tb.add_row([ip, port, protocol, title])
Urls.url = list(dict.fromkeys(Urls.url))
logger.info("全部信息:")
print(tb)
print()


def qmain(ips):
if quakeApi:
pass
else:
logger.warning("请修改配置文件{0}中quakeApi为您的API地址".format(Paths.config_py))
exit(0)
threads = []
sem = threading.Semaphore(threadNum)
try:
for ip in ips:
sem.acquire()
t = Quake(ip, sem)
t.setDaemon(True)
threads.append(t)
t.start()
for t in threads:
t.join()
except KeyboardInterrupt:
pass

0 comments on commit bdd0f04

Please sign in to comment.