diff --git a/猿人学练习/68js加密防并发谁能并发我叫谁爹/main.py b/猿人学练习/68js加密防并发谁能并发我叫谁爹/main.py new file mode 100644 index 0000000..9cfafb8 --- /dev/null +++ b/猿人学练习/68js加密防并发谁能并发我叫谁爹/main.py @@ -0,0 +1,90 @@ +import requests + + +def get_hex_str(data): + url = f"http://127.0.0.1:3005/sign_68" + session = requests.session() + headers = { + 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8' + } + session.headers = headers + response = session.request("POST", url, data=data) + return response.text + + +def challenge68(page, data): + url = "https://www.python-spider.com/api/challenge68" + if data: + import urllib + urllib.parse.quote(data['t']) + payload = f"page={page}&c={data['c']}&r={data['r']}&t={urllib.parse.quote(data['t'])}&uuid={data['uuid']}&a={data['a']}" + print(payload) + print(len(payload)) + headers = { + 'content-length': f'{len(payload)}', + 'pragma': 'no-cache', + 'cache-control': 'no-cache', + 'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"', + 'accept': 'application/json, text/javascript, */*; q=0.01', + 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'x-requested-with': 'XMLHttpRequest', + 'sec-ch-ua-mobile': '?0', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', + 'sec-ch-ua-platform': '"Windows"', + 'origin': 'https://www.python-spider.com', + 'sec-fetch-site': 'same-origin', + 'sec-fetch-mode': 'cors', + 'sec-fetch-dest': 'empty', + 'referer': 'https://www.python-spider.com/challenge/68', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8' + } + else: + payload = '' + headers = { + 'content-length': '0', + 'pragma': 'no-cache', + 'cache-control': 'no-cache', + 'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"', + 'accept': 'application/json, text/javascript, */*; q=0.01', + 'x-requested-with': 'XMLHttpRequest', + 'sec-ch-ua-mobile': '?0', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', + 'sec-ch-ua-platform': '"Windows"', + 'origin': 'https://www.python-spider.com', + 'sec-fetch-site': 'same-origin', + 'sec-fetch-mode': 'cors', + 'sec-fetch-dest': 'empty', + 'referer': 'https://www.python-spider.com/challenge/68', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8' + } + session = requests.session() + session.headers = headers + response = session.request("POST", url, data=payload) + return response.json() + + +def run(): + data_num = 0 + for page in range(1, 101): + res_dict = challenge68(page, '') + print(res_dict) + a = get_hex_str(res_dict) + res_dict['a'] = a + print(res_dict) + res_dict = challenge68(page, res_dict) + print(res_dict) + exit() + + # data_list_num = [] + # for data in data_list: + # data_list_num.append(int(data.get('value'))) + # data_num += int(data.get('value')) + # print(data_list_num, page) + # print(data_num) + # print(data_num) + + +if __name__ == '__main__': + run() diff --git a/猿人学练习/68js加密防并发谁能并发我叫谁爹/server.js b/猿人学练习/68js加密防并发谁能并发我叫谁爹/server.js new file mode 100644 index 0000000..dfc4384 --- /dev/null +++ b/猿人学练习/68js加密防并发谁能并发我叫谁爹/server.js @@ -0,0 +1,18 @@ +const express = require('express'); +const app = express(); +const code = require("./w-test"); +var bodyParser = require('body-parser'); +app.use(bodyParser()); + + +app.post('/sign_68', function (req, res) { + let result = ''; + let data = req.body; + result = code.hex_1_str(data); + res.send(result.toString()); +}); + + +app.listen(3005, () => { + console.log("开启服务,端口 3005") +}); diff --git a/猿人学练习/68js加密防并发谁能并发我叫谁爹/w.js b/猿人学练习/68js加密防并发谁能并发我叫谁爹/w.js index 2816ae2..fb94000 100644 --- a/猿人学练习/68js加密防并发谁能并发我叫谁爹/w.js +++ b/猿人学练习/68js加密防并发谁能并发我叫谁爹/w.js @@ -1,10 +1,7 @@ -window = global; -window.wp = ''; - - var h = { "base64-js": 1, "buffer": 2, + "ieee754": 3, "ieee754": 3 }; var z = { @@ -16,7 +13,6 @@ var B = { var V = { "whirlpool-js": 4 }; - (function () { function G(F, W, c) { function L(D, q) { @@ -243,7 +239,7 @@ var V = { c.__proto__ = Uint8Array; function N(XX) { - if (typeof XX !== "number") throw new TypeError("\"size\" argument must be of type number"); else { + if (typeof XX !== "number") throw new TypeError("\"size\" argument must be of type number");else { if (XX < 0) throw new RangeError("The value \"" + XX + "\" is invalid for option \"size\""); } } @@ -403,7 +399,7 @@ var V = { if (!XV && XZ === 0) return 0; var XK = ![]; - for (; ;) { + for (;;) { switch (Xh) { case "ascii": case "latin1": @@ -590,7 +586,7 @@ var V = { XF = XG; XG = 0; } else { - if (XG > 2147483647) XG = 2147483647; else XG < -2147483648 && (XG = -2147483648); + if (XG > 2147483647) XG = 2147483647;else XG < -2147483648 && (XG = -2147483648); } XG = +XG; @@ -598,10 +594,10 @@ var V = { if (XG < 0) XG = Xv.length + XG; if (XG >= Xv.length) { - if (XW) return -1; else XG = Xv.length - 1; + if (XW) return -1;else XG = Xv.length - 1; } else { if (XG < 0) { - if (XW) XG = 0; else return -1; + if (XW) XG = 0;else return -1; } } @@ -762,7 +758,7 @@ var V = { if (!XL) XL = "utf8"; var Xq = ![]; - for (; ;) { + for (;;) { switch (XL) { case "hex": return t(this, XW, Xc, XU); @@ -1337,7 +1333,7 @@ var V = { if (l5 > this.length) l5 = this.length; l2.length - l3 < l5 - l4 && (l5 = l2.length - l3 + l4); var l8 = l5 - l4; - if (this === l2 && typeof Uint8Array.prototype.copyWithin === "function") this.copyWithin(l3, l4, l5); else { + if (this === l2 && typeof Uint8Array.prototype.copyWithin === "function") this.copyWithin(l3, l4, l5);else { if (this === l2 && l4 < l3 && l3 < l5) for (var l9 = l8 - 1; l9 >= 0; --l9) { l2[l9 + l3] = this[l9 + l4]; } else Uint8Array.prototype.set.call(l2, this.subarray(l4, l5), l3); @@ -1550,18 +1546,16 @@ var V = { N >>= -f; f += T; - for (; f > 0; D = D * 256 + O[Z + W], W += U, f -= 8) { - } + for (; f > 0; D = D * 256 + O[Z + W], W += U, f -= 8) {} q = D & (1 << -f) - 1; D >>= -f; f += v; - for (; f > 0; q = q * 256 + O[Z + W], W += U, f -= 8) { - } + for (; f > 0; q = q * 256 + O[Z + W], W += U, f -= 8) {} - if (D === 0) D = 1 - c; else { - if (D === L) return q ? NaN : (N ? -1 : 1) * Infinity; else { + if (D === 0) D = 1 - c;else { + if (D === L) return q ? NaN : (N ? -1 : 1) * Infinity;else { q = q + Math.pow(2, v); D = D - c; } @@ -1615,14 +1609,12 @@ var V = { } } - for (; M >= 8; O[K + D] = P & 255, D += o, P /= 256, M -= 8) { - } + for (; M >= 8; O[K + D] = P & 255, D += o, P /= 256, M -= 8) {} r = r << M | P; L += M; - for (; L > 0; O[K + D] = r & 255, D += o, r /= 256, L -= 8) { - } + for (; L > 0; O[K + D] = r & 255, D += o, r /= 256, L -= 8) {} O[K + D - o] |= U * 128; }; @@ -1761,7 +1753,9 @@ var V = { X0[Xh][0] ^= X4[Xh][0] ^ X3[Xh][0]; X0[Xh][1] ^= X4[Xh][1] ^ X3[Xh][1]; } - }; + } + + ; function X8(Xh) { let Xz; @@ -1963,21 +1957,18 @@ var V = { }).call(this, X("buffer").Buffer); }, B], 6: [function (l, s, y) { - window.wp = l("whirlpool-js"); + self.wp = l("whirlpool-js"); result = wp.encSync("11111", "hex"); }, V] }, {}, [6]); -// onmessage = X => { -// for (var s = parseInt(X.data.split("|")[0]); s <= parseInt(X.data.split("|")[1]); s++) { -// result = self.wp.encSync(X.data.split("|")[2] + s.toString(), "hex"); -// -// if (result.slice(0, 10) === X.data.split("|")[3]) { -// self.postMessage(s); -// break; -// } -// }; -// }; +onmessage = X => { + for (var s = parseInt(X.data.split("|")[0]); s <= parseInt(X.data.split("|")[1]); s++) { + result = self.wp.encSync(X.data.split("|")[2] + s.toString(), "hex"); -result = window.wp.encSync('1', "hex"); -console.log(result); \ No newline at end of file + if (result.slice(0, 10) === X.data.split("|")[3]) { + self.postMessage(s); + break; + } + }; +}; \ No newline at end of file