Database of vulnurability at milw0rm.com – udpate and makeindex with cron.

I am quite regular visitor of milw0rm and generally try to keep up with the vul\’s. For doing this I wrote a small scripts rather set of scripts to keep myself update.  Here\’s what we are going to do:

1. Get the latest tar from the site.

2. Extract it.

3. Make the index

4. Have a shortcut to search the index.

Download the attached files for the first 2 points. makeindex-milw0rm and udpate-milw0rm

Now open the update-milw0rm file with the directory paths, that is located in the starting of the file.

Once that is done, do the following on the terminal,

crontab -e

Add a entry like this:

@daily /home/amit/update-milw0rm.sh

So you are all set to automatically download and update the data everyday. Lets now create a alias to search the exploitlist from the terminal.

Put the following in your profile :

alias search_sploit=\”cat $(cat ~/bin/update-milw0rm.sh|grep dir=|awk -F\’=\’ \'{print $2}\’|awk -F\’\”\’ \'{print $2}\’)/milw0rm/sploitlist.txt|grep -i\”

Now, when you want to search the database for the exploit you can simply type:

search_sploit <search term>

bash tutorial for begineer and experienced.

I having been looking for something like this for sometime. Found this while searching.

A very good thing about this tutorial is its comprehensiveness and the details. A lot of examples are gives which too are quite useful.

Get you ip address like whatismyip.com

For last couple of days, I was thinking of putting this. I was thinking of some way to get the IP address of the client directly rather than going through some site or parsing the content. So here it is.

Now the trick here is simple. There are two ways to get the IP address of the client in the php script and thus a simple script like the below would capture both of them.

<?php

$ip=@$REMOTE_ADDR;
echo \”<html><body><font size=\’3\’><b>IP Address= $ip</b><br>\”;
$ip1=$_SERVER[\’REMOTE_ADDR\’];
echo \”<font size=\’3\’><b>IP Address= $ip1</b>\”;
?>
</body></html>

Now this can be used in scripts to get you IP address very quickly if only there were no html tags and no junk and only the IP address. So here is a direct link to your IP alone.

This is a php which does not create any text and thus you can get the IP adress directly without parsing too. There are two lines in the file and both contain the IP address 🙂

Here is an example to use in bash scripts:

wget http://amit-agarwal.co.in/mystuff/getip_txt.php -O ak 2>/dev/null && ip=`tail -1 ak`

After you have executed the above the IP address used by your client is put in the variable ip. You can check this with http://whatismyip.com for this first time to verify it is working fine. So enjoy scripting.