mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 20:41:39 -07:00
code indent
This commit is contained in:
parent
531ee7734b
commit
720bdb3f96
83 changed files with 6377 additions and 6240 deletions
50
hydra-irc.c
50
hydra-irc.c
|
@ -10,7 +10,7 @@ extern char *HYDRA_EXIT;
|
|||
char buffer[300] = "";
|
||||
int32_t myport = PORT_IRC, mysslport = PORT_IRC_SSL;
|
||||
|
||||
int32_t start_oper_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE * fp) {
|
||||
int32_t start_oper_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
|
||||
char *empty = "";
|
||||
char *login, *pass;
|
||||
int32_t ret;
|
||||
|
@ -52,7 +52,7 @@ int32_t send_nick(int32_t s, char *ip, char *pass) {
|
|||
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
sprintf(buffer, "NICK hydra%d\r\nUSER hydra%d hydra %s :hydra\r\n", (int32_t) getpid(), (int32_t) getpid(), hydra_address2string(ip));
|
||||
sprintf(buffer, "NICK hydra%d\r\nUSER hydra%d hydra %s :hydra\r\n", (int32_t)getpid(), (int32_t)getpid(), hydra_address2string(ip));
|
||||
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ int32_t send_nick(int32_t s, char *ip, char *pass) {
|
|||
int32_t irc_server_connect(char *ip, int32_t sock, int32_t port, unsigned char options, char *hostname) {
|
||||
if (sock >= 0)
|
||||
sock = hydra_disconnect(sock);
|
||||
// usleepn(275);
|
||||
// usleepn(275);
|
||||
if ((options & OPTION_SSL) == 0) {
|
||||
if (port != 0)
|
||||
myport = port;
|
||||
|
@ -77,7 +77,7 @@ int32_t irc_server_connect(char *ip, int32_t sock, int32_t port, unsigned char o
|
|||
return sock;
|
||||
}
|
||||
|
||||
int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE * fp, char *hostname) {
|
||||
int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp, char *hostname) {
|
||||
char *empty = "";
|
||||
char *pass;
|
||||
int32_t ret;
|
||||
|
@ -87,7 +87,7 @@ int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options,
|
|||
|
||||
s = irc_server_connect(ip, s, port, options, hostname);
|
||||
if (s < 0) {
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t) getpid());
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,16 @@ int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options,
|
|||
#endif
|
||||
hydra_report_pass_found(port, ip, "irc", fp);
|
||||
hydra_completed_pair_found();
|
||||
hydra_report(stderr, "[INFO] Server password '%s' is working, you can pass it as argument\nto irc module to then try login/password oper mode\n", pass);
|
||||
hydra_report(stderr,
|
||||
"[INFO] Server password '%s' is working, you can pass it as "
|
||||
"argument\nto irc module to then try login/password oper mode\n",
|
||||
pass);
|
||||
} else {
|
||||
if (verbose && (miscptr != NULL))
|
||||
hydra_report(stderr, "[VERBOSE] Server is requesting a general password, '%s' you entered is not working\n", miscptr);
|
||||
hydra_report(stderr,
|
||||
"[VERBOSE] Server is requesting a general password, '%s' "
|
||||
"you entered is not working\n",
|
||||
miscptr);
|
||||
hydra_completed_pair();
|
||||
}
|
||||
|
||||
|
@ -117,7 +123,7 @@ int32_t start_pass_irc(int32_t s, char *ip, int32_t port, unsigned char options,
|
|||
return 4;
|
||||
}
|
||||
|
||||
void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
|
||||
int32_t run = 1, next_run = 1, sock = -1, ret;
|
||||
char *buf;
|
||||
|
||||
|
@ -128,11 +134,11 @@ void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FIL
|
|||
while (1) {
|
||||
next_run = 0;
|
||||
switch (run) {
|
||||
case 1: /* connect and service init function */
|
||||
case 1: /* connect and service init function */
|
||||
|
||||
sock = irc_server_connect(ip, sock, port, options, hostname);
|
||||
if (sock < 0) {
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t) getpid());
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
|
@ -147,7 +153,7 @@ void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FIL
|
|||
if ((ret = hydra_recv(sock, buffer, sizeof(buffer) - 1)) >= 0)
|
||||
buffer[ret] = 0;
|
||||
|
||||
/* ERROR :Bad password */
|
||||
/* ERROR :Bad password */
|
||||
#ifdef HAVE_PCRE
|
||||
if ((ret > 0) && (hydra_string_match(buffer, "ERROR\\s.*password"))) {
|
||||
#else
|
||||
|
@ -180,19 +186,23 @@ void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FIL
|
|||
hydra_child_exit(0);
|
||||
}
|
||||
|
||||
/* ERROR :Bad password is returned from ngircd when it s waiting for a server password */
|
||||
/* ERROR :Bad password is returned from ngircd when it s waiting for a
|
||||
* server password */
|
||||
if ((ret > 0) && (strstr(buffer, " 001 ") == NULL)) {
|
||||
/* seems we not successfully connected */
|
||||
hydra_report(stderr, "[ERROR] should not be able to identify server msg, please report it\n%s\n", buffer);
|
||||
hydra_report(stderr,
|
||||
"[ERROR] should not be able to identify server msg, "
|
||||
"please report it\n%s\n",
|
||||
buffer);
|
||||
hydra_child_exit(0);
|
||||
}
|
||||
|
||||
next_run = 2;
|
||||
break;
|
||||
case 2: /* run the cracking function */
|
||||
case 2: /* run the cracking function */
|
||||
next_run = start_oper_irc(sock, ip, port, options, miscptr, fp);
|
||||
break;
|
||||
case 3: /* clean exit */
|
||||
case 3: /* clean exit */
|
||||
if (sock >= 0)
|
||||
sock = hydra_disconnect(sock);
|
||||
hydra_child_exit(0);
|
||||
|
@ -208,13 +218,13 @@ void service_irc(char *ip, int32_t sp, unsigned char options, char *miscptr, FIL
|
|||
}
|
||||
}
|
||||
|
||||
int32_t service_irc_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
int32_t service_irc_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE *fp, int32_t port, char *hostname) {
|
||||
// called before the childrens are forked off, so this is the function
|
||||
// which should be filled if initial connections and service setup has to be
|
||||
// performed once only.
|
||||
//
|
||||
// fill if needed.
|
||||
//
|
||||
//
|
||||
// return codes:
|
||||
// 0 all OK
|
||||
// -1 error, hydra will exit, so print a good error message here
|
||||
|
@ -222,6 +232,8 @@ int32_t service_irc_init(char *ip, int32_t sp, unsigned char options, char *misc
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage_irc(const char* service) {
|
||||
printf("Module irc is optionally taking the general server password, if the server is requiring one, and if none is passed the password from -p/-P will be used\n\n");
|
||||
void usage_irc(const char *service) {
|
||||
printf("Module irc is optionally taking the general server password, if the "
|
||||
"server is requiring one, and if none is passed the password from "
|
||||
"-p/-P will be used\n\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue