18
2011
Code a packet sniffer in C with winpcap
Winpcap is a packet capture library for Windows used for packet sniffing and sending raw packets. Wireshark is a popular sniffer tool that uses winpcap to sniff packets. Here is a sample code which shows how winpcap can be used to sniff incoming packets on a particular interface. Code Compile The code can be compiled in Vc++ 2010 Express Edition Winpcap development files are needed for pcap.h/pcap.lib and other files. Create a project in VC++ [...]
16
2011
Get mac address from ip in winsock
Mac address or hardware address is a 48bit (6 character) wide address assigned to a network interface. It is important for the packet delivery between 2 devices like your computer and the router. Ethernet protocol uses the mac address to deliver it to the right network node. It looks like this 00-1E-58-B8-D4-69 ( the dash is not relevant). Mac address of any interface can also be changed ( called mac spoofing ) . Any network [...]
11
2011
Winpcap compile error in pcap-stdinc.h in vc++ 6.0
When compiling winpcap in your program on Visual C++ 6.0 you might get an error like this : And it will point to the following lines in pcap-stdinc.h Simple edit them as : Now it should compile fine.
11
2011
Traceroute command not working on Ubuntu
The traceroute utility can be installed from synaptic : Some Information : Doing some test runs The traceroute command by default sends UDP packets. In the above output 5 network nodes remain undiscovered. The first impression would be that they did not repsond. However this is not the case. Wireshark reveals more : Wireshark clearly shows ICMP ttl expired reply from nodes : 203.171.242.33 203.171.240.17 But these nodes dont show up in the traceroute output. [...]
10
2011
Get ip address from hostname in C using Linux sockets
Here are 2 methods to get the ip address of a hostname : The first method uses the traditional gethostbyname function to retrieve information about a hostname/domain name. Code Compile and Run The second method uses the getaddrinfo function to retrieve information about a hostname/domain name. Code Compile and Run
8
2011
Check which mpm (multi processing module) apache is running
There are different mpm like : 1. worker 2. prefork 3. itk 4. peruser Apache might be running one of them. mpms are not modules that are loaded by apache. Instead they are compiled into apache. To check which mpm apache is using run the following command : Ubuntu On Ubuntu Apache is called apache2 Tha above command is used to find the apache binary Now run the apache binary with the l option : [...]
8
2011
Linux command to check distro
Here are a few commands which can be used to find out which distribution a particular Linux system is. lsb_release command cat /etc/*-release cat /proc/version cat /etc/issue uname -a
8
2011
Run php as cgi with apache on Ubuntu Linux
Install PHP CGI Install the php5-cgi package from synaptic. Configure Enable mod actions in apache. Disable mod php Edit the /etc/apache2/sites-enabled/000-default file and add this to the end of the file before the ending VirtualHost tag : Save the file. Restart apache. Check phpinfo. The server api should be CGI/FastCGI.
8
2011
Run Apache as a specific user with mpm itk on Ubuntu Linux
Install mpm itk On ubuntu mpm itk can be installed from synaptic. Look for the package called apache2-mpm-itk Configure Configuration for mpm itk can be done in the file sites-enabled/000-default In the VirtualHost *:80 section add this just before the end of the VirtualHost tag Restart apache. Now apache should be running as that username specified in “your_username”. Now this means that even PHP scripts will also run with the same username (unless something like [...]
6
2011
Validate file upload with html5 file api
The html5 file api provides lots of new features which can be used to read files on clientside from within the browser. Lets take a look at this Demo first : Please upgrade your browser This file upload control will only take zip or png files which are less than 1MB in size. For any other files it will show an error message. And this functionality if purely clientside. No server interaction or uploads yet. [...]
Subscribe
Recent Posts
- Compile wxwebconnect on Ubuntu 11.04 64 bit
- Disqus Comments Importer Script in PHP
- Beginners’ guide to socket programming with winsock
- Handle multiple socket connections with fd_set and select on Linux
- Beginners guide to socket programming in C on Linux
- Gui whois client in python with wxpython
- Whois client code in C with Linux sockets
- str_replace for C
- Easy to use C/C++ IDE for Ubuntu Linux
- Get local ip in C on linux
An article by Binary Tides