Class: BetterCap::Parsers::Post
- Defined in:
- lib/bettercap/sniffer/parsers/post.rb
Overview
HTTP POST requests 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
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bettercap/sniffer/parsers/post.rb', line 18 def on_packet( pkt ) s = pkt.to_s if s =~ /POST\s+[^\s]+\s+HTTP.+/ begin req = BetterCap::Proxy::HTTP::Request.parse(pkt.payload) # the packet could be incomplete unless req.body.nil? or req.body.empty? StreamLogger.log_raw( pkt, "POST", req.to_url(1000) ) StreamLogger.log_post( req ) end rescue; end end end |