jmsggzyjypt_encrypt.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. const jsdom = require("jsdom");
  2. const {JSDOM} = jsdom;
  3. const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`, {
  4. url: "https://example.org/",
  5. referrer: "https://example.com/",
  6. contentType: "text/html",
  7. });
  8. window = dom.window;
  9. document = window.document;
  10. location = window.location;
  11. navigator = window.navigator
  12. CryptoJS = require('crypto-js')
  13. function get_pm(req_pm) {
  14. const sF = "zxcvbnmlkjhgfdsaqwertyuiop0987654321QWERTYUIOPLKJHGFDSAZXCVBNM"
  15. , ine = sF + "-@#$%^&*+!";
  16. function qu(e = []) {
  17. return e.map(t => ine[t]).join("")
  18. }
  19. const a = Date.now()
  20. , l = ane(16)
  21. , c = qu([8, 28, 20, 42, 21, 53, 65, 6])
  22. , d = {
  23. [qu([56, 62, 52, 11, 23, 62, 39, 18, 16, 62, 54, 25, 25])]: qu([11, 11, 0, 21, 62, 25, 24, 19, 20, 15, 7]),
  24. [qu([56, 62, 52, 11, 23, 62, 39, 18, 16, 62, 60, 24, 5, 2, 18])]: l,
  25. [qu([56, 62, 52, 11, 23, 62, 39, 18, 16, 62, 40, 23, 6, 18, 14, 20, 15, 6, 25])]: a.toString()
  26. }
  27. function sne(e, t) {
  28. switch (arguments.length) {
  29. case 1:
  30. return parseInt(Math.random() * e + 1, 10);
  31. case 2:
  32. return parseInt(Math.random() * (t - e + 1) + e, 10);
  33. default:
  34. return 0
  35. }
  36. }
  37. function ane(e) {
  38. return [...Array(e)].map(() => sF[sne(0, 61)]).join("")
  39. }
  40. function lne(e) {
  41. let t = "";
  42. return typeof e == "object" ? t = Object.keys(e).map(n => `${n}=${e[n]}`).sort().join("&") : typeof e == "string" && (t = e.split("&").sort().join("&")),
  43. t
  44. }
  45. function $g(e = {}) {
  46. const {p: t, t: n, n: u, k: o} = e
  47. , r = lne(t);
  48. return CryptoJS.SHA256(u + o + decodeURIComponent(r) + n).toString()
  49. }
  50. p = $g({
  51. p: req_pm,
  52. t: a,
  53. n: l,
  54. k: c
  55. })
  56. d[[qu([56, 62, 52, 11, 23, 62, 39, 18, 16, 62, 53, 23, 11, 5, 15, 20, 22, 19, 18])]] = p
  57. return d
  58. }
  59. function create_href(e) {
  60. const t = e.pubServicePlat
  61. , n = e.noticeSecondTypeDesc;
  62. if (e.edition === "v0") {
  63. const pm = {
  64. source: t,
  65. titleDetails: n
  66. },
  67. b_url = `https://ygp.gdzwfw.gov.cn/#/440700/new/jygg/${e.noticeId}`;
  68. const sParams = new URLSearchParams(pm);
  69. const mUrl = `${b_url}?${sParams.toString()}`;
  70. return mUrl
  71. }
  72. const c = {
  73. noticeId: e.noticeId,
  74. projectCode: e.projectCode,
  75. bizCode: e.tradingProcess,
  76. siteCode: e.regionCode,
  77. publishDate: e.publishDate,
  78. source: t,
  79. titleDetails: n,
  80. classify: e.projectType
  81. }
  82. , base_url = `https://ygp.gdzwfw.gov.cn/#/440700/new/jygg/${e.edition}/${e.noticeSecondType}`;
  83. const searchParams = new URLSearchParams(c);
  84. const mergedUrl = `${base_url}?${searchParams.toString()}`;
  85. return mergedUrl
  86. }