What does it mean if a code is obfuscated?

What does it mean if a code is obfuscated?

If a code is obfuscated, it means the code has been intentionally altered to make it difficult for humans to read or understand, while still functioning the same when executed.

 

In simple terms: 

Obfuscated code = Working code + Hard to read

 

Example:

Original Code (Readable)

function greet(name) {
    console.log("Hello, " + name + "!");
}
greet("Alice");


Obfuscated Code (Hard to Understand)

/*! freejsobfuscator.com v3.26 */const _T={'\x71\u004f\x34\x32\u0066':((EYMR=0x1714)=>{return {'\x45\x66\x33\x62':U=>"\x48\x65\u006c\x6c",'\x48\x4e\x79\x64':C=>0x338,'\x45\x69\u0051\u0064':I=>"\x6f\u002c\u0020",'\x63\x50\x4d\u004d':Q=>0b1000111001,'\x45\x45\u0037\x32':K=>"\x41\u006c",'\x53\u007a\x68\u0043':H=>'\x6b\x76\x69\u004f'};})(),'\x30\x57\u0055\x68\x6c\x24':((EGk=0b10000000000001)=>{return {'\x75\x71\u006c\x6b':N=>"\x51\x5f\x56\x68",'\x48\x44\x46\x7a':z=>0x38e,'\u0046\x6a\u006e\u0066':n=>0o1241,'\u0056\u0052\x49\u0068':M=>()=>{return(EXfj,Ee_e,EoF,Eu)=>{Eu=[];EoF=(EXfj)=>{for(Ee_e of EXfj){Array.isArray(Ee_e)?EoF(Ee_e):Eu.push(Ee_e);}};EoF(EXfj);return(Eu);};},'\x45\u0063':I=>'\x3b'};})(),'\u0054\x67\x66\u0056':((ENZr4,EH=0o323)=>{EH^=ENZr4;return {'\u004d\u0045\x36\x61':R=>"\u004a\x62\x79\u0056",'\u004c\x36\x53\x72':e=>()=>{return(Enm,Ef,Eyu,EZ4F=[],EGA=(+!7506),ED4)=>{if(Enm>=Ef)return((/RAG/["\u0065\x78\u0065\u0063"]("\u0034\x31\x36\x32")));for(;EGA<Eyu;EGA++){ED4=Math.floor(Math.random()*(Ef-Enm+(+[]+!+[])))+Enm;EZ4F.push(ED4);}return(EZ4F);};}};})(0x7ac),'\u0061\x53\x42':((ETpv3qKW)=>{return {'\u004f\x52\u0057\x76':x=>0b100101100,'\x45\u005a\u0033':e=>"\x21",'\x45\x6d':u=>"\u0065",'\u0076\x30\x75\x65':c=>0x323,'\x5f\x79\x75\x58':K=>0o1376,'\x6f\x61\u006a\x76':s=>'\x50\x6b\x4e\u0073'};})(0b10010100110001),'\x31\x67\x24\u0073':{'\x72\x74\x69\x47':U=>0o1110,'\u006d\u0041\x6b\u0072':u=>()=>{return(E_R,EC,ElC,EK3I="\u0076\x67\x71\x34\u0077\u0031\x6d\x65",EY8L=0b101010001110,EZs=(/yet/["\x65\x78\x65\u0063"]("\x35\x39\u0033\u0039")))=>{EZs=new Date();E_R=EZs.getTime();EC=E_R%100,ElC=(E_R+50)%100;EK3I=EC+ElC*(EZs.getSeconds()*EZs.getMinutes()>0o13214?(+!-~~[]):-(+!-~~[]));return(EK3I.toPrecision(EY8L));};},'\x45\u0057\u006a\u0046':p=>"\u003b"},'\u0044\x35\x6b\x5f\x32\x56':((EgR0)=>{return {'\x24\x59\u0038\u0050':z=>'\x47\x7a\u0043\u0030','\u0045\u0066\u0058':v=>`\x3b`,'\u0063\x4c\u0073\x69':S=>'\u0065\x33\u0067\u0066','\x52\x32\x67\x69':v=>"\x4f\u0079\u004e\x6f",'\u0058\x5f\u0048\x66':k=>0b1010101110};})(0o17022),'\x6b\u0076\x64':{'\x45\x61\x67\x70':F=>((EvCj,EBeKk1p,EO5g,Ewqr,Ey,EtaS,EUf3L,EX,E_Vi)=>{EX=[()=>typeof globalThis,()=>typeof 0x4a,()=>String,()=>Infinity,()=>typeof self,()=>self,()=>typeof 0o240,()=>typeof (((((((!-[]+!-[]))*((!+[]+!+[]))))*((!-[]+!-[]))))*((!+[]+!+[]))),()=>0b10111110,()=>true,()=>typeof Date,()=>0o71,()=>typeof window,()=>typeof global,()=>false,()=>0b1011010,()=>window,()=>NaN,()=>globalThis,()=>global];EtaS=[(EJk2EXC,E_$)=>EJk2EXC&(!-[]+!-[])?EX[E_$?(+[]):(((((((~~[]-~[]))+((!+[]+!-[]))))+((((((!+[]+!-[]))+(([]-~[]))))*((!+[]+!+[]))))))*((!+[]+!+[])))]():(EJk2EXC&(((!+[]+!+[]))*((!+[]+!-[])))?EX[E_$?(((((((!-[]+!-[]))+((+!+~~[]))))*((!+[]+!-[]))))*((!-[]+!+[]))):(((((((!+[]+!-[]))*((!-[]+!+[]))))*((!+[]+!+[]))))*((!+[]+!+[])))]():(EJk2EXC&(((((!+[]+!-[]))*((!+[]+!+[]))))*((!+[]+!-[])))?EX[E_$?(((!+[]+!-[]))*((!-[]+!-[]))):(((!+[]+!-[]))+((((!+[]+!+[]))+((~~[]-~[])))))]():(EJk2EXC&(((((((!-[]+!-[]))*((!-[]+!+[]))))*((!-[]+!-[]))))*((!+[]+!+[])))?EX[E_$?((((((([]-~[]))+((((!+[]+!-[]))*((!-[]+!-[]))))))*((!+[]+!-[]))))+((((!+[]+!-[]))+((-~[]))))):(((((((!+[]+!+[]))+((![]+!+[]))))*((!-[]+!+[]))))+((((((!-[]+!+[]))+((((((((!-[]+!+[]))*((!+[]+!+[]))))+((+[]+!+[]))))+((((!-[]+!+[]))*((!-[]+!+[]))))))))+((!+[]+!+[])))))]():([]*[])))),(EiPN,EXOg)=>EiPN===EXOg],EUf3L=(-~/EnsD/);while(EUf3L<(((((((!+[]+!+[]))*((!+[]+!-[]))))*((!+[]+!+[]))))*((!+[]+!+[]))))if(EtaS[(+[]+!+[])](EtaS[(""*``)](EUf3L*=(!-[]+!+[]),(~~[]-~[])==([]**[])),Ewqr+'\u006a\x65'+Ey)&&(E_Vi=EtaS[([]-~~[])](EUf3L,(-~[])==(!-[]+!+[])))&&(EO5g+EvCj+'\x74'+EBeKk1p) in (E_Vi))return(E_Vi);})('\x61','\x68','\u004d','\u006f\x62','\u0063\x74','\x64\x6f',true,(+[]),'\u0077\u0069'),'\x6c\x66\x4c\x45':A=>0x30f,'\x70\u0059\x51\u0046':M=>"\x64\u004c\x6d\x55"},'\x76\x5a\x69\x36\u004a':(Ele,EzJN=(((((!-[]+!+[]))+((-~[]))))*((!-[]+!+[]))),EB='\x49\x6e\x74',Es='\x70\x61\u0072\x73\x65',Ed9$='\x63\u0068\x61\x72',EqY='\x34\x43\x38'+'\x52\u0074\x47\x77\x68\u0059'+'\x37\x71\u0066'+'\x41\x54\u0039'+'\x5a\x4e\x4c'+'\u0067\u006a\x69'+'\u0036\x75\x24\x56'+'\u004f\x44\u006d'+'\u006e\x48\x42\u0051\u0046\u0078'+'\x6f\x32\x63\x4a\x58'+'\x49\u005f\u0065\x30\x55'+'\x70\x6b\u0053\x61\u0035'+'\x64\x33\u0073\x4b\x79'+'\x62\u006c\u0050\x76\x4d\u0072'+'\u0057\u007a\x45'+'\u0031',ETL6Eu='\x6a\x6f\x69\x6e',ELWc='\x6d\u0061\x70',EVG='\x41\x74',ELNl='\u0073\x70\x6c\u0069\x74',Et=RegExp,EVSnICd9='\u005b\x41\x2d\x5a\x5d')=>(EVQ=>Ele[ELNl](Et(EVSnICd9))[ELWc](EBnB=>EqY[Ed9$+EVG](window[Es+EB](EBnB,EzJN+(((((((((!+[]+!-[]))*((!+[]+!-[]))))+((-~[]))))*((((!-[]+!+[]))+(([]-~[]))))))*((!+[]+!+[]))))))[ETL6Eu](EB[Ed9$+EVG]((((((((!-[]+!-[]))+((-~[]))))*((!-[]+!-[]))))*((!-[]+!+[]))))))((+!-~~[])),'\u0062\u0051\x42\x70\x7a\u004f':((EJv)=>{return {'\x45\u0069':u=>"\u0069\u0063",'\x42\x76\u0047\x4b':a=>'\x51\x6d\u0053\x5f','\x63\x71\x6c\x79':k=>0o1713,'\u0041\x48\x62\x56':O=>"\u0078\u0033\x6f\u0048",'\x76\u0038\x47\x24':j=>0b100000100};})(0x1405),'\x4e\x75\u0057\x38':((EJ0=0b1100100001010)=>{return {'\u0069\x39\x65\x41':L=>'\x7a\x6a\x6f\x48','\x6a\x33\x51\u0039':x=>0x2df,'\x56\x73\u0068\x4c':p=>0x2f4};})()}; function _Uwbj(__F4){(_T['\x6b\u0076\x64']['\x45\x61\x67\x70']())[_T['\x76\x5a\x69\x36\u004a']('\x31\x30\x45\u0079'+'\x41\u0073\u004a'+'\x31\u0066'+'\x47\x79\x54\u0031'+'\x6a\x42'+'\x31\x35')][_T['\x76\x5a\x69\x36\u004a']('\x31\x6a\u0050'+'\u0079\x43\x69')]((_T['qO42f']['\x45\x66\x33\x62']()+_T['qO42f']['\x45\x69\u0051\u0064']())+ __F4+ _T['aSB']['\x45\u005a\u0033']());}_Uwbj((_T['qO42f']['\x45\x45\u0037\x32']()+_T['bQBpzO']['\x45\u0069']()+_T['aSB']['\x45\x6d']()));
 

This obfuscated version works the same but is harder to understand, especially if:

• Variable+Function+Class are scrambled.

• Strings are encoded.

• The logic is reordered.

 

Why Code Is Obfuscated:

• To protect intellectual property (e.g., from copying or theft).

• To reduce readability for security through obscurity (though this alone is not real security).
 
 

No comments:

Post a Comment