开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 394|回复: 10
收起左侧

[其它源码] 练手-js逆向-海外版携程-phantom-token (补环境)

[复制链接]
结帖率:95% (19/20)
发表于 4 天前 | 显示全部楼层 |阅读模式   广东省东莞市
分享源码
界面截图: -
是否带模块: -
备注说明: -
本帖最后由 xunhui 于 2025-4-12 20:57 编辑

练手,如若违规联删

VX截图_20250412173542.png
知识点
  • 代理的对象补环境,缺啥补啥
  • 检测点(tostring 有检测和原型链)
trip.zip (93.43 KB, 下载次数: 11)

结帖率:95% (19/20)

签到天数: 5 天

 楼主| 发表于 4 天前 | 显示全部楼层   广东省东莞市
[JavaScript] 纯文本查看 复制代码
const chalk = require("chalk")


function setProxy(obj, objNmae) {
    return new Proxy(obj, {
        apply: function (traget, thisArg, argList) {
            const result = Reflect.apply(traget, thisArg, argList)

            if (typeof result === "undefined") {
                console.log("CALL", "方法:", objNmae, "参数:", argList, "返回值类型:", chalk.red(typeof result));
            } else {
                console.log("CALL", "方法:", objNmae, "参数:", argList, "返回值类型:", typeof result);
            }

            return result
        },

        get: function (traget, proper, receiver) {

            const result = Reflect.get(traget, proper, receiver)
            if (proper === "Math") {
                return result
            }

            if (typeof result === "undefined") {
                console.log("GET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", chalk.red(typeof result));
            } else {
                console.log("GET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", typeof result);
            }


            return result

        },
        set: function (traget, proper, value, receiver) {
            const result = Reflect.set(traget, proper, value, receiver)
            console.log("SET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", typeof value);
            return result
        }

    })
}
window = setProxy(globalThis, "window")
// GET 对象: window 属性名称: CanvasRenderingContext2D 属性类型: string 属性值类型: undefined
// GET 对象: window 属性名称: HTMLCanvasElement 属性类型: string 属性值类型: undefined

function CanvasRenderingContext2D(canvas) {
    canvas: canvas
    // this.direction = "ltr"
    // this.fillStyle = "rgba(200, 200, 0, 0.5)"
    // this.filter = "none"
    // this.font = "100px Arial"
    // this.fontKerning = "auto"
    // this.fontStretch = "normal"
    // this.fontVariantCaps = "normal"
    // this.globalAlpha = 1
    // this.globalCompositeOperation = "source-over"
    // this.imageSmoothingEnabled = true
    // this.imageSmoothingQuality = "low"
    // this.letterSpacing = "0px"
    // this.lineCap = "butt"
    // this.lineDashOffset = 0
    // this.lineJoin = "miter"
    // this.lineWidth = 1
    // this.miterLimit = 10
    // this.shadowBlur = 0
    // this.shadowColor = "rgba(0, 0, 0, 0)"
    // this.shadowOffsetX = 0
    // this.shadowOffsetY = 0
    // this.strokeStyle = "#000000"
    // this.textAlign = "start"
    // this.textBaseline = "alphabetic"
    // this.textRendering = "auto"
    // this.wordSpacing = "0px"

}


window.CanvasRenderingContext2D = setProxy(CanvasRenderingContext2D, "CanvasRenderingContext2D")


CanvasRenderingContext2D.prototype = setProxy(CanvasRenderingContext2D.prototype, "CanvasRenderingContext2D.prototype")

function fillRect() { }


CanvasRenderingContext2D.prototype.fillRect = setProxy(fillRect, "fillRect")
CanvasRenderingContext2D.prototype.fillRect.toString = function toString() {
    return 'function fillRect() { [native code] }'
}

function fillText() { }




CanvasRenderingContext2D.prototype.fillText = setProxy(fillText, "fillText")

CanvasRenderingContext2D.prototype.fillText.toString = function toString() {
    return 'function fillText() { [native code] }'
}




let nth = 1
function HTMLCanvasElement() {

}


