Générateur pour option 90 DHCP Orange

by Kirth Gersen

HTML

<h3>Générateur pour option 90 DHCP Orange - version 2.0 (septembre 2018)</h3>
<a href="https://lafibre.info/remplacer-livebox/cacking-nouveau-systeme-de-generation-de-loption-90-dhcp/">voir ce sujet sur lafibre.info</a><br>
<hr>
login Orange : fti/<input id="orange" placeholder="identifiant Orange"/><br>
mot de passe Orange: <input id="password" placeholder="password"/><br>
Salt: <input id="salt" placeholder="salt"/ maxlength="12" size="12"><br>
Byte: <input id="byte" placeholder="byte" maxlength="1" size="1"/>
<br>(execution locale au navigateur, les valeurs ne sont pas envoyées sur le réseau)<br>
<hr>
<button id="btn2">Générer la chaine</button><br>

chaine option dhcp 90:<textarea id="output" placeholder=""></textarea><br>

CSS

textarea{
    width:100%;
    height:100px;
}

JavaScript

(function(){
    btn2.onclick = function(){
        var st11zero = '00:00:00:00:00:00:00:00:00:00:00';
        var idorange = '01'; // variable
        var idsalt= '3c'; // 12
        var idhash  = '03'; //13
        var fixed = '1a:09:00:00:05:58:01:03:41';
        
				function TLofTLS(id,l) {
            var toAdd = l.toString(16).toUpperCase();
            if (toAdd.length<2) toAdd = '0' + toAdd;
            return id + ':' + toAdd;
				}
        function SofTLS (s) {
          var i, toAdd;
          var res = '';
          for(i = 0; i < s.length; i++){
              toAdd = s.charCodeAt(i).toString(16).toUpperCase();
              if (toAdd.length<2) toAdd = '0' + toAdd;
              res += toAdd;
              if (i<s.length-1) res += ":";
          }
          return res;
        }
        var Orange = 'fti/'+orange.value;
        var Salt = salt.value;
        output.value = 
              st11zero + ':' + fixed + ':' +
              TLofTLS(idorange,Orange.length)+ ':' + SofTLS(Orange)+ ':' +
              TLofTLS(idsalt,12)+ ':' + SofTLS(Salt) + ':' +
              TLofTLS(idhash,13)+ ':todo';
    }
})();