mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-06 04:51:40 -07:00
modified bfg
This commit is contained in:
parent
ed9d8f1516
commit
b09e39f98d
2 changed files with 29 additions and 4 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
|
// note that we check for -x .:.:ab but not for -x .:.:ba
|
||||||
//
|
//
|
||||||
int32_t bf_init(char *arg) {
|
int32_t bf_init(char *arg) {
|
||||||
|
bf_options.rain = 0;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
int32_t crs_len = 0;
|
int32_t crs_len = 0;
|
||||||
char flags = 0;
|
char flags = 0;
|
||||||
|
@ -189,8 +190,17 @@ uint64_t bf_get_pcount() {
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int accu(int value)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(int a=1; a<=value; ++a)
|
||||||
|
{
|
||||||
|
i+=a+1;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
char *bf_next() {
|
char *bf_next(_Bool rainy) {
|
||||||
int32_t i, pos = bf_options.current - 1;
|
int32_t i, pos = bf_options.current - 1;
|
||||||
|
|
||||||
if (bf_options.current > bf_options.to)
|
if (bf_options.current > bf_options.to)
|
||||||
|
@ -201,8 +211,22 @@ char *bf_next() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < bf_options.current; i++)
|
if(rainy)
|
||||||
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
|
{
|
||||||
|
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;
|
bf_options.ptr[bf_options.current] = 0;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|
3
bfg.h
3
bfg.h
|
@ -41,6 +41,7 @@ typedef struct {
|
||||||
char *crs; /* internal representation of charset */
|
char *crs; /* internal representation of charset */
|
||||||
char *ptr; /* ptr to the last generated password */
|
char *ptr; /* ptr to the last generated password */
|
||||||
uint32_t disable_symbols;
|
uint32_t disable_symbols;
|
||||||
|
unsigned long rain; //accumulator for the rain//
|
||||||
} bf_option;
|
} bf_option;
|
||||||
|
|
||||||
extern bf_option bf_options;
|
extern bf_option bf_options;
|
||||||
|
@ -48,7 +49,7 @@ extern bf_option bf_options;
|
||||||
#ifdef HAVE_MATH_H
|
#ifdef HAVE_MATH_H
|
||||||
extern uint64_t bf_get_pcount();
|
extern uint64_t bf_get_pcount();
|
||||||
extern int32_t bf_init(char *arg);
|
extern int32_t bf_init(char *arg);
|
||||||
extern char *bf_next();
|
extern char *bf_next(_Bool rainy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue