Class: Mihari::CLI
- Inherits:
-
Thor
- Object
- Thor
- Mihari::CLI
- Defined in:
- lib/mihari/cli.rb
Instance Method Summary collapse
- #alerts ⇒ Object
- #binaryedge(query) ⇒ Object
- #censys(query) ⇒ Object
- #circl(query) ⇒ Object
- #crtsh(query) ⇒ Object
- #dnpedia(query) ⇒ Object
- #import_from_json(input = nil) ⇒ Object
- #onyphe(query) ⇒ Object
- #passive_dns(query) ⇒ Object
- #passive_ssl(query) ⇒ Object
- #passivetotal(indicator) ⇒ Object
- #reverse_whois(query) ⇒ Object
- #securitytrails(indiactor) ⇒ Object
- #securitytrails_domain_feed(regexp) ⇒ Object
- #sha256(query) ⇒ Object
- #shodan(query) ⇒ Object
- #status ⇒ Object
- #urlscan(query) ⇒ Object
- #virustotal(indiactor) ⇒ Object
- #zoomeye(query) ⇒ Object
Instance Method Details
#alerts ⇒ Object
205 206 207 208 209 210 211 |
# File 'lib/mihari/cli.rb', line 205 def alerts with_error_handling do viewer = AlertViewer.new(limit: ["limit"]) alerts = viewer.list puts JSON.pretty_generate(alerts) end end |
#binaryedge(query) ⇒ Object
138 139 140 141 142 |
# File 'lib/mihari/cli.rb', line 138 def binaryedge(query) with_error_handling do run_analyzer Analyzers::BinaryEdge, query: query, options: end end |
#censys(query) ⇒ Object
13 14 15 16 17 |
# File 'lib/mihari/cli.rb', line 13 def censys(query) with_error_handling do run_analyzer Analyzers::Censys, query: query, options: end end |
#circl(query) ⇒ Object
107 108 109 110 111 |
# File 'lib/mihari/cli.rb', line 107 def circl(query) with_error_handling do run_analyzer Analyzers::CIRCL, query: query, options: end end |
#crtsh(query) ⇒ Object
87 88 89 90 91 |
# File 'lib/mihari/cli.rb', line 87 def crtsh(query) with_error_handling do run_analyzer Analyzers::Crtsh, query: query, options: end end |
#dnpedia(query) ⇒ Object
97 98 99 100 101 |
# File 'lib/mihari/cli.rb', line 97 def dnpedia(query) with_error_handling do run_analyzer Analyzers::DNPedia, query: query, options: end end |
#import_from_json(input = nil) ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/mihari/cli.rb', line 185 def import_from_json(input = nil) with_error_handling do json = input || STDIN.gets.chomp raise ArgumentError, "Input not found: please give an input in a JSON format" unless json json = parse_as_json(json) raise ArgumentError, "Invalid input format: an input JSON data should have title, description and artifacts key" unless valid_json?(json) title = json.dig("title") description = json.dig("description") artifacts = json.dig("artifacts") = json.dig("tags") || [] basic = Analyzers::Basic.new(title: title, description: description, artifacts: artifacts, tags: ) basic.run end end |
#onyphe(query) ⇒ Object
33 34 35 36 37 |
# File 'lib/mihari/cli.rb', line 33 def onyphe(query) with_error_handling do run_analyzer Analyzers::Onyphe, query: query, options: end end |
#passive_dns(query) ⇒ Object
148 149 150 151 152 |
# File 'lib/mihari/cli.rb', line 148 def passive_dns(query) with_error_handling do run_analyzer Analyzers::PassiveDNS, query: query, options: end end |
#passive_ssl(query) ⇒ Object
158 159 160 161 162 |
# File 'lib/mihari/cli.rb', line 158 def passive_ssl(query) with_error_handling do run_analyzer Analyzers::PassiveSSL, query: query, options: end end |
#passivetotal(indicator) ⇒ Object
117 118 119 120 121 |
# File 'lib/mihari/cli.rb', line 117 def passivetotal(indicator) with_error_handling do run_analyzer Analyzers::PassiveTotal, query: refang(indicator), options: end end |
#reverse_whois(query) ⇒ Object
168 169 170 171 172 |
# File 'lib/mihari/cli.rb', line 168 def reverse_whois(query) with_error_handling do run_analyzer Analyzers::ReveseWhois, query: query, options: end end |
#securitytrails(indiactor) ⇒ Object
64 65 66 67 68 |
# File 'lib/mihari/cli.rb', line 64 def securitytrails(indiactor) with_error_handling do run_analyzer Analyzers::SecurityTrails, query: refang(indiactor), options: end end |
#securitytrails_domain_feed(regexp) ⇒ Object
76 77 78 79 80 |
# File 'lib/mihari/cli.rb', line 76 def securitytrails_domain_feed(regexp) with_error_handling do run_analyzer Analyzers::SecurityTrailsDomainFeed, query: regexp, options: end end |
#sha256(query) ⇒ Object
178 179 180 181 182 |
# File 'lib/mihari/cli.rb', line 178 def sha256(query) with_error_handling do run_analyzer Analyzers::SHA256, query: query, options: end end |
#shodan(query) ⇒ Object
23 24 25 26 27 |
# File 'lib/mihari/cli.rb', line 23 def shodan(query) with_error_handling do run_analyzer Analyzers::Shodan, query: query, options: end end |
#status ⇒ Object
214 215 216 217 218 |
# File 'lib/mihari/cli.rb', line 214 def status with_error_handling do puts JSON.pretty_generate(Status.check) end end |
#urlscan(query) ⇒ Object
44 45 46 47 48 |
# File 'lib/mihari/cli.rb', line 44 def urlscan(query) with_error_handling do run_analyzer Analyzers::Urlscan, query: query, options: end end |
#virustotal(indiactor) ⇒ Object
54 55 56 57 58 |
# File 'lib/mihari/cli.rb', line 54 def virustotal(indiactor) with_error_handling do run_analyzer Analyzers::VirusTotal, query: refang(indiactor), options: end end |