sxcgyzbw_file.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const jsdom = require("jsdom");
  2. const { JSDOM } = jsdom;
  3. const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`,
  4. {
  5. url: "https://example.org/",
  6. referrer: "https://example.com/",
  7. contentType: "text/html",
  8. });
  9. window = dom.window;
  10. var CryptoJS = require("crypto-js");
  11. var IsHttp=true
  12. var url=""
  13. var protocolStr = "http:";
  14. if (protocolStr == "http:") {
  15. url = "http://"
  16. IsHttp = true
  17. } else if (protocolStr == "https:") {
  18. IsHttp = false
  19. url = "https://"
  20. }
  21. function decryptByDES(ciphertext, key) {
  22. var keyHex = CryptoJS.enc.Utf8.parse(key);
  23. var decrypted = CryptoJS.DES.decrypt({
  24. ciphertext: CryptoJS.enc.Base64.parse(ciphertext)
  25. }, keyHex, {
  26. mode: CryptoJS.mode.ECB,
  27. padding: CryptoJS.pad.Pkcs7
  28. });
  29. return decrypted.toString(CryptoJS.enc.Utf8);
  30. }
  31. function strKey() {
  32. return "Ctpsp@884*"
  33. }
  34. function get_key(ciphertext, did) {
  35. var detail_id = did
  36. var data = JSON.parse(decryptByDES(JSON.parse(ciphertext), strKey()))
  37. var detail_pdf_url = url + "39.107.102.206:8087/bulletin/getBulletin/" + data.data + "/" + detail_id
  38. // var pdfUrl = "http://bulletin.sntba.com//resource/ceb/js/pdfjs-dist/web/viewer.html?file="+detail_pdf_url
  39. return detail_pdf_url
  40. }