mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 12:36:09 -07:00
mixed TDS7 into old function
This commit is contained in:
parent
5f706c7071
commit
b5eb38e48f
1 changed files with 40 additions and 8 deletions
|
@ -5,7 +5,7 @@ char *buf;
|
|||
#if defined(HAVE_SYBFRONT) && defined(HAVE_SYBDB)
|
||||
#include <sybdb.h>
|
||||
#include <sybfront.h>
|
||||
int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
|
||||
int32_t start_mssql7(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
|
||||
char *empty = "";
|
||||
char *login, *pass;
|
||||
char *ipaddr_str = hydra_address2string(ip);
|
||||
|
@ -18,8 +18,6 @@ int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, ch
|
|||
DBPROCESS *dbproc;
|
||||
LOGINREC *attempt;
|
||||
|
||||
dbinit();
|
||||
|
||||
attempt = dblogin();
|
||||
|
||||
DBSETLUSER(attempt, login);
|
||||
|
@ -39,14 +37,12 @@ int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, ch
|
|||
}
|
||||
|
||||
hydra_completed_pair();
|
||||
dbclose(dbproc);
|
||||
dbexit();
|
||||
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
|
||||
return 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
#define MSLEN 30
|
||||
|
||||
|
@ -101,6 +97,7 @@ unsigned char p_lng[] = "\x02\x01\x00\x47\x00\x00\x02\x00\x00\x00\x00"
|
|||
int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE *fp) {
|
||||
char *empty = "";
|
||||
char *login, *pass, buffer[1024];
|
||||
char *ipaddr_str = hydra_address2string(ip);
|
||||
char ms_login[MSLEN + 1];
|
||||
char ms_pass[MSLEN + 1];
|
||||
unsigned char len_login, len_pass;
|
||||
|
@ -110,6 +107,39 @@ int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, ch
|
|||
login = empty;
|
||||
if (strlen(pass = hydra_get_next_password()) == 0)
|
||||
pass = empty;
|
||||
#if defined(HAVE_SYBFRONT) && defined(HAVE_SYBDB)
|
||||
if ((strlen(login) > MSLEN) || (strlen(pass) > MSLEN)){
|
||||
|
||||
DBPROCESS *dbproc;
|
||||
LOGINREC *attempt;
|
||||
|
||||
attempt = dblogin();
|
||||
|
||||
DBSETLUSER(attempt, login);
|
||||
DBSETLPWD(attempt, pass);
|
||||
|
||||
// Connect without specifying a database
|
||||
dbproc = dbopen(attempt, ipaddr_str);
|
||||
|
||||
if (dbproc != NULL) {
|
||||
dbclose(dbproc);
|
||||
dbexit();
|
||||
hydra_report_found_host(port, ip, "mssql", fp);
|
||||
hydra_completed_pair_found();
|
||||
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
hydra_completed_pair();
|
||||
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
|
||||
return 2;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
if (strlen(login) > MSLEN)
|
||||
login[MSLEN - 1] = 0;
|
||||
if (strlen(pass) > MSLEN)
|
||||
|
@ -160,12 +190,14 @@ int32_t start_mssql(int32_t s, char *ip, int32_t port, unsigned char options, ch
|
|||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void service_mssql(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_MSSQL, mysslport = PORT_MSSQL_SSL;
|
||||
|
||||
#if defined(HAVE_SYBFRONT) && defined(HAVE_SYBDB)
|
||||
dbinit();
|
||||
#endif
|
||||
|
||||
hydra_register_socket(sp);
|
||||
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue