免责声明:由于传播、利用本公众号Z1sec所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,公众号及作者不为此承担任何责任,一旦造成后果请自行承担!如有侵权烦请告知,我们会立即删除并致歉。谢谢!
某企查Hook BypassDev自动查公司
需要工具
-
• 油猴插件 -
• selenium
前言
enscan是个很好的工具,可是现在反爬技术日益增长,导致enscan不少时候都无法正常使用,例如某企查的功能,对于安全从业者而言会比较难顶,所以鄙人写了个工具。
使用教程
打开油猴管理面板,点击左边加号
将我的脚本粘贴进去并保存:
// ==UserScript==// @name 某企查禁用开发者工具检测// @namespace http://tampermonkey.net/// @version 0.1// @description 绕过页面开发者工具检测逻辑,建议需要时才开启,欢迎关注公众号【z1sec】// @author z1// @match *://*/*// @grant none// @run-at document-start// ==/UserScript==(function() {'use strict';// 方法一:设置 localStorage 触发忽略条件localStorage.setItem('devtool', 'open');// 方法二:劫持检测函数配置const originalS = window.s;window.s = function() {returnfunction(config) {if (!config) return;// 强制忽略所有检测条件 config.ignore = () =>true;// 禁用开发者工具打开时的回调 config.ondevtoolopen = function(t, e) {console.log('Devtools detection bypassed'); e = () => {}; // 禁用回调函数// 移除跳转逻辑 };// 禁用定时器清理 config.clearIntervalWhenDevOpenTrigger = false;// 如果需要保持原始逻辑可调用原始函数// if (originalS) originalS(config); }; };// 方法三:防止原型检测(可选)Object.defineProperty(window, 'console', {value: console,writable: false,configurable: false });})();
勾选,开启此插件(注意:不用的时候可以把此插件关闭,可能会影响其他网站正常访问)
访问爱企查
此时打开控制台将不受限制
接着重新启动你的浏览器,此步骤需要你的环境可以正常使用selenium可以参考:https://blog.csdn.net/tong117/article/details/118891885或google搜索:selenium 浏览器debug
我监听的是65003端口
启动后跳出浏览器,运行此脚本,如果有模块没安装请自行安装:
python3 search.py
脚本内容:
import timeimport jsonimport threadingimport requestsimport websocketsimport base64import randomfrom selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.common.exceptions import NoSuchElementExceptionimport asynciofrom urllib.parse import quote, unquote# 初始化浏览器options = webdriver.ChromeOptions()options.add_argument('--ignore-certificate-errors')options.add_experimental_option("debuggerAddress", "127.0.0.1:65003")options.set_capability("goog:loggingPrefs", {"performance": "ALL"})driver = webdriver.Chrome(options=options)driver.execute_cdp_cmd("Network.enable", {})request_url_map = {}processed_responses = set()# 异步网络监听函数(在线程中运行)defcapture_traffic():print("✅ 网络监听已启动...")""" 后台线程轮询 performance 日志,实现实时捕获指定网络请求及对应响应体。 """whileTrue:try: logs = driver.get_log("performance")except Exception as e:print("获取日志出错:", e)breakfor entry in logs:try: message = json.loads(entry["message"])["message"]except Exception:continue# 记录请求事件,保存 requestId 与 URL 映射if message.get("method") == "Network.requestWillBeSent": params = message.get("params", {}) request_id = params.get("requestId") request_url = params.get("request", {}).get("url", "")if request_id and request_url: request_url_map[request_id] = request_url# 捕获响应事件elif message.get("method") == "Network.responseReceived": params = message.get("params", {}) request_id = params.get("requestId")if request_id in processed_responses:continue# 已处理过的响应跳过 request_url = request_url_map.get(request_id, "")if"advanceFilterAjax"in request_url:# 实时输出匹配到的请求 URLprint("n⚡️ 匹配到 URL:", request_url)try: response = driver.execute_cdp_cmd("Network.getResponseBody", {"requestId": request_id} ) res_body = json.loads(response['body'])for i in res_body['data']['resultList']:print(i["pid"] , "|", i["entName"].replace("</em>", "").replace("<em>", "") , "|", i["entType"] , "|", i["domicile"] , "|", i["openStatus"] , "|", i["legalPerson"] , "|", i["titleName"] , "|", i["regCap"] , "|", i["email"] , "|", i["telephone"] )withopen("out.txt", 'a') as f: f.write("{}".format(i["pid"] + "|"+ i["entName"].replace("</em>", "").replace("<em>", "") + "|"+ i["entType"] + "|"+ i["domicile"] + "|"+ i["openStatus"] + "|"+ i["legalPerson"] + "|"+ i["titleName"].replace("</em>", "").replace("<em>", "") + "|"+ i["regCap"] + "|"+ i["email"] + "|"+ i["telephone"] + "n")) f.close()except Exception as e:print(f"获取 requestId {request_id} 的响应体时出错:", e)# 标记该 response 已处理 processed_responses.add(request_id)# 控制轮询频率,可根据实际情况调整 time.sleep(0.5)definit_browser_action(target_name): url = "https://aiqicha.baidu.com/s?q={}&t=0".format(quote(target_name)) driver.get(url) time.sleep(5) # 等待加载完结果 page_data_json = driver.execute_script("return JSON.stringify(window.pageData);") page_data = json.loads(page_data_json)# print(page_data['result']['resultList'])for i in page_data['result']['resultList']:print(i["pid"] , "|", i["entName"].replace("</em>", "").replace("<em>", "") , "|", i["entType"] , "|", i["domicile"] , "|", i["openStatus"] , "|", i["legalPerson"] , "|", i["titleName"] , "|", i["regCap"] , "|", i["email"] , "|", i["telephone"] )withopen("out.txt", 'a') as f: f.write("{}".format(i["pid"] + "|"+ i["entName"].replace("</em>", "").replace("<em>", "") + "|"+ i["entType"] + "|"+ i["domicile"] + "|"+ i["openStatus"] + "|"+ i["legalPerson"] + "|"+ i["titleName"].replace("</em>", "").replace("<em>", "") + "|"+ i["regCap"] + "|"+ i["email"] + "|"+ i["telephone"] + "n")) f.close()ifint(page_data['result']['totalNum']) > 10:return [True, int(page_data['result']['totalNum'])]else:return [False, int(page_data['result']['totalNum'])]defrunStep(num):try:print(f"n🪡 数量:{num}, 需点击次数:{(num//10)}")for i inrange(1,(num//10)+1): time.sleep(random.randint(3, 7)) driver.find_element(By.XPATH, '//li[@title="下一页"]').click() time.sleep(1)except NoSuchElementException:print("元素不存在")if __name__ == "__main__":try:# 启动抓包线程 threading.Thread(target=capture_traffic, daemon=True).start() time.sleep(2)# 等待用户输入并执行操作 target_name = input("请输入你要搜索的目标(例如:爱奇艺):").strip() pages_check = init_browser_action(target_name) time.sleep(2)if pages_check[0] == True: runStep(pages_check[1])# 防止主线程太早退出(你可以根据需要设置长一点)input("回车键退出程序...")except:pass
输出这个页面说明正常,接着输入你要搜索的名字并回车:
此时浏览器开始自动点击搜索:
命令行会输出:
跑结束或者异常时会停止获取,当前目录下会生成一个out.txt,里面就是搜索结果:
我就没写生成csv或者excel了,读者可以自行加功能,对于txt可以直接复制到execl中,使用“|”分列即可:
这样就分好了:
Bypass原理
其实原理很简单,常规的js逆向,打开控制台直接全部页面制空:
然后跳转:about:blank
检测控制台的功能在:index.086d760a5f5.js
直接把这段置为空即可,返回none
此时就可以用控制台了:
原文始发于微信公众号(Z1sec):【信息收集利器】渗透测试使用某企查自动化信息收集
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论