function getContext() {
    if (arguments[0] === "2d") {

        tow2 = new CanvasRenderingContext2D(this)

        return setProxy(tow2, "CanvasRenderingContext2D")
    }
    if (arguments[0] === "webgl") {

    }
}
HTMLCanvasElement.prototype.getContext = setProxy(getContext, "getContext")

function toDataURL() {

    if (this.width === 220 && this.height === 30) {
        return `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANwAAAAeCAYAAABHenA+AAAAAXNSR0IArs4c6QAAAMNJREFUeF7t00ENAAAIAzHm3zQu7lUMLGm4nSNAIBNYtmSIAIETnCcgEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUgQen2QAfWCC+5AAAAABJRU5ErkJggg==`

    }
    if (this.width === 2 && this.height === 2) {
        return `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAAA5JREFUGFdjZIACRhgDAAAtAANNw4UTAAAAAElFTkSuQmCC`
    }

}

HTMLCanvasElement.prototype.toDataURL = setProxy(toDataURL, "toDataURL")

HTMLCanvasElement.prototype.toDataURL.toString = function toString() {
    return 'function toDataURL() { [native code] }'
}

function setAttribute() {
    this[arguments[0]] = arguments[1]
}

HTMLCanvasElement.prototype.setAttribute = setProxy(setAttribute, "setAttribute")

HTMLCanvasElement.prototype.toDataURL.toString = function toString() {
    return 'function toDataURL() { [native code] }'
}

window.HTMLCanvasElement = setProxy(HTMLCanvasElement, "HTMLCanvasElement")
HTMLCanvasElement.prototype = setProxy(HTMLCanvasElement.prototype, "HTMLCanvasElement.prototype")




// GET 对象: window 属性名称: screen 属性类型: string 属性值类型: undefined
// GET 对象: window 属性名称: document 属性类型: string 属性值类型: undefined

window.screen = setProxy({
    "availWidth": 1920,
    "availHeight": 1032,
    "width": 1920,
    "height": 1080,
    "colorDepth": 24,
    "pixelDepth": 24,
    "availLeft": 0,
    "availTop": 0,
    "orientation": {},
    "onchange": null,
    "isExtended": false
}, "screen")

document = setProxy({}, "document")

// GET 对象: document 属性名称: createElement 属性类型: string 属性值类型: undefined




function createElement() {

    if (arguments[0] == "canvas") {
        return setProxy(new HTMLCanvasElement(), "canvas")
    }

}


document.createElement = setProxy(createElement, "createElement")

