loadYOURSELF

loadYOURSELF

Browsing Posts in Network

Some domain’s serve under multiple ip addresses for example google.com

if you want to query this ip addresses then you can use this code block

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
 if (argc < 2) {
   fprintf(stderr,"Usage: ./app www.google.com\n");
   exit(1);
 }

 struct hostent *hp = gethostbyname(argv[1]);

 if (hp == NULL) {
   fprintf(stderr,"query failed\n");
   exit(1);
 } else {
   unsigned int i=0;
   while ( hp -> h_addr_list[i] != NULL) {
     printf( "%d -> %s ",i, inet_ntoa( *( struct in_addr*)( hp -> h_addr_list[i])));
     i++;
   }
   exit(0);
 }
}

Buy me a beer

This entry gives a way to find active computers on a LAN with Linux machine.
We can use nmap port scanning tool for that.

You can install nmap with
yum install nmap
or
apt-get install nmap
Example:
nmap -sP 192.168.200.0/23

searches 192.168.200.x & 192.168.201.x sub networks. And lists active computers.

nmap -v -sP 192.168.200.0/23 gives more verbose.

Buy me a beer

Nokia announced the expansion of the Nokia Media Network, a mobile advertising network that reaches more than 100 million consumers around the globe. Some of the biggest players in media from across Europe have joined the Nokia Media Network, furthering its reputation of providing global audience reach on high-quality mobile sites.