From 2348956c3a6a639c384eb37af79047ced71323e1 Mon Sep 17 00:00:00 2001 From: YSASM <1613921123@qq.com> Date: Wed, 18 Dec 2024 20:50:44 +0800 Subject: [PATCH] first commit --- app.js | 19 +++++++++++++------ log/server.log | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 log/server.log diff --git a/app.js b/app.js index 6f61021..aa27826 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ const express = require("express"); const request = require("request"); -const log = require("./log") +const log = require("./log"); const app = express(); const port = 9000; const { getDecryptionArray } = require("./decode"); @@ -24,15 +24,22 @@ function xorTransform(decryptionArray) { }, }); } - +const decode = (url, res, decodeKey) => { + let xorStream = xorTransform( + getDecryptionArray(decodeURIComponent(decodeKey)) + ); + const req = request(decodeURIComponent(url)); + req.on("response", (resp) => { + const headers = resp.headers; + res.writeHead(200, "ok", headers); + }); + req.pipe(xorStream).pipe(res); +}; app.get("/download", (req, res) => { const { url, decodeKey } = req.query; log.info(`download url:${url}`); log.info(`download decodeKey:${decodeKey}`); - let xorStream = xorTransform( - getDecryptionArray(decodeURIComponent(decodeKey)) - ); - request(decodeURIComponent(url)).pipe(xorStream).pipe(res); + decode(url, res, decodeKey); }); app.listen(port, () => { diff --git a/log/server.log b/log/server.log new file mode 100644 index 0000000..df37641 --- /dev/null +++ b/log/server.log @@ -0,0 +1,16 @@ +[2024-12-18 20:44:33,901] [INFO] [D:\workSpace\videoDownLoadServer\app.js:39] Example app listening at http://localhost:9000 +[2024-12-18 20:44:50,849] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQAht0kHkgqcVGTeARa76XaYwNcZbj7qMibUykSpTRKicrsZicLCV6MjaMhJjibIOLBw0kgx82CPC3coWBn56u1DGjmia&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=cztXnd9GyrHyDUNS08mucTricIX3ziaryiaPGUtSPhXwZXicAO14q4bkqJwOLc7HH59Lmz9adYC31iaMicS253Ne0IGRF5oI4EhcnBdicibD7lMWUBo3eV1988AW6VPzUp4wBpalEicnFAk44Q6O5fzKDW3v8ncovHgiacECeRyyXwSDBtVl4&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAA6k%2FDTFl9DI6m%2BBsNiZxAAAADnaHZTnGbFfAj9RgZXfw6VASwVSVc5jTFWL5PZNQHotdeprmf%2Fb0LoeeKq9tV5GgecbsenDPtxvfY%3D&svrnonce=1734525702 +[2024-12-18 20:44:50,851] [INFO] [unknow:0] download decodeKey:1584728111 +[2024-12-18 20:44:50,955] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQAht0kHkgqcVGTeARa76XaYwNcZbj7qMibUykSpTRKicrsZicLCV6MjaMhJjibIOLBw0kgx82CPC3coWBn56u1DGjmia&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=cztXnd9GyrHyDUNS08mucTricIX3ziaryiaPGUtSPhXwZXicAO14q4bkqJwOLc7HH59Lmz9adYC31iaMicS253Ne0IGRF5oI4EhcnBdicibD7lMWUBo3eV1988AW6VPzUp4wBpalEicnFAk44Q6O5fzKDW3v8ncovHgiacECeRyyXwSDBtVl4&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAA6k%2FDTFl9DI6m%2BBsNiZxAAAADnaHZTnGbFfAj9RgZXfw6VASwVSVc5jTFWL5PZNQHotdeprmf%2Fb0LoeeKq9tV5GgecbsenDPtxvfY%3D&svrnonce=1734525702 +[2024-12-18 20:44:50,956] [INFO] [unknow:0] download decodeKey:1584728111 +[2024-12-18 20:45:33,655] [INFO] [D:\workSpace\videoDownLoadServer\app.js:39] Example app listening at http://localhost:9000 +[2024-12-18 20:48:31,708] [INFO] [D:\workSpace\videoDownLoadServer\app.js:47] Example app listening at http://localhost:9000 +[2024-12-18 20:48:40,743] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQBicWph9mZzaywqtPsYbzMxEoFagau7c7c7vIJpkicZDjjC9dI9BW3LL4ZHCibTbp6C2qxyVrqWqgOOwlaycRlpd8R&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=6xykWLEnztLt6rZaS47co6TCAN6jZu69icR7KS7licDvSl5NTZKibSDKCQF8k5u2Nt1DojhvLQkEmJ0H4M87MQBJhlqDNupwCPdLZgVRvic042mMUv04D7w5wcFwj6JFuasXwWtbwgB9V90TCmGW1Xr1ibic2vppnLMY51UEhpT2uybdA&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAC0mx2IeyJEm%2F3B0a5iZxAAAADnaHZTnGbFfAj9RgZXfw6VS0Qm9%2Bf52u5bJB%2FQpMkegue5ttg5i5OidUlcAqekMHA5JOyHcU8Q%2BY8%3D&svrnonce=1734520529 +[2024-12-18 20:48:40,744] [INFO] [unknow:0] download decodeKey:626867946 +[2024-12-18 20:50:11,703] [INFO] [D:\workSpace\videoDownLoadServer\app.js:46] Example app listening at http://localhost:9000 +[2024-12-18 20:50:17,436] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQBicWph9mZzaywqtPsYbzMxEoFagau7c7c7vIJpkicZDjjC9dI9BW3LL4ZHCibTbp6C2qxyVrqWqgOOwlaycRlpd8R&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=6xykWLEnztLt6rZaS47co6TCAN6jZu69icR7KS7licDvSl5NTZKibSDKCQF8k5u2Nt1DojhvLQkEmJ0H4M87MQBJhlqDNupwCPdLZgVRvic042mMUv04D7w5wcFwj6JFuasXwWtbwgB9V90TCmGW1Xr1ibic2vppnLMY51UEhpT2uybdA&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAC0mx2IeyJEm%2F3B0a5iZxAAAADnaHZTnGbFfAj9RgZXfw6VS0Qm9%2Bf52u5bJB%2FQpMkegue5ttg5i5OidUlcAqekMHA5JOyHcU8Q%2BY8%3D&svrnonce=1734520529 +[2024-12-18 20:50:17,437] [INFO] [unknow:0] download decodeKey:626867946 +[2024-12-18 20:50:30,960] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQAht0kHkgqcVGTeARa76XaYwNcZbj7qMibUykSpTRKicrsZicLCV6MjaMhJjibIOLBw0kgx82CPC3coWBn56u1DGjmia&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=cztXnd9GyrHyDUNS08mucTricIX3ziaryiaPGUtSPhXwZXicAO14q4bkqJwOLc7HH59Lmz9adYC31iaMicS253Ne0IGRF5oI4EhcnBdicibD7lMWUBo3eV1988AW6VPzUp4wBpalEicnFAk44Q6O5fzKDW3v8ncovHgiacECeRyyXwSDBtVl4&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAA6k%2FDTFl9DI6m%2BBsNiZxAAAADnaHZTnGbFfAj9RgZXfw6VASwVSVc5jTFWL5PZNQHotdeprmf%2Fb0LoeeKq9tV5GgecbsenDPtxvfY%3D&svrnonce=1734525702 +[2024-12-18 20:50:30,962] [INFO] [unknow:0] download decodeKey:1584728111 +[2024-12-18 20:50:31,005] [INFO] [unknow:0] download url:http://wxapp.tc.qq.com/251/20302/stodownload?encfilekey=Cvvj5Ix3eewK0tHtibORqcsqchXNh0Gf3sJcaYqC2rQAht0kHkgqcVGTeARa76XaYwNcZbj7qMibUykSpTRKicrsZicLCV6MjaMhJjibIOLBw0kgx82CPC3coWBn56u1DGjmia&bizid=1023&dotrans=0&hy=SH&idx=1&m=&uzid=1&token=cztXnd9GyrHyDUNS08mucTricIX3ziaryiaPGUtSPhXwZXicAO14q4bkqJwOLc7HH59Lmz9adYC31iaMicS253Ne0IGRF5oI4EhcnBdicibD7lMWUBo3eV1988AW6VPzUp4wBpalEicnFAk44Q6O5fzKDW3v8ncovHgiacECeRyyXwSDBtVl4&ctsc=1&extg=10f0000&svrbypass=AAuL%2FQsFAAABAAAAAAA6k%2FDTFl9DI6m%2BBsNiZxAAAADnaHZTnGbFfAj9RgZXfw6VASwVSVc5jTFWL5PZNQHotdeprmf%2Fb0LoeeKq9tV5GgecbsenDPtxvfY%3D&svrnonce=1734525702 +[2024-12-18 20:50:31,006] [INFO] [unknow:0] download decodeKey:1584728111