Posts made in February, 2010

Sea level attack

sea

Read More

Ubuntu and Open ports

For security reasons you may want to check the open ports on your machine and validate that applications using them. To scan your open ports you can use the following command:

sudo nmap -sV localhost

Namp will scan the machines open ports using the “-sV” parameter will also display the applications using the open ports and their version. Once you execute the command you should get a list similar to what I have here:

PORT     STATE SERVICE VERSION
21/tcp   open  ftp     vsftpd 2.2.0
22/tcp   open  ssh     OpenSSH 5.1p1 Debian 6ubuntu2 (protocol 2.0)
80/tcp   open  http    Apache httpd 2.2.12 ((Ubuntu))
3306/tcp open  mysql   MySQL 5.1.37-1ubuntu5.1

You should go through the list and if there are any applications which you don’t recognize you can always Google their name and see if you want them to be using the open ports or not.
You could also use netstat to see your open ports. For instance:

sudo netstat -tap

would return similar results.

Read More

Japanese Fountain

Here is a Fountain from Canal city in Fukuoka, japan. There are things that you can ONLY see in Japan this is definitely one of them.

Read More

C/C++ pointers

Pointers in C/C++ can sometimes be really confusing specially if you are a beginner or like me more used to Java. Here is a small program I found really useful in understanding c pointers:

#include <stdio.h>
int main() {
   int int_var = 5;
   int *int_ptr;

   int_ptr = &int_var; // Put the address of int_var into int_ptr.

   printf("int_ptr = 0x%08x\n", int_ptr);
   printf("&int_ptr = 0x%08x\n", &int_ptr);
   printf("*int_ptr = 0x%08x\n\n", *int_ptr);

   printf("int_var is located at 0x%08x and contains %d\n", &int_var, int_var);
   printf("int_ptr is located at 0x%08x, contains 0x%08x, and points to %d\n\n",
      &int_ptr, int_ptr, *int_ptr);
}

If you compile and run the code you will get something similar to the following:

int_ptr = 0xbffff834
&int_ptr = 0xbffff830
*int_ptr = 0x00000005

int_var is located at 0xbffff834 and contains 5
int_ptr is located at 0xbffff830, contains 0xbffff834, and points to 5

The address of your variables are probably different from what I have here which is obvious. One thing you should pay attention to is the relationship between the value/address of the pointer and the address of the int variable.

Read More

Adding Transparency to cygwin

Recently I have been using cygwin regularly, the best thing about it is that it provides many useful tools such as grep in windows. In Linux you can customize the terminal to look just the way you want it for instance you can add transparency, etc. You can apply similar look and feel changes such as transparency to cygwin using a small tool called mintty.
To install minty:

  • Run the setup.exe file available on cygwin website.
  • when you reach the package selection page search for mintty mark it to be installed.

To apply mintty to the cygwin terminal every time it starts you would need to edit the .bat file you use to run cgwin. Edit the file and replace the start line with the following:

start mintty bash --login -i

After installing mintty you can go through the options and customize it the way you prefer.
Mintty

Read More