John the Ripper - MaxNet Edition

AnthonyFuller

Active member
Aug 26, 2023
21
2
21
H3110 411!

I spy with my little eye, something beginning with "A"... That's right it's "another library"!

This library can automatically decipher all possible hashes returned by bf_password. This has been tested for about 2 hours with no failures!

Yes, that means you can automatically decipher passwords. Supports numbers in both types of ciphers.

It also includes some helpful functions.

Installation​

1. Copy the John code.
2. Place it on your Maxnet account.
3. Compile it with mnscript compile John.msc John
4. Use it with include.

Functions​

They are all included in the John class. Return types are before the function name.
string John.AsciiToString(string ciphertext) - Turns comma separated ASCII values to an actual string.
string John.StringToAscii(string plaintext) - Turns a string into comma separated ASCII values.
string John.CaesarShift(string text, number offset) - Caesar shifts a string by the specified offset.
bool John.ContainsWordFromList(string[] wordlist, string str) - Returns if a string contains a value from the array.
StringResult John.Decipher(string ciphertext) - The one you want. Returns a string result containing the deciphered string (or an error). This supports comma separated ASCII values and Caesar shifts.

Example Usage​

C#:
using Console;
include "John.mscx";

John John = new John();

StringResult res1 = John.Decipher("78,101,118,101,114,71,111,110,110,97,71,105,118,101,89,111,117,85,112");
StringResult res2 = John.Decipher("Zsskpip33x"); // This is a Caesar shift, so it must contain a valid word.

// Check the string results here.

Console.WriteLine(res1.GetString()); // Outputs "NeverGonnaGiveYouUp"
Console.WriteLine(res2.GetString()); // Outputs "Vooglel33t"

Testimonials​

You stole my idea!
- Hydro (probably)

C#:
using Array;
using Console;
using String;
using System;
using Util;
class John {
    string[] _wordlist = ["Apple", "Banana", "Ben", "Cameron", "CGSF", "Chan", "Chicken", "Christmas", "Civil", "Company", "Dash", "David", "Deadblawer", "Egg", "Eggy", "Europe", "Family", "Foster", "Green", "Hacker", "Holiday", "Jackie", "Jackson", "Kevin", "Keyboard", "l33t", "MaxNet", "Meghan", "Mitchel", "Mole", "Orange", "Patrick", "Paul", "Pie", "Pink", "Plane", "Planet", "Plank", "Purple", "Quazar", "Rainbow", "Red", "Richard", "Shadow", "Shadown", "Skeleton", "Sparkle", "Star", "Terry", "Therisa", "Turkey", "Twilight", "Voogle", "Voshiba", "Vunescape", "Wing", "Yellow", "Zealot"];
    constructor() {
        // Please keep these credits in :)
        Console.WriteLine("John the Ripper - MaxNet edition by Anthony Fuller.");
    }
    function<string> AsciiToString(string ciphertext) {
        if (Util.IsNull(ciphertext)) { return ""; }
        // Doing it this way is still faster than using an array.
        // This may not intuitively make sense, but there's a few reasons for this:
        // 1. There's less amount of "fake lag".
        // 2. The actual ASCII conversion is handled by Lua directly (we also don't have to worry about incomplete ASCII tables).
        // It's also cleaner.
        string[] strBytes = String.Split(ciphertext, ",");
        number len = Array.Length(strBytes);
        number[] bytes = new number[len];
        number i = 1;
        while (i <= len) {
            bytes[i] = Util.ToNumber(strBytes[i]);
            i = i + 1;
        }
        return String.Chars(bytes);
    }
    function<string> StringToAscii(string plaintext) {
        if (Util.IsNull(plaintext)) { return ""; }
        number[] bytes = String.Bytes(plaintext, 1, String.Length(plaintext));
        return String.Concat(bytes, ",");
    }
    function<string> CaesarShift(string text, number offset) {
        if (Util.IsNull(text)) { return ""; }
        if (Util.IsNull(offset)) { return ""; }
        while (offset < 0) { offset = offset + 26; }
        offset = offset % 26;
        // Technically should never be 26 when we get here, but just in case.
        if (offset == 0 || offset == 26) { return text; }
        number[] bytes = String.Bytes(text, 1, String.Length(text));
        number len = Array.Length(bytes);
        number[] cipher = new number[Array.Length(bytes)];
        number i = 1;
        while (i <= len) {
            number byte = bytes[i];
            if (byte >= 97 && byte <= 122) { // Lowercase
                // Thanks to Shrimp for this idea!
                cipher[i] = 97 + ((byte - 97 + offset) % 26);
            } else if (byte >= 65 && byte <= 90) { // Uppercase
                // Thanks to Shrimp for this idea!
                cipher[i] = 65 + ((byte - 65 + offset) % 26);
            } else { // Not an alphabetical character, just add it anyway.
                cipher[i] = byte;
            }
            i = i + 1;
        }
        return String.Chars(cipher);
    }
    function<bool> ContainsWordFromList(string[] wordlist, string str) {
        if (Util.IsNull(wordlist)) { return false; }
        if (Util.IsNull(str)) { return false; }
        number len = Array.Length(wordlist);
        number i = 1;
        while (i <= len) {
            if (String.Contains(str, wordlist[i])) { return true; }
            i = i + 1;
        }
        return false;
    }
    function<StringResult> Decipher(string ciphertext) {
        if (Util.IsNull(ciphertext)) { return new StringResult(false, "Ciphertext is null!"); }
        if (String.Contains(ciphertext, ",")) {
            // This is a "getchar" string, simple.
            return new StringResult(true, AsciiToString(ciphertext));
        }
        // It's Caesar shifted, so we have to use the wordlist.
        number offset = -5;
        while (offset <= 5) {
            if (offset == 0) { offset = offset + 1; continue; }
            string shifted = CaesarShift(ciphertext, offset);
            if (ContainsWordFromList(_wordlist, shifted)) { return new StringResult(true, shifted); }
            offset = offset + 1;
        }
        return new StringResult(false, "Could not decipher string.");
    }
}

If you have any questions or issues, let me know!
 
Last edited: