class URLhausMonitor::Entry
Attributes
asnumber[R]
country[R]
date_added[R]
host[R]
ip_address[R]
threat[R]
url[R]
url_status[R]
Public Class Methods
new(line)
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 16 def initialize(line) parts = CSV.parse(line.chomp).flatten raise ArgumentError, "#{line} is not valid." unless parts.length == 8 || parts.length == 9 if parts.length == 8 parse_without_tags parts else parse_with_tags parts end end
Public Instance Methods
actions()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 69 def actions [vt_link, urlscan_link, urlhaus_link].compact end
defanged_host()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 31 def defanged_host @defanged_host ||= host.gsub(/\./, "[.]") end
defanged_url()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 27 def defanged_url @defanged_url ||= url.gsub(/\./, "[.]") end
title()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 35 def title "#{defanged_url} (#{defanged_host} / #{ip_address} / #{date_added}) : #{threat}" end
to_attachements()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 73 def to_attachements [ { text: defanged_host, fallback: "VT & urlscan.io links", actions: actions } ] end
urlhaus_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 59 def urlhaus_link return nil unless _urlhaus_link { type: "button", text: "Lookup on URLhaus", url: _urlhaus_link, } end
urlscan_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 49 def urlscan_link return nil unless _urlscan_link { type: "button", text: "Lookup on urlscan.io", url: _urlscan_link, } end
vt_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 39 def vt_link return nil unless _vt_link { type: "button", text: "Lookup on VirusTotal", url: _vt_link, } end
Private Instance Methods
_urlhaus_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 93 def _urlhaus_link "https://urlhaus.abuse.ch/host/#{host}/" end
_urlscan_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 89 def _urlscan_link "https://urlscan.io/domain/#{host}" end
_vt_link()
click to toggle source
# File lib/urlhaus_monitor/entry.rb, line 85 def _vt_link "https://www.virustotal.com/#/domain/#{host}" end