qjs_env.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
  2. const PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36';
  3. const UA = 'Mozilla/5.0';
  4. const UC_UA = 'Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36';
  5. const IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
  6. const VIVO_UA = 'Mozilla/5.0 (Linux; Android 11; V1824A; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.141 Mobile Safari/537.36 VivoBrowser/13.5.2.0';
  7. const True = true;
  8. const False = false;
  9. const None = null;
  10. Object.defineProperty(Array.prototype, 'add', {
  11. value: Array.prototype.push,
  12. enumerable: false
  13. });
  14. Object.defineProperty(Array.prototype, 'append', {
  15. value: Array.prototype.push,
  16. enumerable: false
  17. });
  18. let _t1 = new Date().getTime()
  19. eval(getCryptoJS());
  20. let _t2 = new Date().getTime()
  21. // print(`加载getCryptoJS耗时:${_t2 - _t1}毫秒`);
  22. // console.log(`加载getCryptoJS耗时:${_t2 - _t1}毫秒`);
  23. // print(console, JSON.stringify(Object.keys(console)))
  24. // print(jsp, JSON.stringify(Object.keys(jsp)))
  25. // print(local, JSON.stringify(Object.keys(local)))
  26. function base64Encode(text) {
  27. return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(text));
  28. // return text
  29. }
  30. function base64Decode(text) {
  31. return CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(text));
  32. // return text
  33. }
  34. function md5(text) {
  35. return CryptoJS.MD5(text).toString();
  36. }
  37. // const jsp = {
  38. // pdfa: pdfa,
  39. // pdfh: pdfh,
  40. // pd: pd,
  41. // };
  42. // const local = {
  43. // set: local_set,
  44. // get: local_get,
  45. // delete: local_delete,
  46. // };
  47. function request(url, obj) {
  48. let new_obj;
  49. if (typeof (fetch_params) !== 'undefined') {
  50. new_obj = obj ? Object.assign(fetch_params, obj) : fetch_params;
  51. } else {
  52. new_obj = obj || {}
  53. }
  54. if (!new_obj || !new_obj.headers) {
  55. new_obj.headers = {};
  56. }
  57. if (!new_obj.headers['User-Agent'] && !new_obj.headers['user-agent']) {
  58. new_obj.headers['User-Agent'] = MOBILE_UA;
  59. }
  60. // delete new_obj.headers['Referer'];
  61. // print(obj);
  62. // print(new_obj);
  63. if (typeof (fetch) !== undefined) {
  64. let html = fetch(url, new_obj);
  65. if (/\?btwaf=/.test(html)) {//宝塔验证
  66. url = url.split('#')[0] + '?btwaf' + html.match(/btwaf(.*?)\"/)[1];
  67. log("宝塔验证跳转到:" + url);
  68. html = fetch(url, new_obj);
  69. }
  70. return html
  71. }
  72. return ''
  73. }
  74. function post(url, obj) {
  75. obj.method = 'POST';
  76. return request(url, obj);
  77. }