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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| import re import urllib.parse import requests as sess import time import frida session = sess.session()
st = str(int(time.time()))
def on_message(message, data): if message['type'] == 'send': print("[*] {}".format(message['payload'])) else: print(message)
def get_sign(datas): jscode = ''' rpc.exports = { sign: function(data,times) { var ret = null; Java.perform(function() { Java.choose("mtopsdk.security.InnerSignImpl",{ onMatch: function(instance){ //这些都是传入的参数,具体传参内容根据实际修改 var HashMap1 = Java.use("java.util.HashMap").$new(); HashMap1.put("data",data); HashMap1.put("deviceId", "Ap2xlstz9Q-Xqp90jq16YWjUopNFAYEEhFHSXXqIucQC"); HashMap1.put("sid",""); HashMap1.put("uid",""); HashMap1.put("x-features","27"); HashMap1.put("appKey", "21407387"); HashMap1.put("api", "mtop.taobao.idlemtopsearch.search"); HashMap1.put("lat","0"); HashMap1.put("lng","0"); HashMap1.put("utdid", "ZUDUSVa6rmsDAOvsGCex7UWC"); HashMap1.put("extdata", "openappkey=DEFAULT_AUTH"); HashMap1.put("ttid", "270200@fleamarket_android_7.8.80"); HashMap1.put("t", times); HashMap1.put("v", "1.0"); var jExt = Java.use("java.util.HashMap").$new(); jExt.put("pageId",""); jExt.put("pageName",""); ret = instance.getUnifiedSign(HashMap1, jExt, "21407387", "", false, "r_38").toString(); //console.log('getUnifiedSign ret value is ' + res); // ret["result"] = res; }, onComplete: function(){} }) }) return ret; } }; ''' process = frida.get_usb_device().attach('com.taobao.idlefish') script = process.create_script(jscode) script.on('message', on_message) script.load() result = script.exports.sign(datas["data"], st) print("某鱼x-sign结果:", result) return result
def get_search_data(key): headers = { "umid": "gqEBai9LPA7C2AKLxxHs+Sd2eyQTnNgs", "x-nettype": "WIFI", "x-pv": "6.3", "x-nq": "WIFI", "EagleEye-UserData": "spm-cnt=a2170.8011571.0.0&spm-url=a2170.unknown.0.0", "first_open": "0", "x-features": "27", "x-app-conf-v": "0", "content-type": "application/x-www-form-urlencoded;charset=UTF-8", "x-bx-version": "6.5.88", "f-refer": "mtop", "x-extdata": "openappkey%3DDEFAULT_AUTH", "x-ttid": "270200%40fleamarket_android_7.8.80", "x-app-ver": "7.8.80", "x-location": "0%2C0", "x-umt": "wWYBs2RLPAKcVgKL0gppGhDT24iunbKi", "a-orange-q": "appKey=21407387&appVersion=7.8.80&clientAppIndexVersion=1120231115161804575&clientVersionIndexVersion=0", "x-utdid": "ZUDUSVa6rmsDAOvsGCex7UWC", "x-appkey": "21407387", "x-devid": "Ap2xlstz9Q-Xqp90jq16YWjUopNFAYEEhFHSXXqIucQC", "user-agent": "MTOPSDK%2F3.1.1.7+%28Android%3B10%3BGoogle%3BPixel+4%29", "host": "g-acs.m.goofish.com", "Accept-Encoding": "gzip", } jsonString = "{\"activeSearch\":false,\"bizFrom\":\"home\",\"disableHierarchicalSort\":0,\"forceUseInputKeyword\":false,\"forceUseTppRepair\":false,\"fromFilter\":false,\"fromKits\":false,\"fromLeaf\":false,\"fromShade\":false,\"fromSuggest\":false,\"keyword\":\""+ key +"\",\"pageNumber\":1,\"relateResultListLastIndex\":0,\"relateResultPageNumber\":1,\"resultListLastIndex\":0,\"rowsPerPage\":10,\"searchReqFromActivatePagePart\":\"historyItem\",\"searchReqFromPage\":\"xyHome\",\"searchTabType\":\"SEARCH_TAB_MAIN\",\"shadeBucketNum\":-1,\"suggestBucketNum\":28,\"supportFlexFilter\":true}" datas = { 'data':jsonString } result = get_sign(datas) print(result)
headers['x-t'] = st headers['x-sign'] = urllib.parse.quote_plus(re.findall("x-sign=(.*?)}", result,re.S)[0]) headers['x-mini-wua'] = urllib.parse.quote_plus(re.findall("x-mini-wua=(.*?),", result)[0]) headers['x-sgext'] = urllib.parse.quote_plus(re.findall("x-sgext=(.*?),", result)[0]) headers['x-c-traceid'] = f"ZUDUSVa6rmsDAOvsGCex7UWC{st}967005712507" url = "https://g-acs.m.goofish.com/gw/mtop.taobao.idlemtopsearch.search/1.0" response = sess.post(url, headers=headers,data=datas) print(response.text)
if __name__ == '__main__': key = input("输入需要搜索的商品") print(f"查询{key}相关商品") get_search_data("key")
|