mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-06 04:51:40 -07:00
smb2: fix parsing of miscptr
This commit is contained in:
parent
c2260d2c5d
commit
1df1d63c4f
1 changed files with 19 additions and 1 deletions
20
hydra-smb2.c
20
hydra-smb2.c
|
@ -126,8 +126,13 @@ bool smb2_run_test(creds_t *cr, const char *server, uint16_t port) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
|
case ENOENT:
|
||||||
|
// Noticed this when connecting to older samba servers on linux
|
||||||
|
// where any credentials are accepted.
|
||||||
|
hydra_report(stderr, "[WARNING] %s might accept any credential\n", server);
|
||||||
case EINVAL: // 22
|
case EINVAL: // 22
|
||||||
// probably password ok
|
// probably password ok, nominal case when connecting to a windows
|
||||||
|
// smb server with good credentials.
|
||||||
smbc_free_context(ctx, 1);
|
smbc_free_context(ctx, 1);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
@ -147,6 +152,9 @@ bool smb2_run_test(creds_t *cr, const char *server, uint16_t port) {
|
||||||
case ECONNREFUSED:
|
case ECONNREFUSED:
|
||||||
// there are probably more codes that could be added here to
|
// there are probably more codes that could be added here to
|
||||||
// indicate connection errors.
|
// indicate connection errors.
|
||||||
|
hydra_report(stderr,
|
||||||
|
"[ERROR] Error %s (%d) while connecting to %s\n",
|
||||||
|
strerror(errno), errno, server);
|
||||||
smbc_free_context(ctx, 1);
|
smbc_free_context(ctx, 1);
|
||||||
EXIT_CONNECTION_ERROR;
|
EXIT_CONNECTION_ERROR;
|
||||||
break;
|
break;
|
||||||
|
@ -202,6 +210,11 @@ int32_t service_smb2_init(char *ip, int32_t sp, unsigned char options, char *mis
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CMP(tkn_workgroup, miscptr)) {
|
if (CMP(tkn_workgroup, miscptr)) {
|
||||||
|
if (workgroup != default_workgroup) {
|
||||||
|
// miscptr has already been processed, goto end
|
||||||
|
miscptr += strlen(miscptr) + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
miscptr += sizeof(tkn_workgroup) - 1;
|
miscptr += sizeof(tkn_workgroup) - 1;
|
||||||
char *p = strchr(miscptr, '}');
|
char *p = strchr(miscptr, '}');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
|
@ -217,6 +230,11 @@ int32_t service_smb2_init(char *ip, int32_t sp, unsigned char options, char *mis
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CMP(tkn_netbios, miscptr)) {
|
if (CMP(tkn_netbios, miscptr)) {
|
||||||
|
if (netbios_name != NULL) {
|
||||||
|
// miscptr has already been processed, goto end
|
||||||
|
miscptr += strlen(miscptr) + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
miscptr += sizeof(tkn_netbios) - 1;
|
miscptr += sizeof(tkn_netbios) - 1;
|
||||||
char *p = strchr(miscptr, '}');
|
char *p = strchr(miscptr, '}');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue