Archives

All posts by Chris Sanders

I am excited to see so many people starting to take an interest in Bro-IDS and the Bro Network Programming Language (BNPL). The BNPL is a remarkably easy language to program in and while I have spent my fair share of time in emacs and vi sometimes it makes life a little bit easier to have a light weight code editor. So today we're going to walk through the quick and easy way to get syntax highlighting setup using Sublime Text 2. If you have never used Sublime Text 2 before it is quite elegant- with builds for Linux, Mac OS/X and Windows the cross platform scripting, libraries of existing code, and intuitive features should help you to get started in the BNPL a bit faster.

Download Sublime:

http://www.sublimetext.com/2
tar -xvjpf Sublime Text 2.0.1 x64.tar.bz2

Go ahead and start Sublime for the first time:

cd Sublime Text 2/
./sublime_text to launch

Enter the Sublime control windowwith the shortcut CONTROL+TICK; the tick: ` is in the top left corner under the tilda: ~:

ctrl+`

Install package control window just cut and paste the following:

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Restart Sublime Text 2 for the changes to take effect. If you do not laready have Git installed you can do so quickly with:

sudo apt-get install git

Let's go ahead and add the bro.tmbundle out of Seth Halls Github repository.

cd $HOME
cd .config/sublime-text-2/Packages/
mkdir Bro
cd Bro
git clone https://github.com/sethhall/bro.tmbundle

Dop Comments that:

For the OSX people out there, that config directory will be “~/Library/Application Support/Sublime Text 2/Packages”

Restart Sublime Text 2 and all of your ".bro" files should now have some simple syntax highlighting.If you are new to Sublime Text 2 they have a some great tutorials and documentation listed right off of their webpage.

Sublime Text 2 with Bro Syntax Highlighting

Sublime Text 2 with Bro Network Programming Language Syntax Highlighting

If you would rather stay in the shell and you haven't seen it yet Scott Runnels of Mandiant has posted his Bro Scripting Language Major Mode for emacs right up on his github.

An added bonus, if you have not seen it yet- Bro super star Matthias Vallentin recently posted his BNPL Cheat Sheet to help you get started- you can find that an a whole lot more at his Github Repo.