Module: Masscan::Parsers::PlainText Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Common methods for parsing plain-text data.
Constant Summary collapse
- STATUSES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of status strings to their keywords.
{ 'open' => :open, 'closed' => :closed }
- REASONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'fin' => :fin, 'syn' => :syn, 'rst' => :rst, 'psh' => :psh, 'ack' => :ack, 'urg' => :urg, 'ece' => :ece, 'cwr' => :cwr }
- IP_PROTOCOLS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of IP protocol names to their keywords.
{ 'tcp' => :tcp, 'udp' => :udp, 'icmp' => :icmp, 'sctp' => :sctp }
- APP_PROTOCOLS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mapping of application protocol names to their keywords.
{ "ssh1" => :ssh1, "ssh2" => :ssh2, "ssh" => :ssh, "http" => :http, "ftp" => :ftp, "dns-ver" => :dns_ver, "snmp" => :smtp, "nbtstat" => :nbtstat, "ssl" => :ssl3, "smtp" => :smtp, "smb" => :smb, "pop" => :pop, "imap" => :imap, "X509" => :x509, "zeroaccess" => :zeroaccess, "title" => :html_title, "html" => :html, "ntp" => :ntp, "vuln" => :vuln, "heartbleed" => :heartbleed, "ticketbleed" => :ticketbleed, "vnc" => :vnc, "safe" => :safe, "memcached" => :memcached, "scripting" => :scripting, "versioning" => :versioning, "coap" => :coap, "telnet" => :telnet, "rdp" => :rdp, "http.server" => :http_server }
Instance Method Summary collapse
-
#parse_app_protocol(proto) ⇒ Symbol, String
private
Parses an application protocol name.
-
#parse_ip(ip) ⇒ IPAddr
private
Parses an IP address.
-
#parse_ip_protocol(proto) ⇒ :tcp, ...
private
Parses an IP protocol name.
-
#parse_reason(reason) ⇒ Array<:fin, :syn, :rst, :psh, :ack, :urg, :ece, :cwr>
private
Parses a reason string.
-
#parse_status(status) ⇒ :open, ...
private
Parses a status string.
-
#parse_timestamp(timestamp) ⇒ Time
private
Parses a timestamp.
Instance Method Details
#parse_app_protocol(proto) ⇒ Symbol, String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an application protocol name.
122 123 124 |
# File 'lib/masscan/parsers/plain_text.rb', line 122 def parse_app_protocol(proto) APP_PROTOCOLS[proto] || proto end |
#parse_ip(ip) ⇒ IPAddr
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an IP address.
148 149 150 |
# File 'lib/masscan/parsers/plain_text.rb', line 148 def parse_ip(ip) IPAddr.new(ip) end |
#parse_ip_protocol(proto) ⇒ :tcp, ...
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses an IP protocol name.
74 75 76 |
# File 'lib/masscan/parsers/plain_text.rb', line 74 def parse_ip_protocol(proto) IP_PROTOCOLS[proto] || proto end |
#parse_reason(reason) ⇒ Array<:fin, :syn, :rst, :psh, :ack, :urg, :ece, :cwr>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses a reason string.
50 51 52 53 54 |
# File 'lib/masscan/parsers/plain_text.rb', line 50 def parse_reason(reason) flags = reason.split('-') flags.map! { |flag| REASONS[flag] || flag } flags end |
#parse_status(status) ⇒ :open, ...
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses a status string.
26 27 28 |
# File 'lib/masscan/parsers/plain_text.rb', line 26 def parse_status(status) STATUSES[status] || status end |
#parse_timestamp(timestamp) ⇒ Time
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses a timestamp.
135 136 137 |
# File 'lib/masscan/parsers/plain_text.rb', line 135 def () Time.at(.to_i) end |