Class: BetterCap::Parsers::TeamTalk

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

Overview

BearWare TeamTalk authentication parser.

Instance Method Summary collapse

Methods inherited from Base

available, from_cmdline, from_exclusion_list, inherited, load_by_names, load_custom, #match_port?

Constructor Details

#initializeTeamTalk

Returns a new instance of TeamTalk.



21
22
23
# File 'lib/bettercap/sniffer/parsers/teamtalk.rb', line 21

def initialize
  @name = 'TeamTalk'
end

Instance Method Details

#on_packet(pkt) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bettercap/sniffer/parsers/teamtalk.rb', line 24

def on_packet( pkt )
  return unless (pkt.tcp_dst == 10333 || pkt.udp_dst == 10333)

  lines = pkt.to_s.split(/\r?\n/)
  lines.each do |line|
    next unless (line =~ /login\s+/ && line =~ /username=/ && line =~ /password=/)

    version = line.scan(/version="?([\d\.]+)"?\s/).flatten.first
    user = line.scan(/username="?(.*?)"?\s/).flatten.first
    pass = line.scan(/password="?(.*?)"?\s/).flatten.first

    StreamLogger.log_raw( pkt, @name, "#{'version'.blue}=#{version} username=#{user} password=#{pass}" )
  end
rescue
end