Module: Mihari::Mixins::AutonomousSystem

Included in:
Analyzers::Base, Structs::IPInfo::Response
Defined in:
lib/mihari/mixins/autonomous_system.rb

Instance Method Summary collapse

Instance Method Details

#normalize_asn(asn) ⇒ Integer

Normalize ASN value

Parameters:

  • asn (String, Integer)

Returns:

  • (Integer)


13
14
15
16
17
18
# File 'lib/mihari/mixins/autonomous_system.rb', line 13

def normalize_asn(asn)
  return asn if asn.is_a?(Integer)
  return asn.to_i unless asn.start_with?("AS")

  asn.delete_prefix("AS").to_i
end