remove rain mode

This commit is contained in:
vanhauser-thc 2021-03-11 14:00:00 +01:00
parent ac2fd35b4f
commit f423875d90
4 changed files with 7 additions and 34 deletions

29
bfg.c
View file

@ -1,6 +1,5 @@
/* code original by Jan Dlabal <dlabaljan@gmail.com>, partially rewritten by vh,
rainy tweaks by owein <yvain29@gmail.com>*/
/* code original by Jan Dlabal <dlabaljan@gmail.com>, partially rewritten by vh. */
#include <ctype.h>
#include <math.h>
@ -174,8 +173,6 @@ int32_t bf_init(char *arg) {
bf_options.crs_len = crs_len;
bf_options.current = bf_options.from;
bf_options.rain = 0;
bf_options.gcounter = 0;
memset((char *) bf_options.state, 0, sizeof(bf_options.state));
@ -202,7 +199,7 @@ uint64_t bf_get_pcount() {
return foo;
}
char *bf_next(_Bool rainy) {
char *bf_next() {
int32_t i, pos = bf_options.current - 1;
if (bf_options.current > bf_options.to)
@ -213,18 +210,7 @@ char *bf_next(_Bool rainy) {
return NULL;
}
if(rainy)
{
bf_options.rain = bf_options.gcounter;
bf_options.ptr[0] = bf_options.crs[bf_options.state[0]];
for(i=1; 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 -= bf_options.rain / bf_options.crs_len;
}
bf_options.gcounter++;
}
else
for(i=0; i<bf_options.current; ++i)
for(i=0; i<bf_options.current; ++i)
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
//we don't subtract the same depending on wether the length is odd or even
bf_options.ptr[bf_options.current] = 0;
@ -237,14 +223,6 @@ char *bf_next(_Bool rainy) {
}
//we revert the ordering of the bruteforce to fix the first static character
if(rainy) {
pos = 0;
while (pos < bf_options.current && (++bf_options.state[pos]) >= bf_options.crs_len) {
bf_options.state[pos] = 0;
pos++;
}
}
else
while (pos >= 0 && (++bf_options.state[pos]) >= bf_options.crs_len) {
bf_options.state[pos] = 0;
pos--;
@ -252,7 +230,6 @@ char *bf_next(_Bool rainy) {
if (pos < 0 || pos >= bf_options.current) {
bf_options.current++;
bf_options.rain = 0;
memset((char *)bf_options.state, 0, sizeof(bf_options.state));
}

4
bfg.h
View file

@ -43,8 +43,6 @@ typedef struct {
char *crs; /* internal representation of charset */
char *ptr; /* ptr to the last generated password */
uint32_t disable_symbols;
uint64_t rain;
uint64_t gcounter;
} bf_option;
extern bf_option bf_options;
@ -52,7 +50,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(_Bool rainy);
extern char *bf_next();
#endif
#endif

View file

@ -1780,7 +1780,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_options.rainy);
hydra_targets[target_no]->pass_ptr = bf_next();
if (debug)
printf("[DEBUG] bfg new password for next child: %s\n", hydra_targets[target_no]->pass_ptr);
#endif
@ -2280,7 +2280,6 @@ 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
@ -2316,7 +2315,7 @@ int main(int argc, char *argv[]) {
hydra_restore_read();
break;
case 'r':
hydra_options.rainy = 1;
fprintf(stderr, "Warning: the option -r has been removed.\n");
break;
case 'I':
ignore_restore = 1; // this is not to be saved in hydra_options!
@ -3433,7 +3432,7 @@ int main(int argc, char *argv[]) {
if (bf_init(bf_options.arg))
exit(-1); // error description is handled by bf_init
pass_ptr = bf_next(hydra_options.rainy);
pass_ptr = bf_next();
hydra_brains.countpass += bf_get_pcount();
hydra_brains.sizepass += BF_BUFLEN;
#else

View file

@ -206,7 +206,6 @@ typedef struct {
char *server;
char *service;
char bfg;
int8_t rainy;
int32_t skip_redo;
} hydra_option;