mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-14 02:27:31 -07:00
commit
a1f3f00f86
4 changed files with 38 additions and 7 deletions
30
bfg.c
30
bfg.c
|
@ -52,6 +52,7 @@ static int32_t add_single_char(char ch, char flags, int32_t* crs_len) {
|
|||
// note that we check for -x .:.:ab but not for -x .:.:ba
|
||||
//
|
||||
int32_t bf_init(char *arg) {
|
||||
bf_options.rain = 0;
|
||||
int32_t i = 0;
|
||||
int32_t crs_len = 0;
|
||||
char flags = 0;
|
||||
|
@ -189,8 +190,17 @@ uint64_t bf_get_pcount() {
|
|||
return foo;
|
||||
}
|
||||
|
||||
int accu(int value)
|
||||
{
|
||||
int i = 0;
|
||||
for(int a=1; a<=value; ++a)
|
||||
{
|
||||
i+=a;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
char *bf_next() {
|
||||
char *bf_next(_Bool rainy) {
|
||||
int32_t i, pos = bf_options.current - 1;
|
||||
|
||||
if (bf_options.current > bf_options.to)
|
||||
|
@ -201,8 +211,22 @@ char *bf_next() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < bf_options.current; i++)
|
||||
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
|
||||
if(rainy)
|
||||
{
|
||||
for (i = 0; i < bf_options.current; i++){
|
||||
bf_options.ptr[i] = bf_options.crs[(bf_options.state[i]+bf_options.rain)%bf_options.crs_len];
|
||||
bf_options.rain += i+1;
|
||||
}
|
||||
if(bf_options.crs_len%10 == 0)
|
||||
bf_options.rain-=accu(bf_options.current)-2;
|
||||
else if(bf_options.crs_len%2 == 0)
|
||||
bf_options.rain-=accu(bf_options.current)-4;
|
||||
else if(bf_options.crs_len%2)
|
||||
bf_options.rain-=accu(bf_options.current)-1;
|
||||
}
|
||||
else
|
||||
for (i = 0; i < bf_options.current; i++)
|
||||
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
|
||||
bf_options.ptr[bf_options.current] = 0;
|
||||
|
||||
if (debug) {
|
||||
|
|
3
bfg.h
3
bfg.h
|
@ -41,6 +41,7 @@ typedef struct {
|
|||
char *crs; /* internal representation of charset */
|
||||
char *ptr; /* ptr to the last generated password */
|
||||
uint32_t disable_symbols;
|
||||
uint64_t rain; /* accumulator for the rain */
|
||||
} bf_option;
|
||||
|
||||
extern bf_option bf_options;
|
||||
|
@ -48,7 +49,7 @@ extern bf_option bf_options;
|
|||
#ifdef HAVE_MATH_H
|
||||
extern uint64_t bf_get_pcount();
|
||||
extern int32_t bf_init(char *arg);
|
||||
extern char *bf_next();
|
||||
extern char *bf_next(_Bool rainy);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
11
hydra.c
11
hydra.c
|
@ -493,6 +493,7 @@ void help(int32_t ext) {
|
|||
#ifdef HAVE_MATH_H
|
||||
" -x MIN:MAX:CHARSET password bruteforce generation, type \"-x -h\" to get help\n"
|
||||
" -y disable use of symbols in bruteforce, see above\n"
|
||||
" -r rainy mode for password generation (-x)\n"
|
||||
#endif
|
||||
" -e nsr try \"n\" null password, \"s\" login as pass and/or \"r\" reversed login\n"
|
||||
" -u loop around users, not passwords (effective! implied with -x)\n");
|
||||
|
@ -1745,7 +1746,7 @@ int32_t hydra_send_next_pair(int32_t target_no, int32_t head_no) {
|
|||
#ifndef HAVE_MATH_H
|
||||
sleep(1);
|
||||
#else
|
||||
hydra_targets[target_no]->pass_ptr = bf_next();
|
||||
hydra_targets[target_no]->pass_ptr = bf_next(hydra_options.rainy);
|
||||
if (debug)
|
||||
printf("[DEBUG] bfg new password for next child: %s\n", hydra_targets[target_no]->pass_ptr);
|
||||
#endif
|
||||
|
@ -2222,6 +2223,7 @@ int main(int argc, char *argv[]) {
|
|||
hydra_brains.ofp = stdout;
|
||||
hydra_brains.targets = 1;
|
||||
hydra_options.waittime = waittime = WAITTIME;
|
||||
hydra_options.rainy = 0;
|
||||
bf_options.disable_symbols = 0;
|
||||
|
||||
// command line processing
|
||||
|
@ -2229,7 +2231,7 @@ int main(int argc, char *argv[]) {
|
|||
help(1);
|
||||
if (argc < 2)
|
||||
help(0);
|
||||
while ((i = getopt(argc, argv, "hIq64Rde:vVl:fFg:L:p:OP:o:b:M:C:t:T:m:w:W:s:SUux:yc:K")) >= 0) {
|
||||
while ((i = getopt(argc, argv, "hIq64Rrde:vVl:fFg:L:p:OP:o:b:M:C:t:T:m:w:W:s:SUux:yc:K")) >= 0) {
|
||||
switch (i) {
|
||||
case 'h':
|
||||
help(1);
|
||||
|
@ -2256,6 +2258,9 @@ int main(int argc, char *argv[]) {
|
|||
hydra_options.restore = 1;
|
||||
hydra_restore_read();
|
||||
break;
|
||||
case 'r':
|
||||
hydra_options.rainy = 1;
|
||||
break;
|
||||
case 'I':
|
||||
ignore_restore = 1; // this is not to be saved in hydra_options!
|
||||
break;
|
||||
|
@ -3267,7 +3272,7 @@ int main(int argc, char *argv[]) {
|
|||
#ifdef HAVE_MATH_H
|
||||
if (bf_init(bf_options.arg))
|
||||
exit(-1); // error description is handled by bf_init
|
||||
pass_ptr = bf_next();
|
||||
pass_ptr = bf_next(hydra_options.rainy);
|
||||
hydra_brains.countpass += bf_get_pcount();
|
||||
hydra_brains.sizepass += BF_BUFLEN;
|
||||
#else
|
||||
|
|
1
hydra.h
1
hydra.h
|
@ -220,6 +220,7 @@ typedef struct {
|
|||
char *server;
|
||||
char *service;
|
||||
char bfg;
|
||||
_Bool rainy;
|
||||
int32_t skip_redo;
|
||||
} hydra_option;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue