Tag: resolve

DNS, Information Gathering

Resolve hostname to ip without using ping

To resolve a hostname to its IP address without using Ping (ICMP echo request), you can use dig or nslookup. You should avoid using ping because ICMP requests may alert administrators when an IDS/IPS system is installed at the target system or even worse ICMP echo requests are blocked from a firewall.   dig hostnamedig …

C, Microsoft Windows, Network

Resolve hostname to ip address in C

Resolve hostname to ip address (TCP v4) in Windows using C and gethostbyname. #include <stdio.h> #include <winsock2.h> #include <ws2tcpip.h>   #pragma comment (lib, "Ws2_32.lib")   void resolve_hostname_to_ipaddress(char* hostname);   int main(int argc, char* argv[]) { resolve_hostname_to_ipaddress("hostname.com");   return EXIT_SUCCESS; }   void resolve_hostname_to_ipaddress(char* hostname) { struct hostent *he; struct in_addr **addr_list; int i;   WSADATA …

C, Microsoft Windows, Network

Resolve hostname to ip address in C

Resolve hostname to ip address (TCP v4) in Windows using C and getaddrinfo. #include <stdio.h> #include <winsock2.h> #include <ws2tcpip.h>   #pragma comment (lib, "Ws2_32.lib")   void resolve_hostname_to_ipaddress(char* hostname);   int main(int argc, char* argv[]) { resolve_hostname_to_ipaddress("hostname.com");   return EXIT_SUCCESS; }   void resolve_hostname_to_ipaddress(char* hostname) { DWORD ppi = -1; struct addrinfo hints; struct addrinfo *ptr …