Category Archives: C

Socket Programming in C

C program to get a domain’s whois information using sockets on Linux

By | November 28, 2012

Whois A whois client is a program that will simply fetch the whois information for a domain/ip address from the whois servers. The code over here works according to the algorithm discussed here. Code /* * @brief * Whois client program * * @details * This program shall perform whois for a domain and get… Read More »

Get local ip in C on linux

By | March 6, 2013

Local Ip address The local ip is the source ip in IP packets send out from a system. When the system is a part of a local area network then the local ip in most cases is something like 192.168.*.* . The network interface (eth0) is assigned an ip address of that range. However when… Read More »

Get ip address from hostname in C using Linux sockets

By | November 19, 2012

Socket applications often need to convert hostnames like google.com to their corresponding ip address. This is done through dns requests. The socket api in linux provides functions like gethostbyname and getaddrinfo that can be used to perform the dns requests and get the ip address. gethostbyname The first method uses the traditional gethostbyname function to… Read More »

SYN Flood DOS Attack with C Source Code (Linux)

By | August 27, 2012

TCP/IP 3-way handshake is done to establish a connection between a client and a server. The process is : 1. Client –SYN Packet–> Server 2. Server –SYN/ACK Packet –> Client 3. Client –ACK Packet –> Server The above 3 steps are followed to establish a connection between source and destination. SYN Flood DOS attacks involves… Read More »