高哲技术博客 高哲技术博客
首页
编程
爬虫
运维
硬件
收藏
归档
关于

嘉美伯爵

前途光明,无需畏惧
首页
编程
爬虫
运维
硬件
收藏
归档
关于
  • 方案

  • 基础

    • mitmproxy案例汇总
    • 一体化mitmproxy方案
    • ebpf在爬虫和逆向中的应用
    • chrome之cookie hook方案
    • selenium如何操作cookie
    • Splash使用说明及实践
    • 如何使用cdp进行hook
      • 美团demo
      • 参考
    • 如何使用sekiro进行hook
  • 逆向

  • 改机多开

  • 自动化

  • 云手机

  • 验证码

  • 实战

  • 爬虫
  • 基础
fovegage
2023-06-08
目录

如何使用cdp进行hook

# 美团demo

def meituan():
    """
    需要管理 websocket 链接   这些websocket服务常驻
    :return:
    """
    signData = {
        "url": "https://i.waimai.meituan.com/tsp/open/openh5/home/shopList?set_name=&region_id=&_=1677641906206",
        "headers": {},
        "method": "post",
        "data": "optimus_code=10&optimus_risk_level=71&pageSize=20&page_index=0&offset=0&content_personalized_switch=0&sort_type=&slider_select_data=&activity_filter_codes=&wm_latitude=40105324&wm_longitude=116297288&wmUuidDeregistration=0&wmUserIdDeregistration=0&openh5_uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8&uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8"
    }
    # print(f'(await window.H5guard.sign({json.dumps(signData)}))')
    # const data = (async () => {
    #     return await CSVtoJSON().fromFile('./input.csv')
    # })
    js = '''
    (function (){
    var sign1 = "";
    let signData = {"url": "https://i.waimai.meituan.com/tsp/open/openh5/home/shopList?set_name=&region_id=&_=1677641906206", "headers": {}, "method": "post", "data": "optimus_code=10&optimus_risk_level=71&pageSize=20&page_index=0&offset=0&content_personalized_switch=0&sort_type=&slider_select_data=&activity_filter_codes=&wm_latitude=40105324&wm_longitude=116297288&wmUuidDeregistration=0&wmUserIdDeregistration=0&openh5_uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8&uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8"}
    H5guard.sign(signData).then((signreq) => {
        # sign1 = signreq;
        console.log(signreq)
    })
    # console.log(sign1)
    # return sign1;
    })()
    '''
    #     // H5guard.sign(signData).then((signreq) => { return JSON.stringify(signreq)})
    js1 = '''
    var signData = {"url": "https://i.waimai.meituan.com/tsp/open/openh5/home/shopList?set_name=&region_id=&_=1677641906206", "headers": {}, "method": "post", "data": "optimus_code=10&optimus_risk_level=71&pageSize=20&page_index=0&offset=0&content_personalized_switch=0&sort_type=&slider_select_data=&activity_filter_codes=&wm_latitude=40105324&wm_longitude=116297288&wmUuidDeregistration=0&wmUserIdDeregistration=0&openh5_uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8&uuid=18639df5e45c8-0c138b3ed7158a-16525635-16a7f0-18639df5e45c8"}
    H5guard.sign(signData).then((signreq) => { return signreq.headers.mtgsig})
    '''
    command = {
        'method': "Runtime.evaluate",
        'id': request_id,
        'params': {
            "expression": js1,
            "awaitPromise": True
        }
    }
    print(json.dumps(command))
    baidu = "ws://192.168.12.126:9222/devtools/page/7113CB96A91DBA00DD028A4F5AB2832D"
    # baidu = "ws://192.168.12.155:31333/devtools/page/D2964E71C1F9A6DD9E4C3084D9478E4A"
    conn = websocket.create_connection(baidu)
    conn.send(json.dumps(command))
    msg = json.loads(conn.recv())
    conn.close()
    print(msg)
    # print(msg['result']['result']['value'])
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

# 参考

https://github.com/Zenika/alpine-chrome
https://www.cnblogs.com/imgss/p/12852595.html
1
2
上次更新: 2023-09-07 10:49:42
Splash使用说明及实践
如何使用sekiro进行hook

← Splash使用说明及实践 如何使用sekiro进行hook→

最近更新
01
token embed和postion embed
06-10
02
k8s pod日志排查问题
10-24
03
golang内部私服建设方案
10-21
更多文章>
Theme by Vdoing | Copyright © 2018-2025 嘉美伯爵 | 鲁ICP备20001560号-4
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式