mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 20:41:39 -07:00
ipv6 pretty print
This commit is contained in:
parent
4c6cbf03a7
commit
4ab31cd18e
7 changed files with 32 additions and 13 deletions
23
hydra-mod.c
23
hydra-mod.c
|
@ -1208,6 +1208,29 @@ char *hydra_address2string(char *address) {
|
|||
struct sockaddr_in target;
|
||||
struct sockaddr_in6 target6;
|
||||
|
||||
if (address[0] == 4) {
|
||||
memcpy(&target.sin_addr.s_addr, &address[1], 4);
|
||||
return inet_ntoa((struct in_addr) target.sin_addr);
|
||||
} else
|
||||
#ifdef AF_INET6
|
||||
if (address[0] == 16) {
|
||||
memcpy(&target6.sin6_addr, &address[1], 16);
|
||||
inet_ntop(AF_INET6, &target6.sin6_addr, ipstring, sizeof(ipstring));
|
||||
return ipstring;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (debug)
|
||||
fprintf(stderr, "[ERROR] unknown address string size!\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL; // not reached
|
||||
}
|
||||
|
||||
char *hydra_address2string_beautiful(char *address) {
|
||||
struct sockaddr_in target;
|
||||
struct sockaddr_in6 target6;
|
||||
|
||||
if (address[0] == 4) {
|
||||
memcpy(&target.sin_addr.s_addr, &address[1], 4);
|
||||
return inet_ntoa((struct in_addr) target.sin_addr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue