Saturday, September 07, 2013

tshark diameter example

I love speed and hate slow. I work in an environment where things are just slow. Bandwidth is slow, processor is slow. Yeah even in this technical world, I find myself slow or may be it is just me. Anyway my hatred for slow things, makes me search for alternatives and so learn more things. I found that wireshark has a textual counterpart. You thought wireshark is not slow. Come to my world and try running it over X windows. Anyway, Google has too much information about the tshark, but the only problem is that it is tough to read that information. Here are my few quick examples to read diameter packet captures. In my world, people do not worry about the disk space and time and use this tcpdump command to capture packets:

tcpdump -i any -s 0 -w <myFav.pcap>

I still need to figure out a better way but this works for now.

Once the file is captured, you can view the file with tshark. Here are the tshark commands to view pcap files with diameter dissector (-d). -r is for read and -n for not mapping IPs to hostnames.

tshark -n -r my.pcap -d "tcp.port=3868, diameter"

This command with -R can provide view filters (-R). See only packets for tcp port 3868:

tshark -n -r my.pcap -d "tcp.port=3868,diameter" -R "tcp.port==3868 and diameter.cmd.code==280"

This command shows the diameter command code, h2h, e2e, flags but does not display the AVPs. For Origin-Host AVP in CER, you can use this command.

tshark -n -r my.pcap -d "tcp.port=3868,diameter" -R "tcp.port==3868 and diameter.cmd.code==280" -z diameter,avp,257,Origin-Host

For examples, grep diameter here:

Sunday, March 31, 2013

West Coast Trip


I made a west coast trip with my wife.  The west coast trip covered
Las Vegas, Los Angeles and San Francisco.  Our trip was splitted into
three parts.  Part2 was a 6-day tour organized by a travel company
where we were part of a bigger group and were guided by our travel
guide.  Part1 (3-day LV) and Part3 (1- day LA) were self exploration.

Chronological order:

20121118 (Sun) - Reached LV and checked in hotel. Got an upgrade.
20121119 (Mon) - Hotels, Shows and Buffets.
20121120 (Tue) - Hotels, Shows and Buffets.
20121121 (Wed) - Arrival in Las Vegas (We were already in Las Vegas at Flamingo)
20121121 (Wed) - Moved to Startosphere.
20121122 (Thu) - Grand Canyon Visit. Eagle Point, Guanna Point.
20121123 (Fri) - Moved from LV to LA on the bus.
20121124 (Sat) - LA to SanJose
20121125 (Sun) - SanJose to SFO, Stanford, Golden Gate, Twin Peaks,
20121126 (Mon) - Yosemite, SanJose to LA.
20121127 (Tue) - LA, Walk of fame, Wax Museum, Chinese Gruman, Kodak Theatre, Holly wood tour, Holly wood sign.
20121127 (Tue) - Evening flight from LA to LV.
20121128 (Wed) - Back in RDU.


Tour cost:
682 for 2 people + 12 $ tip everyday for 2 people. Tour included hotel stay and commute.
Attraction admission fee was not included. Total Cost = 682 + 12 * 6 = 682 + 72 = 754.

Plane Tickets:
LA - RDU  = 340.80 for two people including taxes.
RDU - LV =  241.20 for two people including taxes
Flamingo Hotel Prices: 100 $ for 3 days. Interestingly they gave us an upgrade as well.
LA hotel for a single day (Nov 26) costed us 96 $.

Hotel Addresses:
LV: Flamingo on the strip
LV: Stratosphere on the strip.
HolidayInn: SanJose (provided by tour company)
Hampton Inn: LA (provided by tour company)
LA: Best Western Airport Plaza Inn, 1730 Centinela Avenue, Inglewood, CA 90302

LA experience:

The hotel we stayed was far away from the walk of the fame but there
was a bus.  People scared us that it will take too much time with the
bus, but we were able to reach walk of fame within an hour.  Although
we started early in the morning around 8:00 AM.  Walk of fame address
is "6801 Hollywood Blvd, Hollywood, CA 90028"

LA has two major attractions Universal Studios and Walk of fame. Walk
of fame is street with things around it. Since I have already been to
universals in Orlandao, we opted for walk of fame. We bough the city
pass which covered the most and was value for money.

Free things to do at walk of fame:
* Chiness Gruaman's theatre - this place has hand imprints of hollywood stars like Marlyn Monroe, Arnold and others.
* Near to Chinese Grauman's theatre, they have piano stairs which make music when someone walks on them.
* There is also a shopping complex which was used as a set for some
  movie. Shopping complex has the oscar theatre where the oscar awards
  are given. From the shopping theatre, you can also see the hollywood
* There are multiple start signs on the street and you can take a lot of pictures.

Things in the city pass:
* Madam Tussad's wax museum
* Oscar Theatre visit. A person will show you the oscar theatre from inside.
* Walking tour of walk of fame and places around and old chinese theatre.
* Tour of the LA on the open air jeep. They should us beverly hills, rodeo drive and mansion of hollywood stars.

You should buy city pass only if you want to see Madam Tussad's and
want to cover everything in a day.  If I had more time, exploring
beverly hills and rodeo drive on self would be more fun.

San Francisco:

I love this city. But you how the guided tours are, you just spend 5
minutes at a place. If you have time and money, explore on your own.
This was my second trip to SFO. The first trip was with bachelor
friends and was a self exploration. Self exploration was fun.

Our guided tour included these:
* Stanford university - saw Rodin "The Burghers of Calais"
  Not much here except for Rodin sculptures. The Burghers of Calais is
  multiple sculptures of war heros.
