What started off as a way to fully unit test xtractr, turned out to be a Gem, literally. First xtractr, then nuggets and now a gem. You follow? Seriously though, we are happy to announce a Ruby gem for xtractr which takes all the goodness of Ruby and interacts RESTfully with xtractr for oh-so-fun packet mining and troubleshooting all from within IRB.
We took the logical objects within the xtractr‘s index and turned them into a set of Ruby objects with method chaining and map/reduce. We still like the collaborative app on pcapr, but for those packet geeks that want to play, this gem is for you.
Getting Started
After you install the gem and run the xtractr web server, this is how the story unfolds. First launch IRB with auto completion and require mu/xtractr.
$ irb -rirb/completion -rmu/xtractr
Create an instance of Mu::Xtractr that can talk to the xtractr web server RESTfully.
irb> xtractr = Mu::Xtractr.new
=> #<xtractr localhost:8080>
And now for the fun.
What are the top 3 DNS queries?
First we grab all DNS flows (a collection) and then map/reduce the dns.qry.name on those flows. Since what’s returned is just a plain old Ruby Array nicely sorted by the count, we then slice the first three elements in the Array.
irb> xtractr.flows('flow.service:DNS').count('dns.qry.name')[0..2]
=> [#<count ax.search.itunes.apple.com 8>, #<count a1.phobos.apple.com 6>, #<count ax.itunes.apple.com 6>]
Services used by the top talker (based on bytes sent/received)
Here we start with all flows and run a map/reduce summing all the bytes keyed by the unique src IP. This returns an array of Mu::Xtractr::Sum objects sorted by the bytes. We then take the first one and map/reduce again to determine the unique services that this IP has.
irb > xtractr.flows.sum('flow.src', 'flow.bytes')[0].count('flow.service')
=> [#<count HTTP 20>, #<count DNS 11>, #<count MDNS 1>]
Trend analysis of frequently occurring terms
We want to find out what are the most frequently occurring terms in the HTTP request URI. So we grab the field from xtractr and get the terms which is sorted by the frequency of occurrence already. The frequency is measured by the number of packets this term was seen within the URI.
irb> xtractr.field('http.request.uri').terms[0..2]
=> [#<term:http.request.uri us 81>, #<term:http.request.uri 75.jpg 46>, #<term:http.request.uri r1000 45>]
Save the packets that contain the trending term
Okay, we know the top trending term is us. We now want to grab all the packets that contain this term and save them into a new pcap for further analysis. Remember that xtractr can index flows across multiple pcaps so it’s possible that the newly constructed pcap is being stitched from multiple sources.
irb> xtractr.field('http.request.uri').terms[0].packets.save('trends.pcap')
=> #<packets:http.request.uri:us>
Find URL’s that are taking too long to download
Since during the indexing process, xtractr calculated the duration of each flow, this one’s pretty easy. We first get a collection of flows that lasted for more than a second and then map/reduce the URI within those flows.
irb> xtractr.flows('flow.proto:HTTP flow.duration:>1').count('http.request.uri')[0]
=> #<count /big_image.jpg 2>
How about we save that flow that took so long?
From the count returned in the last step, we grab the first packet, then the flow that the packet belongs to and save the flow to a new pcap.
irb> xtractr.flows('flow.proto:HTTP flow.duration:>1').count('http.request.uri')[0].packets.first.flow.save('slow.pcap')
=> #<flow:15 HTTP 192.168.1.10:49170 > 1.1.1.2:80 GET /big_image.jpg HTTP/1.1>
Download
Now that we’ve piqued your interest, here’s the code:
Enjoy and remember to download xtractr first!

Pingback: Google Redirect Fix
Pingback: cool caravans
Pingback: buy guest beds
Pingback: cheap guest beds
Pingback: Martin
Pingback: buy fannie mae stock fnm
Pingback: young womens clothing
Pingback: guaranteed rankings
Pingback: Dallas Advertising
Pingback: Dallas Website Design
Pingback: Dallas Family Portrait Photographer
Pingback: Escort girl Paris
Pingback: Ramtha
Pingback: best creatine supplements
Pingback: best bcaa
Pingback: internet marketing forum
Pingback: new job
Pingback: LED Lights
Pingback: ghost hunting
Pingback: temple run highscore
Pingback: army boot camp training
Pingback: Dentist
Pingback: Porn forum
Pingback: Herbal Smoking
Pingback: how to start a cleaning business
Pingback: inkjet cartridges
Pingback: uzaktan egitim
Pingback: bad credit car loan
Pingback: Cheap Twitter followers
Pingback: used ford explorer
Pingback: pozyczki chwilowki
Pingback: blog
Pingback: fans
Pingback: excel
Pingback: property investment
Pingback: website design service essex
Pingback: backlinks for seo
Pingback: Marketing
Pingback: Holton Buggs
Pingback: barmixerschule
Pingback: Cheap Payday Loans
Pingback: gps trekking
Pingback: how to start website
Pingback: marijuana addiction
Pingback: money online
Pingback: huge yield review
Pingback: Brain Entz
Pingback: hobby toys
Pingback: Court Reporter
Pingback: Lance Melody
Pingback: weight loss motivation
Pingback: james scott guy magnet review
Pingback: haier portable air conditioner 9000 btu
Pingback: pain during intercourse after pregnancy
Pingback: commercial real estate inspections
Pingback: Stress
Pingback: normal cholesterol levels
Pingback: Scott Tucker Payday Loans
Pingback: Scott Tucker Racing
Pingback: Scott Tucker CBS
Pingback: click here now
Pingback: Brazzers Password
Pingback: Broker Price Opinion
Pingback: Medical Tourism Houston
Pingback: Appraisal Management Companies
Pingback: Shared Hosting
Pingback: football speed
Pingback: Cheap Paris Hotels
Pingback: Music File Hosting
Pingback: rottweiler cane
Pingback: NCAA Mens Basketball
Pingback: consolidate credit card debt
Pingback: Titten Sexkontakte
Pingback: Bürostuhl test
Pingback: belly bars
Pingback: maryland short sale expert
Pingback: tarot gratis
Pingback: lottery win
Pingback: cash for gold
Pingback: learn more
Pingback: Air Conditioning Maintenance
Pingback: business for sale
Pingback: Free Psychic Reading
Pingback: payday loans online
Pingback: Robert Shumake
Pingback: how to make a minisite
Pingback: Commercial Insurance Tampa
Pingback: Project Payday
Pingback: All Inclusive Holidays
Pingback: Pest Control London, Carpet Beetle, Pest Prevention, London
Pingback: Scripte
Pingback: fitness boot camp
Pingback: Village Voice
Pingback: both teams to score
Pingback: Taruhan bola
Pingback: e-book
Pingback: prediksi togel
Pingback: loans singapore
Pingback: music
Pingback: +1's
Pingback: Scott Tucker Racing
Pingback: Scott Tucker Racing
Pingback: Scott Tucker Racing
Pingback: Scott Tucker CBS
Pingback: Scott Tucker CBS
Pingback: Sex Show
Pingback: personal trainer certification
Pingback: books
Pingback: marketing with anik review
Pingback: Kinky curly curling custard Twist Out
Pingback: certified triathlon coach
Pingback: Marathon Training Plan Intermediate
Pingback: Video Presentations
Pingback: raspberry keytone
Pingback: removals in south yorkshire
Pingback: cam chat
Pingback: injection moulding
Pingback: Arlen Batley
Pingback: Kareen Cabugos
Pingback: Best Way to Lose Belly Fat for Women
Pingback: angelcare babyphone
Pingback: Did Connecticut Support the Bible?
Pingback: busana pengantin
Pingback: Study
Pingback: EB1 Green Card
Pingback: Hyundai Visor Deflectors
Pingback: cam live
Pingback: Raelene Demma
Pingback: Monte Lambros
Pingback: electronics
Pingback: Uk Escort Directory
Pingback: www.floridahomeinsurancequotes.com
Pingback: Jame Denina
Pingback: Electronic cigarette
Pingback: motorcycle helmets
Pingback: esperanza spalding
Pingback: Server
Pingback: SEO
Pingback: legal
Pingback: white sands village condo rental
Pingback: searscard.com
Pingback: Socorro Homiak
Pingback: PNC Online Login
Pingback: Server
Pingback: white bunk beds
Pingback: promoting
Pingback: breast actives
Pingback: http://www.casquesansfil.org/
Pingback: machine a biere philips
Pingback: game
Pingback: flyttefirma
Pingback: mailboxes
Pingback: http://www.glaciereelectrique.fr/
Pingback: Silver Panda Coins
Pingback: used cellular on wheels
Pingback: water features
Pingback: Gold Buyers San Diego
Pingback: http://www.camescopehd.net/
Pingback: http://www.epilateurelectrique.net/
Pingback: http://www.whiteceramicwatches.net/
Pingback: no no hair removal
Pingback: home hair removal
Pingback: Sex show
Pingback: http://www.friteusesanshuile.net/
Pingback: montre gps cardio
Pingback: rasoir electrique
Pingback: http://www.minilavevaisselle.fr/
Pingback: disque dur interne
Pingback: My Blog
Pingback: weblando seo
Pingback: click here
Pingback: best online tire
Pingback: http://www.piscineautoportante.net/
Pingback: automobile accident attorneys palmdale ca
Pingback: lawyers
Pingback: merchant account application
Pingback: cheap real estate listing
Pingback: http://www.sacochehomme.org/