From 4b497f08f43947c54246a96539ed7cb6bb8f37c5 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Mon, 16 Dec 2024 16:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=AF=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bns/html/home/home.html | 2 ++ bns/js/login/login.js | 3 +-- bns/js/public/public.js | 21 ++++++++++++++------- bns/js/system/IPUtils.js | 4 ++-- bns/js/system/sm4.js | 22 +--------------------- 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/bns/html/home/home.html b/bns/html/home/home.html index 5c34a90..efaf1c9 100644 --- a/bns/html/home/home.html +++ b/bns/html/home/home.html @@ -12,7 +12,9 @@ + + diff --git a/bns/js/login/login.js b/bns/js/login/login.js index 0186af7..36bd9e6 100644 --- a/bns/js/login/login.js +++ b/bns/js/login/login.js @@ -50,8 +50,7 @@ function login(){ localStorage.setItem("passWay","to-2"); var token=data.data.access_token; localStorage.setItem("tokens",token); - let jm=sm2Encrypt(data.data.us); - localStorage.setItem("us",jm); + localStorage.setItem("us",data.data.us); localStorage.setItem("html_type",1); window.location.href="bns/html/home/home.html"; }else{ diff --git a/bns/js/public/public.js b/bns/js/public/public.js index a02f3d7..7652686 100644 --- a/bns/js/public/public.js +++ b/bns/js/public/public.js @@ -1,6 +1,13 @@ //方法 +const _0x6d20=['toString','length','sm4CalciRK','GET_ULONG_BE','replace','sm4_one_round','slice','stringToByte','join','sm4_setkey_dec','concat','secretKey','ctx\x20is\x20null!','encryptDefault_CBC','decryptDefault_CBC','ROTL','isPadding','exports','amd','key\x20error!','padding','error','sm4Sbox','encryptCustom_ECB','match','sm4_setkey','undefined','sm4_crypt_cbc','call','decryptDefault_ECB','fromByteArray','SHL','SM4_DECRYPT','byteToString','sm4_crypt_ecb','sm4_setkey_enc','code','push','SM4_ENCRYPT','mode','function','toByteArray','charCodeAt','PUT_ULONG_BE','hexString','sm4Lt'];const _0x16ad=function(_0x6d209c,_0x16ad86){_0x6d209c=_0x6d209c-0x0;let _0x515efd=_0x6d20[_0x6d209c];return _0x515efd;};(function(_0x15ddd9){if(typeof exports==='object'&&typeof module!==_0x16ad('0x1a')){module[_0x16ad('0x11')]=_0x15ddd9();}else{let _0x1065eb;if(typeof _0x1065eb==='function'&&_0x1065eb[_0x16ad('0x12')]){_0x1065eb([],_0x15ddd9);}else{let _0x3485fd;if(typeof window!=='undefined'){_0x3485fd=window;}else{if(typeof global!==_0x16ad('0x1a')){_0x3485fd=global;}else{if(typeof self!==_0x16ad('0x1a')){_0x3485fd=self;}else{_0x3485fd=this;}}}_0x3485fd['base64js']=_0x15ddd9();}}}(function(){return function _0x5ed7af(_0x58dadb,_0x2af181,_0x362922){const _0x3eb53b=typeof require==_0x16ad('0x28')&&require;function _0x2a7d56(_0x21a7e3,_0x3e801e){if(!_0x2af181[_0x21a7e3]){if(!_0x58dadb[_0x21a7e3]){const _0x4090c0=typeof require==_0x16ad('0x28')&&require;if(!_0x3e801e&&_0x4090c0){return _0x4090c0(_0x21a7e3,!0x0);}if(_0x3eb53b){return _0x3eb53b(_0x21a7e3,!0x0);}const _0x714a7f=new Error('Cannot\x20find\x20module\x20\x27'+_0x21a7e3+'\x27');throw _0x714a7f[_0x16ad('0x24')]='MODULE_NOT_FOUND',_0x714a7f;}const _0x5c59a4=_0x2af181[_0x21a7e3]={'exports':{}};_0x58dadb[_0x21a7e3][0x0][_0x16ad('0x1c')](_0x5c59a4['exports'],function(_0xd53f94){const _0x557500=_0x58dadb[_0x21a7e3][0x1][_0xd53f94];return _0x2a7d56(_0x557500?_0x557500:_0xd53f94);},_0x5c59a4,_0x5c59a4['exports'],_0x5ed7af,_0x58dadb,_0x2af181,_0x362922);}return _0x2af181[_0x21a7e3]['exports'];}for(let _0x141007=0x0;_0x141007<_0x362922[_0x16ad('0x1')];_0x141007++){_0x2a7d56(_0x362922[_0x141007]);}return _0x2a7d56;}({'/':[function(_0x507287,_0x4945a8,_0x2da658){_0x2da658['byteLength']=_0x217e55;_0x2da658['toByteArray']=_0x3747e3;_0x2da658[_0x16ad('0x1e')]=_0x245182;const _0x3b9f3c=[];const _0x31e8cf=[];const _0x40c06b=typeof Uint8Array!=='undefined'?Uint8Array:Array;const _0x120548='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';let _0x379a43=0x0,_0x4e6de7=_0x120548['length'];for(;_0x379a43<_0x4e6de7;++_0x379a43){_0x3b9f3c[_0x379a43]=_0x120548[_0x379a43];_0x31e8cf[_0x120548['charCodeAt'](_0x379a43)]=_0x379a43;}_0x31e8cf['-'['charCodeAt'](0x0)]=0x3e;_0x31e8cf['_'[_0x16ad('0x2a')](0x0)]=0x3f;function _0x2b3e20(_0x52ba7e){const _0x2c8830=_0x52ba7e['length'];if(_0x2c8830%0x4>0x0){throw new Error('Invalid\x20string.\x20Length\x20must\x20be\x20a\x20multiple\x20of\x204');}return _0x52ba7e[_0x2c8830-0x2]==='='?0x2:_0x52ba7e[_0x2c8830-0x1]==='='?0x1:0x0;}function _0x217e55(_0x31dd05){return _0x31dd05[_0x16ad('0x1')]*0x3/0x4-_0x2b3e20(_0x31dd05);}function _0x3747e3(_0x340f71){let _0x105693,_0x34e3c5,_0x1d9c85,_0x4ddc34,_0x4b4f2e;const _0x2a75a2=_0x340f71['length'];_0x4ddc34=_0x2b3e20(_0x340f71);_0x4b4f2e=new _0x40c06b(_0x2a75a2*0x3/0x4-_0x4ddc34);_0x34e3c5=_0x4ddc34>0x0?_0x2a75a2-0x4:_0x2a75a2;let _0x184d66=0x0;for(_0x105693=0x0;_0x105693<_0x34e3c5;_0x105693+=0x4){_0x1d9c85=_0x31e8cf[_0x340f71[_0x16ad('0x2a')](_0x105693)]<<0x12|_0x31e8cf[_0x340f71['charCodeAt'](_0x105693+0x1)]<<0xc|_0x31e8cf[_0x340f71['charCodeAt'](_0x105693+0x2)]<<0x6|_0x31e8cf[_0x340f71[_0x16ad('0x2a')](_0x105693+0x3)];_0x4b4f2e[_0x184d66++]=_0x1d9c85>>0x10&0xff;_0x4b4f2e[_0x184d66++]=_0x1d9c85>>0x8&0xff;_0x4b4f2e[_0x184d66++]=_0x1d9c85&0xff;}if(_0x4ddc34===0x2){_0x1d9c85=_0x31e8cf[_0x340f71['charCodeAt'](_0x105693)]<<0x2|_0x31e8cf[_0x340f71[_0x16ad('0x2a')](_0x105693+0x1)]>>0x4;_0x4b4f2e[_0x184d66++]=_0x1d9c85&0xff;}else{if(_0x4ddc34===0x1){_0x1d9c85=_0x31e8cf[_0x340f71[_0x16ad('0x2a')](_0x105693)]<<0xa|_0x31e8cf[_0x340f71['charCodeAt'](_0x105693+0x1)]<<0x4|_0x31e8cf[_0x340f71[_0x16ad('0x2a')](_0x105693+0x2)]>>0x2;_0x4b4f2e[_0x184d66++]=_0x1d9c85>>0x8&0xff;_0x4b4f2e[_0x184d66++]=_0x1d9c85&0xff;}}return _0x4b4f2e;}function _0x5d431c(_0x372e7e){return _0x3b9f3c[_0x372e7e>>0x12&0x3f]+_0x3b9f3c[_0x372e7e>>0xc&0x3f]+_0x3b9f3c[_0x372e7e>>0x6&0x3f]+_0x3b9f3c[_0x372e7e&0x3f];}function _0x43d962(_0x5c6379,_0x1443c7,_0x20c397){let _0x1596a4;const _0x1c7348=[];for(let _0x16c295=_0x1443c7;_0x16c295<_0x20c397;_0x16c295+=0x3){_0x1596a4=(_0x5c6379[_0x16c295]<<0x10)+(_0x5c6379[_0x16c295+0x1]<<0x8)+_0x5c6379[_0x16c295+0x2];_0x1c7348[_0x16ad('0x25')](_0x5d431c(_0x1596a4));}return _0x1c7348['join']('');}function _0x245182(_0x107e6a){let _0x9415c9;const _0x5d41f5=_0x107e6a[_0x16ad('0x1')];const _0x425ead=_0x5d41f5%0x3;let _0x47766a='';const _0x770ec2=[];const _0x512f63=0x3fff;let _0x3d0512=0x0,_0x3e123d=_0x5d41f5-_0x425ead;for(;_0x3d0512<_0x3e123d;_0x3d0512+=_0x512f63){_0x770ec2[_0x16ad('0x25')](_0x43d962(_0x107e6a,_0x3d0512,_0x3d0512+_0x512f63>_0x3e123d?_0x3e123d:_0x3d0512+_0x512f63));}if(_0x425ead===0x1){_0x9415c9=_0x107e6a[_0x5d41f5-0x1];_0x47766a+=_0x3b9f3c[_0x9415c9>>0x2];_0x47766a+=_0x3b9f3c[_0x9415c9<<0x4&0x3f];_0x47766a+='==';}else{if(_0x425ead===0x2){_0x9415c9=(_0x107e6a[_0x5d41f5-0x2]<<0x8)+_0x107e6a[_0x5d41f5-0x1];_0x47766a+=_0x3b9f3c[_0x9415c9>>0xa];_0x47766a+=_0x3b9f3c[_0x9415c9>>0x4&0x3f];_0x47766a+=_0x3b9f3c[_0x9415c9<<0x2&0x3f];_0x47766a+='=';}}_0x770ec2['push'](_0x47766a);return _0x770ec2[_0x16ad('0x8')]('');}},{}]},{},[])('/');}));function SM4_Context(){this['mode']=0x1;this['isPadding']=!![];this['sk']=new Array(0x20);}function SM4(){this['SM4_ENCRYPT']=0x1;this['SM4_DECRYPT']=0x0;const _0x5f55ef=[0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x5,0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x4,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x6,0x99,0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0xb,0x43,0xed,0xcf,0xac,0x62,0xe4,0xb3,0x1c,0xa9,0xc9,0x8,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6,0x47,0x7,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8,0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0xf,0x4b,0x70,0x56,0x9d,0x35,0x1e,0x24,0xe,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x1,0x21,0x78,0x87,0xd4,0x0,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x2,0xe7,0xa0,0xc4,0xc8,0x9e,0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1,0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3,0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0xd,0x53,0x4e,0x6f,0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x3,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51,0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8,0xa,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0,0x89,0x69,0x97,0x4a,0xc,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x9,0xc5,0x6e,0xc6,0x84,0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48];const _0x7c82a6=[0xa3b1bac6,0x56aa3350,0x677d9197,0xb27022dc];const _0x22f1f0=[0x70e15,0x1c232a31,0x383f464d,0x545b6269,0x70777e85,0x8c939aa1,0xa8afb6bd,0xc4cbd2d9,0xe0e7eef5,0xfc030a11,0x181f262d,0x343b4249,0x50575e65,0x6c737a81,0x888f969d,0xa4abb2b9,0xc0c7ced5,0xdce3eaf1,0xf8ff060d,0x141b2229,0x30373e45,0x4c535a61,0x686f767d,0x848b9299,0xa0a7aeb5,0xbcc3cad1,0xd8dfe6ed,0xf4fb0209,0x10171e25,0x2c333a41,0x484f565d,0x646b7279];this[_0x16ad('0x3')]=function(_0x465c03,_0x32e1bb){return(_0x465c03[_0x32e1bb]&0xff)<<0x18|(_0x465c03[_0x32e1bb+0x1]&0xff)<<0x10|(_0x465c03[_0x32e1bb+0x2]&0xff)<<0x8|_0x465c03[_0x32e1bb+0x3]&0xff&0xffffffff;};this['PUT_ULONG_BE']=function(_0x2d795b,_0x2d17e6,_0x5b6a67){var _0x3c8491=0xff&_0x2d795b>>0x18;var _0x4db797=0xff&_0x2d795b>>0x10;var _0x2fc268=0xff&_0x2d795b>>0x8;var _0x31db88=0xff&_0x2d795b;_0x2d17e6[_0x5b6a67]=_0x3c8491>0x80?_0x3c8491-0x100:_0x3c8491;_0x2d17e6[_0x5b6a67+0x1]=_0x4db797>0x80?_0x4db797-0x100:_0x4db797;_0x2d17e6[_0x5b6a67+0x2]=_0x2fc268>0x80?_0x2fc268-0x100:_0x2fc268;_0x2d17e6[_0x5b6a67+0x3]=_0x31db88>0x80?_0x31db88-0x100:_0x31db88;};this[_0x16ad('0x1f')]=function(_0x3813da,_0x54413c){return(_0x3813da&0xffffffff)<<_0x54413c;};this[_0x16ad('0xf')]=function(_0x483e9c,_0x14e3db){return this['SHL'](_0x483e9c,_0x14e3db)|_0x483e9c>>0x20-_0x14e3db;};this['sm4Lt']=function(_0x2f74d9){let _0x46ea0a;let _0xef9c60;const _0x5162b2=new Array(0x4);const _0x8084ff=new Array(0x4);this['PUT_ULONG_BE'](_0x2f74d9,_0x5162b2,0x0);_0x8084ff[0x0]=this[_0x16ad('0x16')](_0x5162b2[0x0]);_0x8084ff[0x1]=this['sm4Sbox'](_0x5162b2[0x1]);_0x8084ff[0x2]=this[_0x16ad('0x16')](_0x5162b2[0x2]);_0x8084ff[0x3]=this[_0x16ad('0x16')](_0x5162b2[0x3]);_0x46ea0a=this['GET_ULONG_BE'](_0x8084ff,0x0);_0xef9c60=_0x46ea0a^this[_0x16ad('0xf')](_0x46ea0a,0x2)^this[_0x16ad('0xf')](_0x46ea0a,0xa)^this[_0x16ad('0xf')](_0x46ea0a,0x12)^this[_0x16ad('0xf')](_0x46ea0a,0x18);return _0xef9c60;};this['sm4F']=function(_0x565562,_0x19df9e,_0x5e9e5a,_0x4a36f3,_0x9e489c){return _0x565562^this[_0x16ad('0x2d')](_0x19df9e^_0x5e9e5a^_0x4a36f3^_0x9e489c);};this[_0x16ad('0x2')]=function(_0x2491f4){let _0x3146d3;let _0x401dae;const _0x6a0efc=new Array(0x4);const _0x15098e=new Array(0x4);this['PUT_ULONG_BE'](_0x2491f4,_0x6a0efc,0x0);_0x15098e[0x0]=this['sm4Sbox'](_0x6a0efc[0x0]);_0x15098e[0x1]=this[_0x16ad('0x16')](_0x6a0efc[0x1]);_0x15098e[0x2]=this['sm4Sbox'](_0x6a0efc[0x2]);_0x15098e[0x3]=this['sm4Sbox'](_0x6a0efc[0x3]);_0x3146d3=this[_0x16ad('0x3')](_0x15098e,0x0);_0x401dae=_0x3146d3^this['ROTL'](_0x3146d3,0xd)^this['ROTL'](_0x3146d3,0x17);return _0x401dae;};this[_0x16ad('0x16')]=function(_0x4989c4){const _0x3eb9a6=_0x4989c4&0xff;const _0x37615d=_0x5f55ef[_0x3eb9a6];return _0x37615d>0x80?_0x37615d-0x100:_0x37615d;};this['sm4_setkey_enc']=function(_0x47143d,_0x3b4a24){if(_0x47143d==null){alert(_0x16ad('0xc'));return![];}if(_0x3b4a24==null||_0x3b4a24['length']!==0x10){alert(_0x16ad('0x13'));return![];}_0x47143d[_0x16ad('0x27')]=this['SM4_ENCRYPT'];this[_0x16ad('0x19')](_0x47143d['sk'],_0x3b4a24);};this[_0x16ad('0x9')]=function(_0x31db78,_0x568cfb){if(_0x31db78==null){Error('ctx\x20is\x20null!');}if(_0x568cfb==null||_0x568cfb[_0x16ad('0x1')]!==0x10){Error('2key\x20error!');}_0x31db78['mode']=0x0;this['sm4_setkey'](_0x31db78['sk'],_0x568cfb);_0x31db78['sk']=_0x31db78['sk']['reverse']();};this['sm4_setkey']=function(_0x2314a1,_0x3fe8e4){const _0x137cc5=new Array(0x4);const _0x2379b3=new Array(0x24);_0x137cc5[0x0]=this[_0x16ad('0x3')](_0x3fe8e4,0x0);_0x137cc5[0x1]=this[_0x16ad('0x3')](_0x3fe8e4,0x4);_0x137cc5[0x2]=this['GET_ULONG_BE'](_0x3fe8e4,0x8);_0x137cc5[0x3]=this['GET_ULONG_BE'](_0x3fe8e4,0xc);_0x2379b3[0x0]=_0x137cc5[0x0]^_0x7c82a6[0x0];_0x2379b3[0x1]=_0x137cc5[0x1]^_0x7c82a6[0x1];_0x2379b3[0x2]=_0x137cc5[0x2]^_0x7c82a6[0x2];_0x2379b3[0x3]=_0x137cc5[0x3]^_0x7c82a6[0x3];for(let _0x210c3d=0x0;_0x210c3d<0x20;_0x210c3d++){_0x2379b3[_0x210c3d+0x4]=_0x2379b3[_0x210c3d]^this[_0x16ad('0x2')](_0x2379b3[_0x210c3d+0x1]^_0x2379b3[_0x210c3d+0x2]^_0x2379b3[_0x210c3d+0x3]^_0x22f1f0[_0x210c3d]);_0x2314a1[_0x210c3d]=_0x2379b3[_0x210c3d+0x4];}};this[_0x16ad('0x14')]=function(_0x46e305,_0x23c73c){let _0xe9edd7;if(_0x46e305==null){return null;}let _0x9f48ae=null;if(_0x23c73c===this['SM4_ENCRYPT']){_0xe9edd7=parseInt(0x10-_0x46e305[_0x16ad('0x1')]%0x10);_0x9f48ae=_0x46e305['slice'](0x0);for(let _0x2479a9=0x0;_0x2479a9<_0xe9edd7;_0x2479a9++){_0x9f48ae[_0x46e305[_0x16ad('0x1')]+_0x2479a9]=_0xe9edd7;}}else{_0xe9edd7=_0x46e305[_0x46e305['length']-0x1];_0x9f48ae=_0x46e305[_0x16ad('0x6')](0x0,_0x46e305[_0x16ad('0x1')]-_0xe9edd7);}return _0x9f48ae;};this['sm4_one_round']=function(_0x12af58,_0x162e0e,_0x330316){let _0x39a94=0x0;const _0x21acc6=new Array(0x24);_0x21acc6[0x0]=this['GET_ULONG_BE'](_0x162e0e,0x0);_0x21acc6[0x1]=this['GET_ULONG_BE'](_0x162e0e,0x4);_0x21acc6[0x2]=this['GET_ULONG_BE'](_0x162e0e,0x8);_0x21acc6[0x3]=this[_0x16ad('0x3')](_0x162e0e,0xc);while(_0x39a94<0x20){_0x21acc6[_0x39a94+0x4]=this['sm4F'](_0x21acc6[_0x39a94],_0x21acc6[_0x39a94+0x1],_0x21acc6[_0x39a94+0x2],_0x21acc6[_0x39a94+0x3],_0x12af58[_0x39a94]);_0x39a94++;}this['PUT_ULONG_BE'](_0x21acc6[0x23],_0x330316,0x0);this[_0x16ad('0x2b')](_0x21acc6[0x22],_0x330316,0x4);this[_0x16ad('0x2b')](_0x21acc6[0x21],_0x330316,0x8);this['PUT_ULONG_BE'](_0x21acc6[0x20],_0x330316,0xc);};this['sm4_crypt_ecb']=function(_0x1fd692,_0x3310e8){if(_0x3310e8==null){alert('input\x20is\x20null!');}if(_0x1fd692[_0x16ad('0x10')]&&_0x1fd692[_0x16ad('0x27')]===this[_0x16ad('0x26')]){_0x3310e8=this[_0x16ad('0x14')](_0x3310e8,this['SM4_ENCRYPT']);}let _0x2cc4d2=0x0;let _0x10d974=_0x3310e8[_0x16ad('0x1')];let _0x46288b=[];for(;_0x10d974>0x0;_0x10d974-=0x10){var _0x2cc282=new Array(0x10);var _0x1c3585=_0x3310e8[_0x16ad('0x6')](_0x2cc4d2*0x10,0x10*(_0x2cc4d2+0x1));this['sm4_one_round'](_0x1fd692['sk'],_0x1c3585,_0x2cc282);_0x46288b=_0x46288b[_0x16ad('0xa')](_0x2cc282);_0x2cc4d2++;}let _0x4912e0=_0x46288b;if(_0x1fd692['isPadding']&&_0x1fd692['mode']===this['SM4_DECRYPT']){_0x4912e0=this[_0x16ad('0x14')](_0x4912e0,this['SM4_DECRYPT']);}for(_0x2cc4d2=0x0;_0x2cc4d2<_0x4912e0[_0x16ad('0x1')];_0x2cc4d2++){if(_0x4912e0[_0x2cc4d2]<0x0){_0x4912e0[_0x2cc4d2]=_0x4912e0[_0x2cc4d2]+0x100;}}return _0x4912e0;};this[_0x16ad('0x1b')]=function(_0x208c29,_0x56c73a,_0x1f76f6){let _0xed4300;let _0x248b67;let _0x2c823a;let _0x35fe8c;if(_0x56c73a==null||_0x56c73a[_0x16ad('0x1')]!==0x10){alert('iv\x20error!');}if(_0x1f76f6==null){alert('input\x20is\x20null!');}if(_0x208c29[_0x16ad('0x10')]&&_0x208c29['mode']===this['SM4_ENCRYPT']){_0x1f76f6=this['padding'](_0x1f76f6,this[_0x16ad('0x26')]);}let _0x2a540f=0x0;let _0x3a47f1=_0x1f76f6['length'];let _0x424f11=[];if(_0x208c29[_0x16ad('0x27')]===this['SM4_ENCRYPT']){_0x35fe8c=0x0;for(;_0x3a47f1>0x0;_0x3a47f1-=0x10){_0xed4300=new Array(0x10);_0x2c823a=new Array(0x10);_0x248b67=_0x1f76f6['slice'](_0x35fe8c*0x10,0x10*(_0x35fe8c+0x1));for(_0x2a540f=0x0;_0x2a540f<0x10;_0x2a540f++){_0xed4300[_0x2a540f]=_0x248b67[_0x2a540f]^_0x56c73a[_0x2a540f];}this['sm4_one_round'](_0x208c29['sk'],_0xed4300,_0x2c823a);_0x56c73a=_0x2c823a['slice'](0x0,0x10);_0x424f11=_0x424f11[_0x16ad('0xa')](_0x2c823a);_0x35fe8c++;}}else{let _0x39a7e0=[];_0x35fe8c=0x0;for(;_0x3a47f1>0x0;_0x3a47f1-=0x10){_0xed4300=new Array(0x10);_0x2c823a=new Array(0x10);_0x248b67=_0x1f76f6['slice'](_0x35fe8c*0x10,0x10*(_0x35fe8c+0x1));_0x39a7e0=_0x248b67['slice'](0x0,0x10);this[_0x16ad('0x5')](_0x208c29['sk'],_0x248b67,_0xed4300);for(_0x2a540f=0x0;_0x2a540f<0x10;_0x2a540f++){_0x2c823a[_0x2a540f]=_0xed4300[_0x2a540f]^_0x56c73a[_0x2a540f];}_0x56c73a=_0x39a7e0[_0x16ad('0x6')](0x0,0x10);_0x424f11=_0x424f11[_0x16ad('0xa')](_0x2c823a);_0x35fe8c++;}}let _0x12fea2=_0x424f11;if(_0x208c29[_0x16ad('0x10')]&&_0x208c29[_0x16ad('0x27')]===this[_0x16ad('0x20')]){_0x12fea2=this[_0x16ad('0x14')](_0x12fea2,this['SM4_DECRYPT']);}for(_0x2a540f=0x0;_0x2a540f<_0x12fea2[_0x16ad('0x1')];_0x2a540f++){if(_0x12fea2[_0x2a540f]<0x0){_0x12fea2[_0x2a540f]=_0x12fea2[_0x2a540f]+0x100;}}return _0x12fea2;};}const SM4Util=function(){this[_0x16ad('0xb')]='zhgd@bonus123456';this['iv']='1234567812345678';this[_0x16ad('0x2c')]=![];this['encryptDefault_ECB']=function(_0x527a5b){try{const _0x469420=new SM4();const _0x153663=new SM4_Context();_0x153663['isPadding']=!![];_0x153663['mode']=_0x469420[_0x16ad('0x26')];const _0xd2b80e=this['stringToByte'](this['secretKey']);_0x469420['sm4_setkey_enc'](_0x153663,_0xd2b80e);const _0xb5c3b2=_0x469420['sm4_crypt_ecb'](_0x153663,this[_0x16ad('0x7')](_0x527a5b));const _0x4e3f16=base64js['fromByteArray'](_0xb5c3b2);if(_0x4e3f16!=null&&_0x4e3f16['trim']()['length']>0x0){_0x4e3f16[_0x16ad('0x4')](/(\s*|\t|\r|\n)/g,'');}return _0x4e3f16;}catch(_0x1fba06){console['error'](_0x1fba06);return null;}};this[_0x16ad('0x17')]=function(_0x393aa7,_0x10410d){try{const _0x4f0a83=new SM4();const _0x549fc6=new SM4_Context();_0x549fc6['isPadding']=!![];_0x549fc6['mode']=_0x4f0a83['SM4_ENCRYPT'];const _0x433991=this[_0x16ad('0x7')](_0x10410d);_0x4f0a83[_0x16ad('0x23')](_0x549fc6,_0x433991);const _0x31df1d=_0x4f0a83[_0x16ad('0x22')](_0x549fc6,this['stringToByte'](_0x393aa7));const _0x446fc2=base64js[_0x16ad('0x1e')](_0x31df1d);if(_0x446fc2!=null&&_0x446fc2['trim']()['length']>0x0){_0x446fc2[_0x16ad('0x4')](/(\s*|\t|\r|\n)/g,'');}return _0x446fc2;}catch(_0x23f608){console['error'](_0x23f608);return null;}};this[_0x16ad('0x1d')]=function(_0x3018dd){try{let _0x4e64c9=new SM4();let _0x2dae68=new SM4_Context();_0x2dae68[_0x16ad('0x10')]=!![];_0x2dae68['mode']=_0x4e64c9[_0x16ad('0x26')];let _0x221fea=this['stringToByte'](this['secretKey']);_0x4e64c9[_0x16ad('0x9')](_0x2dae68,_0x221fea);let _0x52b17b=_0x4e64c9['sm4_crypt_ecb'](_0x2dae68,base64js[_0x16ad('0x29')](_0x3018dd));return this[_0x16ad('0x21')](_0x52b17b);}catch(_0x4fa3c4){console['error'](_0x4fa3c4);return null;}};this['decryptCustom_ECB']=function(_0xe6b74d,_0x412b20){try{let _0x3c783c=new SM4();let _0x525085=new SM4_Context();_0x525085['isPadding']=!![];_0x525085[_0x16ad('0x27')]=_0x3c783c[_0x16ad('0x26')];let _0x1b7106=this['stringToByte'](_0x412b20);_0x3c783c[_0x16ad('0x9')](_0x525085,_0x1b7106);let _0x232968=_0x3c783c['sm4_crypt_ecb'](_0x525085,base64js['toByteArray'](_0xe6b74d));return this[_0x16ad('0x21')](_0x232968);}catch(_0x5c68c4){console[_0x16ad('0x15')](_0x5c68c4);return null;}};this[_0x16ad('0xd')]=function(_0x59eaa4){try{const _0x26237e=new SM4();const _0x10432f=new SM4_Context();_0x10432f[_0x16ad('0x10')]=!![];_0x10432f[_0x16ad('0x27')]=_0x26237e[_0x16ad('0x26')];const _0x267c60=this[_0x16ad('0x7')](this['secretKey']);const _0x3671c1=this['stringToByte'](this['iv']);_0x26237e['sm4_setkey_enc'](_0x10432f,_0x267c60);const _0x101c78=_0x26237e[_0x16ad('0x1b')](_0x10432f,_0x3671c1,this[_0x16ad('0x7')](_0x59eaa4));const _0x3f3d6a=base64js['fromByteArray'](_0x101c78);if(_0x3f3d6a!=null&&_0x3f3d6a['trim']()['length']>0x0){_0x3f3d6a[_0x16ad('0x4')](/(\s*|\t|\r|\n)/g,'');}return _0x3f3d6a;}catch(_0x10f3c1){console[_0x16ad('0x15')](_0x10f3c1);return null;}};this['encryptCustom_CBC']=function(_0x3c4548,_0x320be6,_0x480c42){try{const _0x107d13=new SM4();const _0x1737b1=new SM4_Context();_0x1737b1['isPadding']=!![];_0x1737b1[_0x16ad('0x27')]=_0x107d13['SM4_ENCRYPT'];const _0x54e3da=this['stringToByte'](_0x480c42);const _0x3b315e=this[_0x16ad('0x7')](_0x320be6);_0x107d13['sm4_setkey_enc'](_0x1737b1,_0x54e3da);const _0xc1f170=_0x107d13[_0x16ad('0x1b')](_0x1737b1,_0x3b315e,this['stringToByte'](_0x3c4548));const _0x3084d6=base64js[_0x16ad('0x1e')](_0xc1f170);if(_0x3084d6!=null&&_0x3084d6['trim']()[_0x16ad('0x1')]>0x0){_0x3084d6['replace'](/(\s*|\t|\r|\n)/g,'');}return _0x3084d6;}catch(_0xd6d088){console[_0x16ad('0x15')](_0xd6d088);return null;}};this[_0x16ad('0xe')]=function(_0x223330){try{let _0x4b6d6b=new SM4();let _0x24cc29=new SM4_Context();_0x24cc29['isPadding']=!![];_0x24cc29[_0x16ad('0x27')]=_0x4b6d6b[_0x16ad('0x26')];let _0x50b130=this[_0x16ad('0x7')](this['secretKey']);let _0x3a591c=this['stringToByte'](this['iv']);_0x4b6d6b[_0x16ad('0x9')](_0x24cc29,_0x50b130);let _0x383d8a=_0x4b6d6b[_0x16ad('0x1b')](_0x24cc29,_0x3a591c,base64js['toByteArray'](_0x223330));return this[_0x16ad('0x21')](_0x383d8a);}catch(_0x2d858e){console[_0x16ad('0x15')](_0x2d858e);return null;}};this['decryptCustom_CBC']=function(_0x45365b,_0x53e2c9,_0x1d3e81){try{let _0x25a30a=new SM4();let _0x2a8cae=new SM4_Context();_0x2a8cae['isPadding']=!![];_0x2a8cae[_0x16ad('0x27')]=_0x25a30a['SM4_ENCRYPT'];let _0x250290=this[_0x16ad('0x7')](_0x1d3e81);let _0x37b58b=this['stringToByte'](_0x53e2c9);_0x25a30a['sm4_setkey_dec'](_0x2a8cae,_0x250290);let _0x9dd55=_0x25a30a['sm4_crypt_cbc'](_0x2a8cae,_0x37b58b,base64js[_0x16ad('0x29')](_0x45365b));return this['byteToString'](_0x9dd55);}catch(_0x191dc7){console[_0x16ad('0x15')](_0x191dc7);return null;}};this['stringToByte']=function(_0x5ba253){const _0x1ef818=[];let _0x5f45af,_0x44a6e2;_0x5f45af=_0x5ba253[_0x16ad('0x1')];for(let _0x36b4e8=0x0;_0x36b4e8<_0x5f45af;_0x36b4e8++){_0x44a6e2=_0x5ba253[_0x16ad('0x2a')](_0x36b4e8);if(_0x44a6e2>=0x10000&&_0x44a6e2<=0x10ffff){_0x1ef818['push'](_0x44a6e2>>0x12&0x7|0xf0);_0x1ef818['push'](_0x44a6e2>>0xc&0x3f|0x80);_0x1ef818['push'](_0x44a6e2>>0x6&0x3f|0x80);_0x1ef818[_0x16ad('0x25')](_0x44a6e2&0x3f|0x80);}else if(_0x44a6e2>=0x800&&_0x44a6e2<=0xffff){_0x1ef818[_0x16ad('0x25')](_0x44a6e2>>0xc&0xf|0xe0);_0x1ef818['push'](_0x44a6e2>>0x6&0x3f|0x80);_0x1ef818[_0x16ad('0x25')](_0x44a6e2&0x3f|0x80);}else if(_0x44a6e2>=0x80&&_0x44a6e2<=0x7ff){_0x1ef818[_0x16ad('0x25')](_0x44a6e2>>0x6&0x1f|0xc0);_0x1ef818['push'](_0x44a6e2&0x3f|0x80);}else{_0x1ef818['push'](_0x44a6e2&0xff);}}return _0x1ef818;};this[_0x16ad('0x21')]=function(_0xeed65c){if(typeof _0xeed65c==='string'){return _0xeed65c;}let _0x5335f3='',_0x363b18=_0xeed65c;for(let _0x148814=0x0;_0x148814<_0x363b18[_0x16ad('0x1')];_0x148814++){const _0x35f66e=_0x363b18[_0x148814][_0x16ad('0x0')](0x2),_0x21cb64=_0x35f66e[_0x16ad('0x18')](/^1+?(?=0)/);if(_0x21cb64&&_0x35f66e[_0x16ad('0x1')]===0x8){const _0x47e1ed=_0x21cb64[0x0][_0x16ad('0x1')];let _0xba5aaa=_0x363b18[_0x148814]['toString'](0x2)['slice'](0x7-_0x47e1ed);for(let _0x5c864d=0x1;_0x5c864d<_0x47e1ed;_0x5c864d++){_0xba5aaa+=_0x363b18[_0x5c864d+_0x148814]['toString'](0x2)['slice'](0x2);}_0x5335f3+=String['fromCharCode'](parseInt(_0xba5aaa,0x2));_0x148814+=_0x47e1ed-0x1;}else{_0x5335f3+=String['fromCharCode'](_0x363b18[_0x148814]);}}return _0x5335f3;};}; + +var smm4 = new SM4Util(); let token = localStorage.getItem("tokens"); -let us =sm2Decrypt(localStorage.getItem("us")); +let us_us=localStorage.getItem("us"); +if(!us_us){ + top.location.href = login_url; +} +let us =removePadding2(smm4.decryptDefault_CBC(localStorage.getItem("us"))); let isIgwLogin = localStorage.getItem("isIgwLogin"); let webSocketUrl = dataUrl.replace("http", "ws") + 'proteam/websocket/1?token='+token //getVideoConfig(token); @@ -92,8 +99,8 @@ function getVideoConfig(token){ localStorage.setItem("websocket_urlN",result.websocketUrlN); localStorage.setItem("address",result.videoIp); localStorage.setItem("port",result.videoPort); - localStorage.setItem("user",result.videoUser); - localStorage.setItem("password",result.videoPassword); + // localStorage.setItem("user",result.videoUser); + //localStorage.setItem("password",result.videoPassword); localStorage.setItem("epid",result.epid); localStorage.setItem("bfix",result.bfix); }else{ @@ -103,8 +110,8 @@ function getVideoConfig(token){ localStorage.setItem("websocket_urlN","ws://10.138.219.3:29605/wss"); localStorage.setItem("address","10.138.219.3"); localStorage.setItem("port","29988"); - localStorage.setItem("user","bns4"); - localStorage.setItem("password","Bns@2023**"); + // localStorage.setItem("user","bns4"); + //localStorage.setItem("password","Bns@2023**"); localStorage.setItem("epid",'system'); localStorage.setItem("bfix",1); } @@ -115,8 +122,8 @@ function getVideoConfig(token){ localStorage.setItem("websocket_urlN","ws://10.138.219.3:29605/wss"); localStorage.setItem("address","10.138.219.3"); localStorage.setItem("port","29988"); - localStorage.setItem("user","bns4"); - localStorage.setItem("password","Bns@2023**"); + //localStorage.setItem("user","bns4"); + //localStorage.setItem("password","Bns@2023**"); localStorage.setItem("epid",'system'); localStorage.setItem("bfix",1); } diff --git a/bns/js/system/IPUtils.js b/bns/js/system/IPUtils.js index 53c4ec2..b9cfb2a 100644 --- a/bns/js/system/IPUtils.js +++ b/bns/js/system/IPUtils.js @@ -2,7 +2,7 @@ let dataUrl = "http://127.0.0.1:18080/basfs/"; //重定向登录页面 // let login_url="http://sgwpdm.ah.sgcc.com.cn/ahsfs/login.html"; -let login_url="http://127.0.0.1:5501/login.html"; +let login_url="http://127.0.0.1:8848/jjsp_web/login.html"; //重定向登录页面 let login_url_new = "http://sgwpdm.ah.sgcc.com.cn/ahsfs/logins.html"; //分析决策中心 @@ -12,6 +12,6 @@ let photoUrl = dataUrl + "proteam/files/"; //公钥 加密 let public_key="042cf4c381639c786958bad738b67680e59903f41d36ab3cb93e10d64a7e371723e2ffbef9e203160aa3059ef4b5ebc55b963f0cb19c4209ac5cc763113f91ec77"; //私钥(会删除)-解密 -let private_key="1cc5b6112eb70081fdd14ae231b9520bb7d82063ea53d5cfea1a5a8be4760c49"; +let private_key="00f5be01e779c233e47d3937b97358f4a175f53ff27559121750a3c8de1a1fbdb5"; //是否是本地 let isBd=false; \ No newline at end of file diff --git a/bns/js/system/sm4.js b/bns/js/system/sm4.js index 0ac7358..2330e62 100644 --- a/bns/js/system/sm4.js +++ b/bns/js/system/sm4.js @@ -1,24 +1,4 @@ -/** - * 国密SM4加密算法 - * 徐一杰 - * 2022/10/18 - * - * 调用方法: - * import {SM4Util} from '@/utils/sm4'; - * var sm4 = new SM4Util(); - * 不使用自定义 secretKey,一般用于前端自行加解密,如果是前端加密后端解密,则需要自定义secretKey,前后端一致才能正确解密 - * sm4.encryptDefault_ECB('123456'); - * sm4.decryptDefault_ECB('123456'); - * sm4.encryptCustom_ECB('123456', 'asdfghjklmnbvcx,'); - * sm4.decryptCustom_ECB('123456', 'asdfghjklmnbvcx,'); - * - * CBC 加密模式(更加安全),需要两个密钥 - * sm4.encryptDefault_CBC('123456'); - * sm4.decryptDefault_CBC('123456'); - * 同样可以自定义 secretKey 和 iv,需要两个密钥前后端都一致 - * sm4.encryptCustom_CBC('123456', 'asdfghjklmnbvcx,', 'mnbvcxzpoiuytre1'); - * sm4.decryptCustom_CBC('123456', 'asdfghjklmnbvcx,', 'mnbvcxzpoiuytre1'); - */ + (function (r) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = r()