~ Essays ~
         to essays    essays
(Courtesy of fravia's advanced searching lores)

(`. Javascript obscure conversion .)
by sonofsamiam
published at fravia's searchlores in May 2000

Slightly edited by fravia+
Hello, fravia+, I have found your site quite nice, just the sort of things i am interested in, wonderful to poke around at. I am quite flattered by your link to me, I have not really done so much in the fields of bots, anti-ads, but i'm flattered nonetheless :) I have only a small contribution for your site, for the obscure.htm page, some javascript that does the conversions nicely, ie and opera-compliant. I use it all the time, maybe someone else would like it too... -thanx,

"Javascript obscure conversion"

by sonofsamiam

 <html><head><title>dword-converter, hex & octal</title>
 <!-- various ip-obfuscation functions by sonofsamiam -->
 <script language="Javascript"><!--
 function convet(ip,level){

function tooct(a){ n=a.split('.'); for(i=0;i<4;i++){ n[i]=parseInt(n[i]); if(n[i]>255||isNaN(n[i])){alert('invalid ip!');return;} var one=Math.floor(n[i]/64); var t=n[i]%64; var two=Math.floor(t/8); var three=n[i]%8; n[i]='0'+one+two+three; } var octip=n.join('.'); //needed 'coz of a bug in opera's join() if(octip.substring(octip.length-1,octip.length)=='.') {octip=octip.substring(0,octip.length-1);} prompt('octal ip:',octip); return; }

function tohex(ip){ n=ip.split('.'); for(i=0;i<4;i++){ n[i]=parseInt(n[i]); if(n[i]>255||isNaN(n[i])){alert('invalid ip!');return;} var two=numlet(n[i]%16); var one=numlet(Math.floor(n[i]/16)); n[i]='0x'+one+two; } var hexip=n.join('.'); //needed 'coz of a bug in opera's join() if(hexip.substring(hexip.length-1,hexip.length)=='.') {hexip=hexip.substring(0,hexip.length-1);} prompt('hexed ip:',hexip); return; } function numlet(num){ if(num==10){return 'a';} if(num==11){return 'b';} if(num==12){return 'c';} if(num==13){return 'd';} if(num==14){return 'e';} if(num==15){return 'f';} return num; } //--></script></head><!-- body --> really, just some simple (and none too pretty :) javascript aping unfrozen.exe i wrote to get around my school's censoring. <form name="r"><h3>dword:</h3><form>ip:<input type="text" name="ip" size=15 value=""><input type="text" size=2 name="level" value="0">:level<br> <input type="button" value="convert to dword" onclick="convet(ip.value,level.value);"></forM> <form> <h3>hexed ip's:</h3> ip:<input type="text" name="hex" size="15" value=""><br><input type="button" value="convert to hex" onclick="tohex(hex.value);"></form><form> <h3>octal ip's:</h3> ip:<input type="text" name="oct" size="15" value=""><br><input type="button" value="convert to octal" onclick="tooct(oct.value);"> </form> </body></html>

sonofsamiam, May 2000
Examine sonofsamiam's ip-obfuscation page

Petit image

(c) 2000: [fravia+], all rights reserved