./c0de/c/mysqlpassword.txt

0.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
///////////////////////////////////////////////////////////////////////////////////////////////
//
// MySQL brute force password attack
//
// to compile : g++ -omysqlpassword mysqlpassword.c -O6 -lm
//
// Written by : [email protected], current version http://term.rmci.net/mysqlpassword.cpp
//
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h> // memset
#include <unistd.h> // usleep
 
using namespace std;
 
struct rand_struct {
  unsigned long seed1,seed2,max_value;
  double max_value_dbl;
};
 
void make_scrambled_password(char *,const char *);
char *scramble(char *,const char *,const char *, int);
 
int brute(const char *password) {
  // Tune stuff here, change min / max for the char range to crack and width for max password width.
  unsigned int min=32,max=122,pos=0,width=11,max_pos=0;
  unsigned char data[255];
  register unsigned long long loops=0;
  char *encrypted_password = new char[255];
  memset(encrypted_password, 0, 255);
  memset((char*)&data, min, 255);
  while(width) {
    loops++;
    if(data[pos] != max) {
      data[pos]++;
    } else {
      for(register int i=pos; i<max; i++) {
        if(data[i] != max) {
          data[i]++;
          pos=i;
          break;
        }
      }
 
      if(pos>max_pos)
        max_pos=pos;
 
      for(register int i=pos-1; i >= 0; i--) {
        if(i==0 && data[i] == max) {
          data[i] = min;
          pos = 0;
          break;
        }
        if(data[i] != max || i==0) {
          pos = i;
          break;
        }
        data[i] = min;
      }
    }
 
    if(max_pos>width) {
      cout<<"No match found"<<endl;
      width=0;
      return(0);
    }
    data[max_pos+1] = 0;
        make_scrambled_password(encrypted_password,(const char*)data);
    if(!strcmp(encrypted_password,password)) {
      cout<<"MATCH ["<<data<<"] ["<<encrypted_password<<"]==["<<password<<"]"<<endl;
      return(0);
    }
    data[max_pos+1] = min;
    if((loops%500000)==0) {
      cout<<"[ "<<dec<<loops<<" ]";
      for(int i=0; i<=max_pos; i++) {
          cout<<" 0x"<<hex<<(int)data[i];
      }
      data[max_pos+1] = 0;
      cout<<" ("<<data<<")";
      data[max_pos+1] = min;
      cout<<endl;
    }
  }
}
 
int main(int argc, char* argv[]) {
  if(argc!=2) {
    fprintf(stderr,"usage : %s [ENCRYPTED MYSQL PASSWORD]\nexample , 5d2e19393cc5ef67 is encrypted value 'password' : %s 5d2e19393cc5ef67\n",argv[0],argv[0]);
    return(0);
  }
  brute(argv[1]);
}
 

Back