Archive for January, 2009

Snort Log Parser

Hey guys, I’d like to share a script I wrote to make reporting simpler for Snort. Snort is an open source intrusion detection / prevention system. It blocks or detects packets based on rules. Its an awesome security tool to see exactly what is going on in your network and offers great protection if you decide to put it in prevention mode. And its all free!

I installed it on my very old compaq computer which runs Ubuntu server edition. Didn’t really have a reason, just wanted to see how it works…will be getting rid of it soon since it slows down the network (Counter Strike and Snort don’t mix).

Anyway, to check the logs I had to ssh to the compaq (that computer has no monitor) and manually go through the logs. Usually the same event would’ve tripped 400 times in a row. Scrolling through all of this and logging into the compaq everytime was a pain. So I wrote a bash script that bundled the same events together, output the number of times they occured and emailed this information to me everyday. Now all I had to do was check my email. I also added a threshold so it would only email rules that tripped at least 20 times.

I’m sure this method isn’t as efficient as some of the other parsers that are out there…but this one’s awesome since I made it! Here it is…

Read the rest of this entry »

, , ,

No Comments

PHP Basics

Heres a quick intro to PHP. A lot will be left out, I’m assuming you know basic programming (variables and loops). W3 Schools is a great place to learn PHP more in depth.

To try this code make sure you have XAMPP installed, check out this tutorial if you haven’t set it up yet.

Every script should begin and end with the php open/close tags.

 
< ?php 
//Comments
//rest of code here
?>

Here are some examples

 
< ?php
// two backslashes are used for comments
// A variable is created using the dollar sign before the name of the var
$v1 = "bananas" ; //semicolon after each statement
 
//echo is used to print to the screen
echo $v1;
 
//You can print multiple items using a comma
$v2 = "apples" ;
echo $v1, $v2;
 
//If statements are similar to those in C++ and Java.
$uno = 1 ;
$dos = 2 ;
 
if($uno < $dos)
{
  echo "WOO!" ;
}
else
{
  echo "WTF!?";
}
 
?>

Read the rest of this entry »

3 Comments

XAMPP Setup

In this tutorial we’ll get XAMPP setup so we can start coding websites.

XAMPP for Linux
Download XAMPP from ApacheFriends. You can put it in your home directory.

Open up a terminal and run this command

tar xvfz xampp-linux-1.7.tar.gz -C /opt

This will extract the XAMPP (should be called lampp) directory to /opt. If you already have an XAMPP installation this command will overwrite it so be careful. Now we need to start the LAMP server using this command

/opt/lampp/lampp start

Now everythings up and running. You can test the setup by going to http://localhost in a web browser.

To start a website you need to create a folder in the htdocs directory under lampp. You can make a simple index.html file and put it in the created folder. Now visit http://localhost/your_created_folder and you should see your index.html file.

Read the rest of this entry »

, , ,

No Comments