document.cookie = `UBT_VID=1744431254849.85ablPcB2kon; ibu_online_jump_site_result={"site_url":[],"suggestion":["zh-hk","","en-us","es-us","zh-cn"]}; ibu_online_home_language_match={"isRedirect":false,"isShowSuggestion":true,"lastVisited":true,"region":"us","redirectSymbol":false}; ibulanguage=HK; ibulocale=zh_hk; cookiePricesDisplayed=HKD; ibu_country=HK; _abtest_userid=2fd77317-cc39-4dcc-9038-76c6f7493783; ubtc_trip_pwa=0; trip_test_cookie=1; _tp_search_latest_channel_name=hotels; _gid=GA1.2.84396873.1744431375; _gcl_au=1.1.1697044261.1744431375; _ga_37RNVFDP1J=GS1.2.1744431374.1.0.1744431374.60.0.0; _RF1=2607%3Af130%3A0%3A145%3A%3Aced2%3A8326; _RSG=clKTvmNFtMCTHb_thUXePA; _RDG=28aaf788a9cdb021c33614655dee199a7a; _RGUID=c5b73d7c-3975-4be6-a668-85eaf7fe545d; _fwb=2547CjFiq9D3szhElOgHABm.1744431375477; _tt_enable_cookie=1; _ttp=01JRM3CSQNWRNPGN3HSA7893ZC_.tt.1; GUID=09034022116582083732; nfes_isSupportWebP=1; nfes_isSupportWebP=1; trn_traffic_start=10650138510; trn_traffic_end=10650138510; IBU_TRANCE_LOG_P=57985476762; devicePixelRatio=1; ibu_hotel_search_date=%7B%22checkIn%22%3A%222025%2F05%2F05%22%2C%22checkOut%22%3A%222025%2F05%2F06%22%7D; ibu_hotel_search_target=%7B%22countryId%22%3A1%2C%22provinceId%22%3A0%2C%22searchWord%22%3A%22%E6%B7%B1%E5%9C%B3%22%2C%22cityId%22%3A30%2C%22searchType%22%3A%22CT%22%7D; ibu_hotel_search_crn_guest=%7B%22adult%22%3A%222%22%2C%22children%22%3A%220%22%2C%22ages%22%3A%22%22%2C%22crn%22%3A%221%22%7D; oldLocale=zh-HK; _bfa=1.1744431254849.85ablPcB2kon.1.1744431397340.1744431436872.1.5.10320668148; IBU_showtotalamt=0; wcs_bt=s_33fb334966e9:1744431440; _uetsid=ebe78530175411f08f1fd74484c7d548; _uetvid=ebe7a530175411f0855065bba8033985; _ga=GA1.1.1748775873.1744431375; _ga_2DCSB93KS4=GS1.2.1744431375.1.1.1744431441.59.0.0; ttcsid=1744431376120.1.1744431441548; ttcsid_CIR4RVBC77UD5V58BBNG=1744431376120.1.1744431441772; _fbp=fb.1.1744431442200.97390564140526088; _ga_X437DZ73MR=GS1.1.1744431374.1.1.1744431455.40.0.0`


window.location = setProxy({
    "ancestorOrigins": {},
    "href": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
    "origin": "https://hk.trip.com",
    "protocol": "https:",
    "host": "hk.trip.com",
    "hostname": "hk.trip.com",
    "port": "",
    "pathname": "/hotels/list",
    "search": "?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
    "hash": ""
}, "location")


require("./trip_jsvmp.js")


let data = {
    "guideLogin": "T",
    "search": {
        "sessionId": "b69a5496-f1c0-d7d5-5fa0-2f1ce455278b",
        "preHotelCount": 22,
        "preHotelIds": [
            81266091,
            115996086,
            345032,
            100589920,
            102556928,
            115825601,
            111774115,
            97711372,
            34998429,
            66684700,
            1066167,
            371233,
            120441830,
            371239,
            124181124,
            99435980,
            114925292,
            70797786,
            345037,
            103066319,
            54506880,
            456133
        ],
        "checkIn": "20250505",
        "checkOut": "20250506",
        "sourceFromTag": "",
        "filters": [
            {
                "filterId": "29|1",
                "type": "29",
                "value": "1|2",
                "subType": "2"
            },
            {
                "filterId": "17|1",
                "type": "17",
                "value": "1",
                "subType": "2"
            },
            {
                "filterId": "80|0|1",
                "type": "80",
                "value": "0",
                "subType": "2"
            }
        ],
        "pageCode": 10320668148,
        "location": {
            "geo": {
                "countryID": 1,
                "provinceID": 0,
                "cityID": 30,
                "districtID": 0,
                "oversea": false
            },
            "coordinates": []
        },
        "pageIndex": 3,
        "pageSize": 10,
        "needTagMerge": "T",
        "roomQuantity": 1,
        "orderFieldSelectedByUser": false,
        "hotelId": 0,
        "hotelIds": [],
        "lat": 22.52707770864266,
        "lng": 114.05988082026357,
        "tripWalkDriveSwitch": "T",
        "resultType": "CT",
        "nearbyHotHotel": {},
        "recommendTimes": 0,
        "crossPromotionId": "",
        "travellingForWork": false
    },
    "batchRefresh": {
        "batchId": "",
        "batchSeqNo": 0
    },
    "queryTag": "NORMAL",
    "mapType": "GOOGLE",
    "extends": {
        "crossPriceConsistencyLog": "",
        "NewTaxDescForAmountshowtype0": "B",
        "TaxDescForAmountshowtype2": "T",
        "MealTagDependOnMealType": "T",
        "MultiMainHotelPics": "T",
        "enableDynamicRefresh": "T",
        "isFirstDynamicRefresh": "T",
        "ExposeBedInfos": "F",
        "TaxDescRemoveRoomNight": "",
        "priceMaskLoginTip": "",
        "NeedHotelHighLight": "T"
    },
    "head": {
        "platform": "PC",
        "clientId": "1744431254849.85ablPcB2kon",
        "bu": "ibu",
        "group": "TRIP",
        "aid": "",
        "sid": "",
        "ouid": "",
        "caid": "",
        "csid": "",
        "couid": "",
        "region": "HK",
        "locale": "zh-HK",
        "timeZone": "8",
        "currency": "HKD",
        "p": "57985476762",
        "pageID": "10320668148",
        "deviceID": "PC",
        "clientVersion": "0",
        "frontend": {
            "vid": "1744431254849.85ablPcB2kon",
            "sessionID": "1",
            "pvid": "5"
        },
        "extension": [
            {
                "name": "cityId",
                "value": "30"
            },
            {
                "name": "checkIn",
                "value": "2025/05/05"
            },
            {
                "name": "checkOut",
                "value": "2025/05/06"
            },
            {
                "name": "region",
                "value": "HK"
            }
        ],
        "tripSub1": "",
        "qid": "643283145830",
        "pid": "1a158e7b-2eda-49c7-a5dc-9183da100bbe",
        "hotelExtension": {},
        "cid": "1744431254849.85ablPcB2kon",
        "traceLogID": "b906689e1d8dd",
        "ticket": "",
        "href": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
        "deviceConfig": "L"
    }
}

