From 2d304b21c7a2f37f0b8bc35f93a64829737c2f69 Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: 2020年6月17日 11:00:39 +0800 Subject: [PATCH 1/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dd8a887..26cde21 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,4 @@ JS逆向实战、教程持续更新,欢迎star,求关注公众号"逆向 - [x] [【透明售房网】高度混淆及浏览器指纹分析(一)](https://mp.weixin.qq.com/s/UlnVU2yGjSqSeJMOihXL4A) - [x] [【透明售房网】高度混淆及浏览器指纹分析(二)](https://mp.weixin.qq.com/s/m5hapF2O3SLWFhVW42qLkA) - [x]  [ JS逆向 | ob混淆一键还原工具](https://mp.weixin.qq.com/s/KOyhktjuOaZS2GM7UDrHWw) +- [x]  [ JS逆向 | BOSS直聘cookie分析](https://mp.weixin.qq.com/s/0B-k1-wgNVEJZQo2I0vl_Q) From 7666169d8f9039618da777879869adb2ce0fbf74 Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: 2020年6月18日 11:45:17 +0800 Subject: [PATCH 2/7] Update README.md --- "19-BOSS347円233円264円350円201円230円/README.md" | 2 ++ 1 file changed, 2 insertions(+) diff --git "a/19-BOSS347円233円264円350円201円230円/README.md" "b/19-BOSS347円233円264円350円201円230円/README.md" index cf75d56..44eaaba 100644 --- "a/19-BOSS347円233円264円350円201円230円/README.md" +++ "b/19-BOSS347円233円264円350円201円230円/README.md" @@ -1,5 +1,7 @@ # 使用说明 +### 注意:我这里只补了两套代码的环境,BOSS实际有几套不知道,补不动了,一天一变... + 1.npm需安装express和body-parser,具体自行了解 2.将3个文件放于同一文件夹,cd到该目录,命令行运行 From ba14e38c58a40a7aba07de90c616c42daf6f2a97 Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: 2020年6月23日 16:24:32 +0800 Subject: [PATCH 3/7] Create douyin.py --- "20-346円212円226円351円237円263円web/douyin.py" | 155 +++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 "20-346円212円226円351円237円263円web/douyin.py" diff --git "a/20-346円212円226円351円237円263円web/douyin.py" "b/20-346円212円226円351円237円263円web/douyin.py" new file mode 100644 index 0000000..0e64ea2 --- /dev/null +++ "b/20-346円212円226円351円237円263円web/douyin.py" @@ -0,0 +1,155 @@ +import requests, re, execjs, sys +from lxml import etree + + +douyin_font = { + "  ": "0", "  ": "0", "  ": "0", + "  ": "1", "  ": "1", "  ": "1", + "  ": "2", "  ": "2", "  ": "2", + "  ": "3", "  ": "3", "  ": "3", + "  ": "4", "  ": "4", "  ": "4", + "  ": "5", "  ": "5", "  ": "5", + "  ": "6", "  ": "6", "  ": "6", + "  ": "7", "  ": "7", "  ": "7", + "  ": "8", "  ": "8", "  ": "8", + "  ": "9", "  ": "9", "  ": "9", +} +UA = 'Mozilla/5.0 (Windows NT 6.1; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4014.0 Safari/537.36' +headers = { + 'User-Agent': UA, +} + + +def num_replace(text): + # 主页字体反爬 + for key, value in douyin_font.items(): + if key in text: + text = text.replace(key, value) + return text + + +def get_index(uid): + # 获取主页源码,uid如 102064772608 + url = "https://www.iesdouyin.com/share/user/%s" % uid + try: + res = requests.get(url, headers=headers) + if res.status_code == 200 and "dytk: " in res.text: + html = num_replace(res.text) + return html + else: + print("获取主页失败:", res.status_code) + if res.status_code == 200: + print("未请求到主页源码,请重新发起请求!") + sys.exit() + return None + except Exception as e: + print("获取主页失败:", e) + sys.exit() + return None + + +def parse_index(res): + # 解析主页,获取dytk、tac、昵称、抖音ID、认证信息、签名、关注数、粉丝数、赞数、作品数、喜欢数 + dytk = re.findall("dytk: '(.*?)'", res, re.S)[0] + tac = re.findall("", res, re.S)[0] + html = etree.HTML(res) + nickname = html.xpath('//p[@class="nickname"]/text()')[0] + douyin_ID = "".join(html.xpath('//p[@class="shortid"]/i/text()')) + verify_info = html.xpath('//div[@class="verify-info"]//text()') + verify_info = verify_info[0].strip() if verify_info else "无" + signature = html.xpath('//p[@class="signature"]/text()')[0] + focus_num = "".join(html.xpath('//span[@class="focus block"]//i/text()')) + follower_num = "".join(html.xpath('//span[@class="follower block"]/span[1]//text()')).strip() + liked_num = "".join(html.xpath('//span[@class="liked-num block"]/span[1]//text()')).strip() + user_tab = "".join(html.xpath('//div[@class="user-tab active tab get-list"]/span/i/text()')) + like_tab = "".join(html.xpath('//div[@class="like-tab tab get-list"]/span/i/text()')) + return { + "nickname": nickname, + "douyin_ID": douyin_ID, + "verify_info": verify_info, + "signature": signature, + "focus_num": focus_num, + "follower_num": follower_num, + "liked_num": liked_num, + "user_tab": user_tab, + "like_tab": like_tab, + }, tac, dytk + + +def get_sign(uid, tac, ua): + # 获取_signature + result = ctx.call("get_sign", uid, tac, ua) + print("\n_signature:", result) + return result + + +def get_aweme_list(uid, dytk, _signature): + # 发起ajax请求,获取数据 + params = { + 'user_id': uid, + 'sec_uid': '', + 'count': "21", + 'max_cursor': "0", + 'aid': "1128", + '_signature': _signature, + 'dytk': dytk + } + try: + response = requests.get('https://www.iesdouyin.com/web/api/v2/aweme/post/', headers=headers, params=params) + if response.json()["aweme_list"]: + # print(response.json()) + return response.json() + else: + print(response.json()) + return False + except Exception as e: + print(e) + return False + + +def download(url, name): + # 下载视频 + header = { + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1" + } + # url = "https://aweme.snssdk.com/aweme/v1/play/?video_id=v0200fe30000bj2iv7hum7li82bk34pg&line=0&ratio=540p&media_type=4&vr_type=0&improve_bitrate=0&is_play_url=1" + try: + res = requests.get(url, headers=header) + if res.status_code == 200: + with open(name + ".mp4", "wb") as f: + f.write(res.content) + print("下载完成!") + else: + print("下载失败:", res.status_code) + except Exception as e: + print("下载失败:", e) + + +def main(uid): + # 1. 获取主页源码 + index = get_index(uid) + # 2. 解析出主页信息及tac、dytk关键字段 + info, tac, dytk = parse_index(index) + print("主页信息:", info) + print("\ntac:", tac) + print("\ndytk:", dytk) + # 3. 获取_signature + _signature = get_sign(uid, tac, UA) + # 4. 携带_signature发起ajax请求,获取数据 + aweme_list = get_aweme_list(uid, dytk, _signature) + if aweme_list: + # 5. 提取第一个无水印视频下载链接 + play_addr = aweme_list['aweme_list'][0]['video']['play_addr']['url_list'][0] + # 6. 下载视频 + download(play_addr, "抖音短视频") + + + + +if __name__ == "__main__": + with open("douyin.js", "r", encoding="utf-8") as f: + ctx = execjs.compile(f.read()) + + uid = "102064772608" + main(uid) + From 43b62fd0a49e3c9dcc5a0233e1ccc5515adc2ba3 Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: 2020年6月23日 16:25:48 +0800 Subject: [PATCH 4/7] Create douyin.js --- "20-346円212円226円351円237円263円web/douyin.js" | 267 +++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 "20-346円212円226円351円237円263円web/douyin.js" diff --git "a/20-346円212円226円351円237円263円web/douyin.js" "b/20-346円212円226円351円237円263円web/douyin.js" new file mode 100644 index 0000000..58ad4ff --- /dev/null +++ "b/20-346円212円226円351円237円263円web/douyin.js" @@ -0,0 +1,267 @@ +Audio = {} +document = { + createElement: function() { + return canvas + } +}; +canvas = { + getContext: function getContext() { + return CanvasRenderingContext2D + }, + toDataURL: function toDataURL() { + // 实际为canvas画布填充了"龘ฑภ경"字样后,转成的图片链接 + return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAQCAYAAABQrvyxAAACyUlEQVRIS8XWTYhVZRgH8N8dkPFqJqgI4sKmTUSgaBCKihCI5dZFUEaLwHAThjujEnXjpkAUHSRc+AEtFJIWKWRBSR9QENgiggplNqkTlXBnhjveeM6cF955PXccFJ2zuPec99zz3v/X87+3ZfrRK67jslWvxb103vCxx770DN5sApSAloBLco+SzFKcxbZClmG8gw7uIdCkfnq+BDsXbmzEizhYg2p0oEn1PEK5II/SgTKPbXyE89iBt+oPDDcpWz7cbwZysq/h9Vqd9/E2fkWsn0GsJeVi/1DvE6xJQLJoNA1T7PN0wx73zMBMDsTGTXMQ1n6TAfkJ63ACr+IcDmekUr6D0FUkdb+uc18SCPCba4ILitlodGA2ik8R7Rmw2E4ThnR9oVsRjJyuxL/4FLdwJCOQE07O5CBjQONIRINk7l4iOOMQB4mkdn6eajWgM2mhYU855KhRXRMO6DqKD/Ay3sWygkCKUE6qJPAegmis3+5T0I0EEtj8PUVn+r2e+Zb52HqjPqti8ptFnnPHPhzH6lq5+KIcbOwX4AJkAtjkQK50Pi9pfWfEKR/ifjVaOjC1wcLq9ZoPXbTLZfyi7Vljlep/4nSd8ZzA9bpNokUuzYJASTSBT3Mzcr8qbO77CNBSk0ZNGrPHoO+r1plnta4YxhxcTiAAbMcPs3QgXLpSC1EmKfbd38+B/jMQ4NvuWoTlPnfNKfyIES3P142U12Y/B6oI1Kj6RSgcOIZX6lqe0YHyL0Su/tT5gJ5JbSt03PSfrl34vco//2i522fgHma5/M1Ie20KZ0oHEsj5Fhireqijra2j4wlL3HHMGrv9bC2+tKUGf1vLxMOgfNBnp89AT8sGq3xrHE/WVRo0ojQHvWSHK/Y6ab83qhz/gZsYr34V5uAoCQwYstV1F6zzlXlaxg0aMeQvq7zgqu+qno+WuYG/5xJ86PU//5znHgwZKlQAAAAASUVORK5CYII=" + }, +} + +CanvasRenderingContext2D = { + arc: function arc() {}, + stroke: function stroke() {}, + fillText: function fillText() {}, +} +window = { + document: { + location:{}, + _zid:2 + }, +} +function get_sign(uid, aaaa, ua) { + // _signature共26位 + // uid 决定倒数第8至倒数第5位的字符(共4位) + // ua 决定倒数第10至倒数第8位的字符 + // data:image决定正数第11至第16位 + aaaa = aaaa.replace(/\\u02a1/g, "\u02a1").replace(/\\x7f/g, "\x7f").replace(/\\x80/g, "\x80").replace(/\\x1c/g, "\x1c").replace(/\\x06/g, "\x06").replace(/\\x02/g, "\x02").replace(/\\\'/g, "\'").replace(/\\ufffb/g, "\ufffb").replace(/\\\\/g, "\\").replace(/\\uffce/g, "\uffce") + navigator = { + userAgent: ua, + } + tac = aaaa; + var e = {}; + (function anonymous() { + function e(e, a, r) { + return (b[e] || (b[e] = t("x,y", "return x " + e + " y")))(r, a) + } + function a(e, a, r) { + return (k[r] || (k[r] = t("x,y", "return new x[y](" + Array(r + 1).join(",x[++y]").substr(1) + ")")))(e, a) + } + function r(e, a, r) { + var n, t, s = {}, b = s.d = r ? r.d + 1 : 0; + for (s["$" + b] = s, + t = 0; t < b; t++) + s[n = "$" + t] = r[n]; + for (t = 0, + b = s.length = a.length; t < b; t++) + s[t] = a[t]; + return c(e, 0, s) + } + function c(t, b, k) { + function u(e) { + if (typeof e === "string" && e === 'canvas') { + debugger; + } + v[x++] = e + } + function f() { + return g = t.charCodeAt(b++) - 32, + t.substring(b, b += g) + } + function l() { + try { + y = c(t, b, k) + } catch (e) { + h = e, + y = l + } + } + for (var h, y, d, g, v = [], x = 0; ; ) + switch (g = t.charCodeAt(b++) - 32) { + case 1: + u(!v[--x]); + break; + case 4: + v[x++] = f(); + break; + case 5: + u(function(e) { + var a = 0 + , r = e.length; + return function() { + var c = a < r; + return c && u(e[a++]), + c + } + }(v[--x])); + break; + case 6: + y = v[--x], + u(v[--x](y)); + break; + case 8: + if (g = t.charCodeAt(b++) - 32, + l(), + b += g, + g = t.charCodeAt(b++) - 32, + y === c) + b += g; + else if (y !== l) + return y; + break; + case 9: + v[x++] = c; + break; + case 10: + u(s(v[--x])); + break; + case 11: + y = v[--x], + u(v[--x] + y); + break; + case 12: + for (y = f(), + d = [], + g = 0; g < y.length; g++) + d[g] = y.charCodeAt(g) ^ g + y.length; + u(String.fromCharCode.apply(null, d)); + break; + case 13: + y = v[--x], + h = delete v[--x][y]; + break; + case 14: + v[x++] = t.charCodeAt(b++) - 32; + break; + case 59: + u((g = t.charCodeAt(b++) - 32) ? (y = x, + v.slice(x -= g, y)) : []); + break; + case 61: + u(v[--x][t.charCodeAt(b++) - 32]); + break; + case 62: + g = v[--x], + k[0] = 65599 * k[0] + k[1].charCodeAt(g)>>> 0; + break; + case 65: + h = v[--x], + y = v[--x], + v[--x][y] = h; + break; + case 66: + u(e(t[b++], v[--x], v[--x])); + break; + case 67: + y = v[--x], + d = v[--x] + u((g = v[--x]).x === c ? r(g.y, y, k) : g.apply(d, y)); + break; + case 68: + u(e((g = t[b++]) < "<" ? (b--, + f()) : g + g, v[--x], v[--x])); + break; + case 70: + u(!1); + break; + case 71: + v[x++] = n; + break; + case 72: + v[x++] = +f(); + break; + case 73: + u(parseInt(f(), 36)); + break; + case 75: + if (v[--x]) { + b++; + break + } + case 74: + g = t.charCodeAt(b++) - 32 << 16>> 16, + b += g; + break; + case 76: + u(k[t.charCodeAt(b++) - 32]); + break; + case 77: + y = v[--x], + u(v[--x][y]); + break; + case 78: + g = t.charCodeAt(b++) - 32, + u(a(v, x -= g + 1, g)); + break; + case 79: + g = t.charCodeAt(b++) - 32, + u(k["$" + g]); + break; + case 81: + h = v[--x] + v[--x][f()] = h; + break; + case 82: + u(v[--x][f()]); + break; + case 83: + h = v[--x] + k[t.charCodeAt(b++) - 32] = h; + break; + case 84: + v[x++] = !0; + break; + case 85: + v[x++] = void 0; + break; + case 86: + u(v[x - 1]); + break; + case 88: + h = v[--x], + y = v[--x], + v[x++] = h, + v[x++] = y; + break; + case 89: + u(function() { + function e() { + return r(e.y, arguments, k) + } + return e.y = f(), + e.x = c, + e + }()); + break; + case 90: + v[x++] = null; + break; + case 91: + v[x++] = h; + break; + case 93: + h = v[--x]; + break; + case 0: + return v[--x]; + default: + u((g << 16>> 16) - 16) + } + } + var n = this + , t = n.Function + , s = Object.keys || function(e) { + var a = {} + , r = 0; + for (var c in e) + a[r++] = c; + return a.length = r, + a + } + , b = {} + , k = {}; + return r + } + ) + ()('gr$Daten Иb/s!l y͒yĹg,(lfi~ah`{mv,-n|jqewVxp{rvmmx,&effkx[!cs"l".Pq%widthl"@q&heightl"vr*getContextx$"2d[!cs#l#,*;?|u.|uc{uq$fontl#vr(fillTextx$$龘ฑภ경2<[#c}l#2q*shadowblurl#1q-shadowoffsetxl#$$limeq+shadowcolorl#vr#arcx88802[%c}l#vr&strokex[ c}l"v,)}eOmyoZB]mx[ cs!0s$l$Pb>>s!0s%yA0s"l"l!r&lengthb&l!l Bd>&+l!l &+l!l 6d>&+l!l &+ s,y=o!o!]/q"13o!l q"10o!],l 2d>& s.{s-yMo!o!]0q"13o!]*Ld>>b|s!o!l q"10o!],l!& s/yIo!o!].q"13o!],o!]*Jd>>b|&o!]+l &+ s0l-l!&l-l!i\'1z141z4b/@d Date: 2020年6月23日 17:13:53 +0800 Subject: [PATCH 5/7] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 26cde21..fa872a5 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,9 @@ JS逆向实战、教程持续更新,欢迎star,求关注公众号"逆向 - [x] [【透明售房网】高度混淆及浏览器指纹分析(二)](https://mp.weixin.qq.com/s/m5hapF2O3SLWFhVW42qLkA) - [x]  [ JS逆向 | ob混淆一键还原工具](https://mp.weixin.qq.com/s/KOyhktjuOaZS2GM7UDrHWw) - [x]  [ JS逆向 | BOSS直聘cookie分析](https://mp.weixin.qq.com/s/0B-k1-wgNVEJZQo2I0vl_Q) + +### 赞赏 + +如果觉得本仓库对你有用,谢谢赞赏~ + +![](https://imgkr.cn-bj.ufileos.com/bf55aae1-f12b-4a63-9b57-94eaf2ff9798.png) From a2e1554e99c50e2ebd705377777ec8f6f5bfd0ae Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: Mon, 6 Jul 2020 17:40:02 +0800 Subject: [PATCH 6/7] Update douyin.py --- "20-346円212円226円351円237円263円web/douyin.py" | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git "a/20-346円212円226円351円237円263円web/douyin.py" "b/20-346円212円226円351円237円263円web/douyin.py" index 0e64ea2..1b0e13b 100644 --- "a/20-346円212円226円351円237円263円web/douyin.py" +++ "b/20-346円212円226円351円237円263円web/douyin.py" @@ -30,7 +30,8 @@ def num_replace(text): def get_index(uid): # 获取主页源码,uid如 102064772608 - url = "https://www.iesdouyin.com/share/user/%s" % uid + url = "https://www.amemv.com/share/user/%s" % uid + # url = "https://www.iesdouyin.com/share/user/%s" % uid try: res = requests.get(url, headers=headers) if res.status_code == 200 and "dytk: " in res.text: From 207a47e8ab5fe6ab2cc1f43bd0a98b67b30ea3f1 Mon Sep 17 00:00:00 2001 From: DingZaiHub <52557898+dingzaihub@users.noreply.github.com> Date: 2021年4月11日 15:30:48 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index fa872a5..391ea61 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ JS逆向实战、教程持续更新,欢迎star,求关注公众号"逆向 | Author | 丁仔 | | :-----: | :---: | -| Email | 1123279813@qq.com | | 微信公众号 | 逆向新手 | | Introduce | Python、爬虫、JS逆向 |

AltStyle によって変換されたページ (->オリジナル) /