* Crooked street, fisherman wharf and cable cars
  This is a nice place to explore on foot. Ghiraddelli is also near
  by. Coit tower is also neary by. We also tried Boudin sour dough
  bread which is nice.
* Boat tour to alcatraz island and  golden gate bridge - nice but like other boat tours.
  You can see Golden Gate bridge from the boat. Also saw the alcatraz
  island from the boat.
* Palace of fine arts - nothing much but nice to click pictures.
* Golden Gate bridge - awesome.
  You can easily spend 2 hours here.
* Saint Mary's Cathederal
  This is nice church and they have those big musical instruments made
  out of pipes.
* Alamo sqare - saw painted ladies.
  There is also a wishing tree at the alamo square.
* Twin peaks - magnificient view from here.
* City Hall - just saw this from outside but was nice.

Las Vegas:

My wife loved this place than any other places where we have been. The
best things about vegas is that if you feel tired you can just go and
take rest at your hotel, so make sure you stay at strip.  Strip also
has a lot of cheap hotels.

Free things to do in LasVegas:
* Bellagio fountain.
* Mirage volcano
* TI pirates show
* Forum shops has two free shows.
* Flamingos at Flamingo.
* Hotels to see - all
** Wynn
** Encore
** Bellagio
** Caesar Palace
** Forum shops. Apple store has free wifi.
** Luxor
** Flamingo
** New York New York
** And lot others.

More paid things to do in LasVegas
* Go on top of Paris Effel tower.
* Go to to the stratosphere top. Entry is free if you are staying at the hotel
* Cars show. Old vintage car. Not much to see here.
* Titanic museum in luxor.
* Crazy rides at Stratosphere
* New York New York roller coaster.

Shows we saw (we bought a 110 $$ coupon using TotalRewards card in
which we can watch multiple shows in 48 hours)
* Divas
* Mac King - magic
* Anthony cools - crazy hypnosis show. We liked it.
* Jubilee
* Juggler show - jeff Civillico.

The show pass included the paris and the cars museum.

If you have the money watch any Cirque show.  We never saw because
never had all the money :). But we did heard a lot about them.  We
will try them next time.

Grand Canyon:

Grand Canyon is awesome. Our travel guide took us to eagle point and
guanna point where we were able to take some breath taking pictures.

Wednesday, March 13, 2013

Adding number to your list

See for this blog.

Saturday, February 09, 2013

Vim: Sorting section titles in a file

Here is vim trick to sort section titles in a file. Inspired from a vim book which I read.

Imagine a input file where the sections needs to be sorted. The content of the section needs to be kept intact.

Section Z
Section A
Section D
Here is the VIM exscript to do the job:

" Mark lines between each Section/End block
"  Now join the blocks into one line
" Sort each block
" Restore the joined lines to original blocks.
:%s/@@ /^M/g

Output file after sourcing the exscript:

Section A
Section D
Section Z

Sunday, February 03, 2013

Elinks pre_format_html using perl

Elinks is a fantastic text based browser. It also provide HTML re-writing. You can see HTM re-writing as your grease monkey script to update the HTML of the page. Elinks supports HTML re-writing using Lua, Ruby and perl.

To implement HTML re-writing using perl, create a file called under ~/.elinks. You can implement various hooks (see example file or search google for elinks manual and HTML rewriting). I have implemented pre_format_html_hook and here is my code.

Blogger does not allow me to use angular brackets in my code. You need to make following changes to the code:
*Replace LESSTHANSIGN with actual HTML start tag angular bracket.
*Replace GREATERTHANSIGN with actual HTML end tag angular bracket.

sub pre_format_html_hook
 my $url = shift;
 my $html = shift;

 if ($url =~ 'google\.com')
        # User .*? to not use greedy pattern matching.
        $html =~ s/LESSTHANSIGNdiv id=.*?gbar.*?\/divGREATERTHANSIGN//;
        $html =~ s/LESSTHANSIGNdiv id=.*?modeselector.*?\/divGREATERTHANSIGN//;
        $html =~ s/LESSTHANSIGNdivGREATERTHANSIGNLESSTHANSIGNh2 class=\"hd\">Search Options.*?\/divGREATERTHANSIGN//;

 return $html;

Saturday, January 26, 2013

Elinks Remote Invocation

elinks can be used to open remote links similar to firefox.

elinks -remote "openURL(, new-tab"

Note how the arguments are not enclosed in double or single quotes. The remote option can also be used for the smart and dumb prefixes provided by elinks.

elinks -remote "openURL(g elinks man, new-tab"

The above command will use smart prefix 'g' to search google for "elinks man".

The elinks instance needs to be already running for the remote option to work.

Saturday, January 19, 2013

Ideal Website

* Shall support text-only browser.
* Capability to dump/store complete site in a single file.

Tools I use

tmux  - 2013
elinks - 2013
xmonad - 2013
bugs.n - 2013

Monday, January 14, 2013

Simulating multiple paste buffers with the screen

Multiple paste buffers can be simulates by using screen registers.

To copy a string to a register use. Here are the command to add content to two registers:

C-a : register a "reg1content"
C-a : register b "reg2content"

Now to paste the contents, use this:

C-a : paste a
C-a : paste b

Debugging httpd core

Tuesday, January 01, 2013

Books I have read

Year I read
Book Name, Author
A walk to remember, Nicholas Sparks
Thunderhead, Preston and Child
Devil's Teardrop, Jeffrey Deaver
Lake view, Stacey Campbell
Mrs. Pollifax and Golden Triangle, Dorothy Gilman