Pages

Friday, July 16, 2010

Software router

For those students working on software router, you need to be able to capture packets coming on the interface and analyze them as a first step towards your goal. This link is a useful resource.
You should especially look into this.

Thursday, July 15, 2010

Creating multiple virtual disk images for virtual box

If for some reason you want to run multiple instances of the same OS in virtual box, you need not install it multiple times on new virtual hard disks. Rather, you can create images of the VHD (virtual hard disk) which you can use for you new VM's. This article is primarily for windows, i have added notes for Linux users where appropriate.
1. In order to do this navigate to the folder where you have installed virtual box through command line. In windows you can launch command prompt by typing cmd in run and pressing enter. (In Linux VBoxManage command is in bin folder and hence its path is set, it can be launched directly from terminal by typing VBoxManage)
1.5. Before you proceed launch VBox. Goto File -> Virtual media manager.
       release the image you wish to clone. then also remove it. Make sure you do not delete the image when asked.

2. Next in this folder you will find the file VBoxManage.exe, you need to execute it with the following parameters.
3. VBoxManage clonehd [path of VhD to clone] [path + name of new clone VHD]
4. After this you should have a new VHD in the folder you specified. You can create a new VM in Virtual Box and use this clone hard disk in it. Enjoy :)

Wednesday, July 14, 2010

Libpcap

I have written a small sample code to get you started. You can download it here. to compile the code: gcc code.c -lpcap
and then execute the output file as: sudo ./a.out

Here is a code which generates an ICMP packet, you should follow the structure given in this code. Compile and run the code as mentioned above.

Tuesday, July 13, 2010

Configuring network in virtual box

Please download this manual, it will be helpful in revising your previous concepts.
You additionally need to download and print this manual, you need to submit a filled hard copy at the end of the lab.

Here you can additionally find the link to the online tutorial for virtual box, in this section virtual networking is explained http://www.virtualbox.org/manual/ch06.html
And here is another useful link for changing the IP address in Ubuntu, be advised before you make any changes to these files be sure to take backup of this file.

Sunday, July 4, 2010

Tips for socket programming lab2

1. Important point you can only type cast a pointer into another, it implies that you can not type cast an integer to the type void * etc.
2. The last argument of the thread function takes a void pointer as its argument so firstly keep point 1 in mind and secondly either you can declare a pointer or the better option might be to simply pass the variable by reference.
3. If you passed a variable by reference don't forget to dereference it. syntax * referenced_variable
4. When you compile the code, keep in mind that now you need to tell the compiler that it needs to use the lpthread library at link time. So don't forget to make relevant changes to your make file.
5. Enjoy your programming, its never too late to learn :)

Friday, July 2, 2010

iostream buffer issues, cin, cout, cin.get, cin.getline

Here are useful links to iostream buffer related issues.

http://www.cplusplus.com/forum/beginner/7405/
http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200109/notes/io.html


you may also wish to read the chapter on I/O in the book by Walter Savitch, it is available in the library

In case you are having issues where your code seems to skip cin or cin.getline you can use
std::cin.ignore(std::numeric_limits::max(),'\n');
or, since you have 'using namespace std;', you can add this
cin.ignore(numeric_limits::max(),'\n');

to flush the buffer before you take input you will need to include ios.h and limits.h in order for it to work

sample

# include
# include
# include
# include
using namespace std;

int main()
{

.
.
.
.
.

string string1;
cin.ignore(numeric_limits::max(),'\n');
cin.getline(cin,string1);


}

Thursday, July 1, 2010