Browsing articles in "Linux"
Feb
2
2012

Compile wxwebconnect on Ubuntu 11.04 64 bit

wxwebconnect is a control for wxwidgets that allows to embed a gecko browser in a wxwidgets application. So lets try to install it on Ubuntu 11.04 wxWidgets can be installed from synaptic. Look for packages called libwxgtk2.8-* 1. Download wxwebconnect source from http://www.kirix.com/labs/wxwebconnect/downloads.html Extract them in home directory. Inside the webconnect directory you would see directories like webconnect , xr and testapp. 2. Over here create a directory called wxWidgets. Download wxwidgets 2.8.12 from here [...]

Dec
23
2011

Whois client code in C with Linux sockets

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 hostname_to_ip – This is a simple function to get an IP of a domain. str_replace – This is a generic string processing function that is used to search for a string in another big string and replace it with another string. Output

Dec
20
2011

Get local ip in C on linux

The local ip is the source ip in IP packets send out from a system. The kernal maintains routing tables which it uses to decide the default gateway , its interface and the local ip configured for that interface. The /proc/net/route file (not really a file but appears like one) has more information about it. A typical /proc/net/route output would look like : The above lists the interface , destination , gateway etc. The interface [...]

Dec
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

Dec
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 : [...]

Dec
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

Dec
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.

Dec
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 [...]

Dec
1
2011

Packet Sniffer Code in C using Linux Sockets (BSD) – Part 2

In the previous part we made a simple sniffer which created a raw socket and started receiving on it. But it had few drawbacks : 1. Could sniff only incoming data. 2. Could sniff only TCP or UDP or ICMP or any one protocol packets at a time. 3. Provided IP frames , so ethernet headers were not available. In this article we are going to modify the same code to fix the above 3 [...]

Nov
29
2011

Code a network packet sniffer in python for Linux

The most basic form of a sniffer would be : Run this with root privileges or sudo on ubuntu : sudo python sniffer.py The above sniffer works on the principle that a raw socket is capable of receiving all (of its type , like AF_INET) incoming traffic in Linux. The output could look like this : The above is a dump of the network packets in hex. They can be parsed using the unpack function. [...]

Pages:1234567»