let O = window.signature(data);
console.log(O.length, O);




fetch("https://hk.trip.com/htls/getHotelListDynamicRefresh?x-traceID=1744431254849.85ablPcB2kon-1744431816849-1887382392", {
    "headers": {
        "accept": "application/json",
        "accept-language": "zh-CN,zh;q=0.9",
        "cache-control": "no-cache",
        "content-type": "application/json",
        "currency": "HKD",
        "locale": "zh-HK",
        "p": "57985476762",
        "phantom-token": O,
        "pragma": "no-cache",
        "priority": "u=1, i",
        "sec-ch-ua": "\"Microsoft Edge\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Windows\"",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        "trip-trace-id": "1744431254849.85ablPcB2kon-1744431816849-1887382392",
        "x-traceid": "1744431254849.85ablPcB2kon-1744431816849-1887382392",
        "cookie": "UBT_VID=1744431254849.85ablPcB2kon; ibu_online_jump_site_result={\"site_url\":[],\"suggestion\":[\"zh-hk\",\"\",\"en-us\",\"es-us\",\"zh-cn\"]}; ibu_online_home_language_match={\"isRedirect\":false,\"isShowSuggestion\":true,\"lastVisited\":true,\"region\":\"us\",\"redirectSymbol\":false}; ibulanguage=HK; ibulocale=zh_hk; cookiePricesDisplayed=HKD; ibu_country=HK; _abtest_userid=2fd77317-cc39-4dcc-9038-76c6f7493783; ubtc_trip_pwa=0; trip_test_cookie=1; _tp_search_latest_channel_name=hotels; _gid=GA1.2.84396873.1744431375; _gcl_au=1.1.1697044261.1744431375; _ga_37RNVFDP1J=GS1.2.1744431374.1.0.1744431374.60.0.0; _RF1=2607%3Af130%3A0%3A145%3A%3Aced2%3A8326; _RSG=clKTvmNFtMCTHb_thUXePA; _RDG=28aaf788a9cdb021c33614655dee199a7a; _RGUID=c5b73d7c-3975-4be6-a668-85eaf7fe545d; _fwb=2547CjFiq9D3szhElOgHABm.1744431375477; _tt_enable_cookie=1; _ttp=01JRM3CSQNWRNPGN3HSA7893ZC_.tt.1; GUID=09034022116582083732; nfes_isSupportWebP=1; _resDomain=https%3A%2F%2Fak-s-cw.tripcdn.com; nfes_isSupportWebP=1; trn_traffic_start=10650138510; trn_traffic_end=10650138510; IBU_TRANCE_LOG_P=57985476762; devicePixelRatio=1; ibu_hotel_search_date=%7B%22checkIn%22%3A%222025%2F05%2F05%22%2C%22checkOut%22%3A%222025%2F05%2F06%22%7D; ibu_hotel_search_target=%7B%22countryId%22%3A1%2C%22provinceId%22%3A0%2C%22searchWord%22%3A%22%E6%B7%B1%E5%9C%B3%22%2C%22cityId%22%3A30%2C%22searchType%22%3A%22CT%22%7D; ibu_hotel_search_crn_guest=%7B%22adult%22%3A%222%22%2C%22children%22%3A%220%22%2C%22ages%22%3A%22%22%2C%22crn%22%3A%221%22%7D; oldLocale=zh-HK; _bfa=1.1744431254849.85ablPcB2kon.1.1744431397340.1744431436872.1.5.10320668148; IBU_showtotalamt=0; wcs_bt=s_33fb334966e9:1744431440; _uetsid=ebe78530175411f08f1fd74484c7d548; _uetvid=ebe7a530175411f0855065bba8033985; _ga=GA1.1.1748775873.1744431375; _ga_2DCSB93KS4=GS1.2.1744431375.1.1.1744431441.59.0.0; ttcsid=1744431376120.1.1744431441548; ttcsid_CIR4RVBC77UD5V58BBNG=1744431376120.1.1744431441772; _fbp=fb.1.1744431442200.97390564140526088; _ga_X437DZ73MR=GS1.1.1744431374.1.1.1744431455.40.0.0",
        "Referer": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
        "Referrer-Policy": "strict-origin-when-cross-origin"
    },
    "body": JSON.stringify(data),
    "method": "POST"
}).then((response) => {
    return response.json()
}).then((data) => {
    console.log(JSON.stringify(data));
}).catch((err) => {
    console.log(err);
})
回复 支持 反对

