mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 12:36:09 -07:00
code indent
This commit is contained in:
parent
531ee7734b
commit
720bdb3f96
83 changed files with 6377 additions and 6240 deletions
|
@ -1,26 +1,24 @@
|
|||
/*
|
||||
* PostgresSQL Support - by Diaul (at) devilopers.org
|
||||
* PostgresSQL Support - by Diaul (at) devilopers.org
|
||||
*
|
||||
*
|
||||
*
|
||||
* 110425 no obvious memleaks found
|
||||
*/
|
||||
|
||||
#include "hydra-mod.h"
|
||||
|
||||
#ifndef LIBPOSTGRES
|
||||
void dummy_postgres() {
|
||||
printf("\n");
|
||||
}
|
||||
void dummy_postgres() { printf("\n"); }
|
||||
#else
|
||||
|
||||
#include "libpq-fe.h" // Postgres connection functions
|
||||
#include "libpq-fe.h" // Postgres connection functions
|
||||
#include <stdio.h>
|
||||
|
||||
#define DEFAULT_DB "template1"
|
||||
|
||||
extern char *HYDRA_EXIT;
|
||||
|
||||
int32_t start_postgres(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE * fp) {
|
||||
int32_t start_postgres(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
|
||||
char *empty = "";
|
||||
char *login, *pass;
|
||||
char database[256];
|
||||
|
@ -42,7 +40,6 @@ int32_t start_postgres(int32_t s, char *ip, int32_t port, unsigned char options,
|
|||
* Building the connection string
|
||||
*/
|
||||
|
||||
|
||||
snprintf(connection_string, sizeof(connection_string), "host = '%s' dbname = '%s' user = '%s' password = '%s' ", hydra_address2string(ip), database, login, pass);
|
||||
|
||||
if (verbose)
|
||||
|
@ -65,7 +62,7 @@ int32_t start_postgres(int32_t s, char *ip, int32_t port, unsigned char options,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void service_postgres(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
void service_postgres(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;
|
||||
int32_t myport = PORT_POSTGRES, mysslport = PORT_POSTGRES_SSL;
|
||||
|
||||
|
@ -74,12 +71,11 @@ void service_postgres(char *ip, int32_t sp, unsigned char options, char *miscptr
|
|||
return;
|
||||
|
||||
while (1) {
|
||||
|
||||
switch (run) {
|
||||
case 1: /* connect and service init function */
|
||||
case 1: /* connect and service init function */
|
||||
if (sock >= 0)
|
||||
sock = hydra_disconnect(sock);
|
||||
// usleepn(275);
|
||||
// usleepn(275);
|
||||
if ((options & OPTION_SSL) == 0) {
|
||||
if (port != 0)
|
||||
myport = port;
|
||||
|
@ -92,14 +88,15 @@ void service_postgres(char *ip, int32_t sp, unsigned char options, char *miscptr
|
|||
port = mysslport;
|
||||
}
|
||||
if (sock < 0) {
|
||||
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t) getpid());
|
||||
if (quiet != 1)
|
||||
fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int32_t)getpid());
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
next_run = 2;
|
||||
break;
|
||||
case 2:
|
||||
/*
|
||||
* Here we start the password cracking process
|
||||
* Here we start the password cracking process
|
||||
*/
|
||||
next_run = start_postgres(sock, ip, port, options, miscptr, fp);
|
||||
break;
|
||||
|
@ -118,13 +115,13 @@ void service_postgres(char *ip, int32_t sp, unsigned char options, char *miscptr
|
|||
|
||||
#endif
|
||||
|
||||
int32_t service_postgres_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
int32_t service_postgres_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
|
||||
|
@ -132,6 +129,7 @@ int32_t service_postgres_init(char *ip, int32_t sp, unsigned char options, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage_postgres(const char* service) {
|
||||
printf("Module postgres is optionally taking the database to attack, default is \"template1\"\n\n");
|
||||
void usage_postgres(const char *service) {
|
||||
printf("Module postgres is optionally taking the database to attack, default "
|
||||
"is \"template1\"\n\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue