Class: BetterCap::Parsers::Dict
- Defined in:
- lib/bettercap/sniffer/parsers/dict.rb
Overview
DICT authentication parser.
Instance Method Summary collapse
-
#initialize ⇒ Dict
constructor
A new instance of Dict.
- #on_packet(pkt) ⇒ Object
Methods inherited from Base
available, from_cmdline, inherited, load_by_names, load_custom
Constructor Details
#initialize ⇒ Dict
Returns a new instance of Dict.
17 18 19 |
# File 'lib/bettercap/sniffer/parsers/dict.rb', line 17 def initialize @name = 'DICT' end |
Instance Method Details
#on_packet(pkt) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bettercap/sniffer/parsers/dict.rb', line 20 def on_packet( pkt ) begin if pkt.tcp_dst == 2628 lines = pkt.to_s.split(/\r?\n/) lines.each do |line| if line =~ /AUTH\s+(.+)\s+(.+)$/ user = $1 pass = $2 StreamLogger.log_raw( pkt, @name, "username=#{user} password=#{pass}" ) end end end rescue end end |