Skip to content

Instantly share code, notes, and snippets.

@jnovack
Last active July 20, 2021 17:38
Show Gist options
  • Select an option

  • Save jnovack/72b40da1005a97c5677533d59c73dbac to your computer and use it in GitHub Desktop.

Select an option

Save jnovack/72b40da1005a97c5677533d59c73dbac to your computer and use it in GitHub Desktop.

Revisions

  1. jnovack revised this gist Oct 23, 2017. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions cisco-decrypt-type7-password.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    function crackPassword(password)
    {
    function crackPassword(password) {
    var crypttext = password.toUpperCase();
    var plaintext = '';
    var xlate = "dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87";
    @@ -27,7 +26,6 @@ function crackPassword(password)
    continue;
    }


    if(crypttext.charCodeAt(i) >= 0x41 && crypttext.charCodeAt(i) <= 0x46) {
    val += crypttext.charCodeAt(i) - 0x41 + 0x0a;
    continue;
  2. jnovack renamed this gist Oct 23, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. jnovack created this gist Jun 23, 2017.
    42 changes: 42 additions & 0 deletions cisco-decrypt-type7.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    function crackPassword(password)
    {
    var crypttext = password.toUpperCase();
    var plaintext = '';
    var xlate = "dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87";
    var seed, i, val = 0;

    if(crypttext.length & 1)
    return;

    seed = (crypttext.charCodeAt(0) - 0x30) * 10 + crypttext.charCodeAt(1) - 0x30;

    if (seed > 15 || isNaN(crypttext.charAt(0)) || isNaN(crypttext.charAt(1)))
    return;

    for (i = 2 ; i <= crypttext.length; i++) {
    if(i !=2 && !(i & 1)) {
    plaintext += String.fromCharCode(val ^ xlate.charCodeAt(seed++));
    seed %= xlate.length;
    val = 0;
    }

    val *= 16;

    if(!isNaN(crypttext.charAt(i))) {
    val += crypttext.charCodeAt(i) - 0x30;
    continue;
    }


    if(crypttext.charCodeAt(i) >= 0x41 && crypttext.charCodeAt(i) <= 0x46) {
    val += crypttext.charCodeAt(i) - 0x41 + 0x0a;
    continue;
    }

    if(crypttext.length != i)
    return;
    }

    console.log(plaintext);
    return plaintext;
    }