This repository has been archived by the owner on Feb 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from bcoles/parsers_snpp
Add sniffer/parsers/SNPP
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
=begin | ||
BETTERCAP | ||
Author : Simone 'evilsocket' Margaritelli | ||
Email : [email protected] | ||
Blog : http://www.evilsocket.net/ | ||
This project is released under the GPL 3 license. | ||
=end | ||
require 'bettercap/sniffer/parsers/base' | ||
|
||
module BetterCap | ||
module Parsers | ||
# Simple Network Paging Protocol (SNPP) authentication parser. | ||
class Snpp < Base | ||
def initialize | ||
@name = 'SNPP' | ||
end | ||
def on_packet( pkt ) | ||
begin | ||
if pkt.tcp_dst == 444 | ||
lines = pkt.to_s.split(/\r?\n/) | ||
lines.each do |line| | ||
if line =~ /LOGIn\s+(.+)\s+(.+)$/ | ||
user = $1 | ||
pass = $2 | ||
StreamLogger.log_raw( pkt, @name, "username=#{user} password=#{pass}" ) | ||
end | ||
end | ||
end | ||
rescue | ||
end | ||
end | ||
end | ||
end | ||
end |