使用道具 举报

结帖率:95% (19/20)

签到天数: 5 天

 楼主| 发表于 昨天 21:43 | 显示全部楼层   广东省东莞市
Zźh926 发表于 2025-4-15 14:02
搞了半天,参数置空都能请求出来数据

不带 phantom-token 和补的环境不对,请求不成功的
回复 支持 反对

使用道具 举报

结帖率:97% (549/567)

签到天数: 13 天

发表于 昨天 18:53 | 显示全部楼层   河北省石家庄市
回复 支持 反对

使用道具 举报

签到天数: 15 天

发表于 昨天 14:02 高大上手机用户 | 显示全部楼层   浙江省宁波市
搞了半天,参数置空都能请求出来数据
回复 支持 反对

使用道具 举报

签到天数: 10 天

发表于 昨天 13:25 | 显示全部楼层   湖南省邵阳市
66666666666666666666666
回复 支持 反对

使用道具 举报

签到天数: 1 天

发表于 昨天 09:25 | 显示全部楼层   湖北省武汉市
支持开源~!感谢分享
回复 支持 反对

使用道具 举报

结帖率:43% (3/7)

签到天数: 9 天

发表于 4 天前 | 显示全部楼层   浙江省温州市

感谢分享
回复 支持 反对

使用道具 举报

签到天数: 11 天

发表于 4 天前 | 显示全部楼层   江苏省南京市
感谢分享
回复 支持 反对

使用道具 举报

签到天数: 4 天

发表于 4 天前 | 显示全部楼层   广东省惠州市
感谢分享,很给力!~
回复 支持 反对

使用道具 举报

结帖率:100% (1/1)

签到天数: 15 天

发表于 4 天前 | 显示全部楼层   江苏省扬州市
这个...太深入了.........接触不到
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表