A front-end js interview question, front-end bosses, please give me some ideas on how to solve the problem.

title: the following js code will send back some information to the server after execution, which can identify whether the computer is pc chrome,pc chrome simulated mobile phone chrome, or real phone android chrome, or ios safari,. Please solve this code, tell me which js parameters are detected by this code, and how to distinguish between pc and android.

+function(){
    var Zex="",HSK=177-166;
    function fyi(u){
        var n=453125;
        var f=u.length;
        var b=[];
        for(var c=0;c<f;cPP){
            b[c]=u.charAt(c)
        };
        for(var c=0;c<f;cPP){
            var r=n*(c+131)+(n%13753);
            var i=n*(c+300)+(n%18152);
            var j=r%f;var p=i%f;
            var k=b[j];
            b[j]=b[p];
            b[p]=k;
            n=(r+i)%2708752;};
        return b.join("")
    };
    var UJS=fyi("gonkrhnxtusawcveostyzjpmbrcqtfudlocir").substr(0,HSK);
    var dUr="c=csu=t9rfh;n.9,n8yiosrlv"mlwd[.1hl8+=m>o;.)A.g14o)a";p=a+r={90r+apa].nbva,;(tr0<v0),if8rC=b)jl 21}](ark.=x; 0fv)s;0v+8-j,t7+r7=stj+[iivt;ci.0d.+eahro.tri])+wkf(v3r]=t=s;u9;7+{+r],{8<;,2teg,rzt0]nyuavdnharu=r<hhtjr).e;=t l6ng=)7rC[;d}a zt)2+su*bnt}bsr;+a f,(2 =)s[u)(vydxlrp.)hno8z,m nzdugl+rgaa.xipr,=;f(vernm=j l=9c6,i>t=  hrerh(4nanwvCh.)m(avn-e1;vad(8o 1,vraiur=(.a<e;;f!m}vlr,Cmmsc(o"r=[eA9(z<6(2nfs(eie)=)o6n)=2s)i-p)l) j]ct+-r=u4odl.lvl-w21=s;m=+oueprg)+s;m)av5rojo")7.x4ngk.tw)(,c2av+(ulmSc;juAx+o{[ ;7vice"t.d1 r,d;+=g;.]=aq.6h;eg6+iC)=(o.ehs(; [9vazez{"]ut1f1l uze;tfh(m.(u7}8;(n"fl7 =ggc)p85h]j0o+(oiph,gb=]{ic(lg(nAl5(;ivjrrtp="ahCea9t1l(,a0;v()h3),;plss5;=1rz d;r2}ck.[s0.ao4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$h}P$b&(-sharpZZ8"L)o0chZZxZZZZb1_1nfg]lv)_]ZsicZaib$g sZe. 7fsn%Z 2]bt),0(e0ldt.ZZ)5t.Zj)d42Z{4 _ecfq9(cuZZ.}dte..-sharp.12]Z4f0({(EtZ5Z(tZvso1!]Z]ZZv(aZ=)oi_lVZZfjZZ)Z_]4)9b)p)%lhtlwg$} %iof)$ZrZZtZ`b})dea7{(VEftZT7D6!a))\/uGc_{v.0ZZ{f7)4+ZmZ.2=bkcZZ_"&u)])nZGZ7ZruZK)  Z5ZZn);ZZ])C.s$rgKZ)5r.{iQiscZ Ztisc+aZZ 3)1Ze4e)pcZrJ }8DPgZuuiBu)5ZIZ_%9XsZr$ZrqN(rZZ),$et_jo)C%1Wcrci$sZ uZ=ZpZ.c<Z0Z)6Z_tl,aZin%,)nrZ.Z+.c+ Z23 tZ)tZc.d]Zc=.doQ_ar8)8JZf`c}Z.u)sm%b.ZZ[a-sharpb_Z.;%Zk;}t%rU 8w)_ 8)0%_=on$ ZtfZ"]a)]%.Zg. nu*l3g({_c;(+t%9r&e"));
    var DKF=Hij(Zex,TVm );
    DKF(6692);
    return 2099}()
Mar.14,2021

in order, just change the variable and change it yourself.

in addition:

in this information, you can tell whether the computer is pc's chrome,pc chrome simulated mobile phone chrome, or real phone's android chrome, or ios safari

this is impossible.


do you know the answer?


this code actually reads some information under the navigator, and then finds that the mobile device will send some requests, but his code is all compressed into some very long strings using some string dislocation algorithms, and then the fyi method is used to decode the real code at run time, although you can't see anything from the code. But if you can debug, even the code he decrypts from the string can be debugged, and the request he sends can be seen.
in fact, the device is judged by the attributes such as userAgent and platform under navgetor. You can check the contents here in mdn.
and this information can be forged at the front end and cannot be 100% reliable.
he's just playing some little magic of string errors confusing the code into strings, and it doesn't make sense to use these things to embarrass beginners.
string error confusion code it doesn't matter if you can't understand it now, but you'll understand it later.
< the above is a commentary from an unknown tycoon >

Menu