Class: BetterCap::Parsers::Whatsapp

Inherits:
Base
  • Object
show all
Defined in:
lib/bettercap/sniffer/parsers/whatsapp.rb

Overview

WhatsApp traffic parser.

Instance Method Summary collapse

Methods inherited from Base

available, from_cmdline, inherited, #initialize, load_by_names, load_custom

Constructor Details

This class inherits a constructor from BetterCap::Parsers::Base

Instance Method Details

#on_packet(pkt) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/bettercap/sniffer/parsers/whatsapp.rb', line 22

def on_packet( pkt )
  begin
    if ( pkt.tcp_dst == 443 or pkt.tcp_dst == 5222 or pkt.tcp_dst == 5223 ) and pkt.payload =~ /^WA.*?([a-zA-Z\-\.0-9]+).*?([0-9]+)/
      version = $1
      phone = $2
      StreamLogger.log_raw( pkt, 'WHATSAPP', "#{'phone'.green}=#{phone.yellow} #{'version'.green}=#{version.yellow}" )
    end
  rescue; end
end