mihari 6.2.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -10
- data/.rubocop.yml +2 -0
- data/Dockerfile +13 -0
- data/config.ru +5 -3
- data/docker-compose.yml +62 -0
- data/exe/mihari +2 -1
- data/lefthook.yml +8 -0
- data/lib/mihari/actor.rb +4 -4
- data/lib/mihari/analyzers/base.rb +16 -0
- data/lib/mihari/analyzers/binaryedge.rb +4 -2
- data/lib/mihari/analyzers/censys.rb +7 -5
- data/lib/mihari/analyzers/circl.rb +5 -3
- data/lib/mihari/analyzers/crtsh.rb +4 -1
- data/lib/mihari/analyzers/dnstwister.rb +1 -1
- data/lib/mihari/analyzers/feed.rb +12 -20
- data/lib/mihari/analyzers/fofa.rb +6 -8
- data/lib/mihari/analyzers/greynoise.rb +4 -2
- data/lib/mihari/analyzers/hunterhow.rb +4 -2
- data/lib/mihari/analyzers/onyphe.rb +4 -2
- data/lib/mihari/analyzers/otx.rb +5 -3
- data/lib/mihari/analyzers/passivetotal.rb +29 -12
- data/lib/mihari/analyzers/pulsedive.rb +5 -3
- data/lib/mihari/analyzers/securitytrails.rb +32 -8
- data/lib/mihari/analyzers/shodan.rb +4 -2
- data/lib/mihari/analyzers/urlscan.rb +4 -2
- data/lib/mihari/analyzers/virustotal.rb +5 -5
- data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -2
- data/lib/mihari/analyzers/zoomeye.rb +4 -2
- data/lib/mihari/cli/{main.rb → application.rb} +17 -5
- data/lib/mihari/cli/artifact.rb +14 -0
- data/lib/mihari/cli/config.rb +14 -0
- data/lib/mihari/cli/rule.rb +1 -0
- data/lib/mihari/cli/tag.rb +14 -0
- data/lib/mihari/clients/base.rb +2 -2
- data/lib/mihari/clients/binaryedge.rb +2 -2
- data/lib/mihari/clients/crtsh.rb +2 -9
- data/lib/mihari/clients/fofa.rb +1 -1
- data/lib/mihari/clients/hunterhow.rb +1 -1
- data/lib/mihari/clients/mmdb.rb +28 -0
- data/lib/mihari/clients/passivetotal.rb +7 -20
- data/lib/mihari/clients/securitytrails.rb +19 -43
- data/lib/mihari/clients/shodan_internet_db.rb +28 -0
- data/lib/mihari/clients/the_hive.rb +7 -5
- data/lib/mihari/commands/alert.rb +53 -11
- data/lib/mihari/commands/artifact.rb +66 -0
- data/lib/mihari/commands/config.rb +23 -0
- data/lib/mihari/commands/database.rb +1 -1
- data/lib/mihari/commands/rule.rb +40 -27
- data/lib/mihari/commands/search.rb +10 -11
- data/lib/mihari/commands/sidekiq.rb +31 -0
- data/lib/mihari/commands/tag.rb +46 -0
- data/lib/mihari/commands/web.rb +6 -7
- data/lib/mihari/{mixins/autonomous_system.rb → concerns/autonomous_system_normalizable.rb} +5 -3
- data/lib/mihari/concerns/configurable.rb +72 -0
- data/lib/mihari/concerns/database_connectable.rb +16 -0
- data/lib/mihari/{mixins/unwrap_error.rb → concerns/error_unwrappable.rb} +5 -3
- data/lib/mihari/{mixins/falsepositive.rb → concerns/falsepositive_validatable.rb} +5 -3
- data/lib/mihari/{mixins/refang.rb → concerns/refangable.rb} +5 -3
- data/lib/mihari/{mixins → concerns}/retriable.rb +4 -2
- data/lib/mihari/config.rb +13 -12
- data/lib/mihari/database.rb +30 -42
- data/lib/mihari/emitters/database.rb +5 -6
- data/lib/mihari/emitters/misp.rb +4 -11
- data/lib/mihari/emitters/slack.rb +7 -5
- data/lib/mihari/emitters/the_hive.rb +8 -58
- data/lib/mihari/emitters/webhook.rb +6 -6
- data/lib/mihari/enrichers/google_public_dns.rb +1 -1
- data/lib/mihari/enrichers/mmdb.rb +28 -0
- data/lib/mihari/enrichers/shodan.rb +3 -5
- data/lib/mihari/enrichers/whois.rb +3 -3
- data/lib/mihari/entities/alert.rb +3 -10
- data/lib/mihari/entities/artifact.rb +9 -9
- data/lib/mihari/entities/config.rb +2 -2
- data/lib/mihari/entities/cpe.rb +1 -0
- data/lib/mihari/entities/dns.rb +1 -0
- data/lib/mihari/entities/geolocation.rb +1 -0
- data/lib/mihari/entities/ip_address.rb +1 -3
- data/lib/mihari/entities/messages.rb +17 -0
- data/lib/mihari/entities/pagination.rb +11 -0
- data/lib/mihari/entities/port.rb +1 -0
- data/lib/mihari/entities/reverse_dns.rb +1 -0
- data/lib/mihari/entities/rule.rb +2 -20
- data/lib/mihari/entities/tag.rb +2 -2
- data/lib/mihari/entities/whois.rb +1 -0
- data/lib/mihari/errors.rb +2 -4
- data/lib/mihari/http.rb +4 -0
- data/lib/mihari/models/alert.rb +21 -76
- data/lib/mihari/models/artifact.rb +51 -31
- data/lib/mihari/models/autonomous_system.rb +5 -13
- data/lib/mihari/models/concerns/searchable.rb +50 -0
- data/lib/mihari/models/cpe.rb +3 -10
- data/lib/mihari/models/dns.rb +2 -6
- data/lib/mihari/models/geolocation.rb +7 -12
- data/lib/mihari/models/port.rb +3 -10
- data/lib/mihari/models/reverse_dns.rb +3 -8
- data/lib/mihari/models/rule.rb +16 -60
- data/lib/mihari/models/tag.rb +17 -1
- data/lib/mihari/models/tagging.rb +1 -1
- data/lib/mihari/models/whois.rb +1 -4
- data/lib/mihari/rule.rb +35 -24
- data/lib/mihari/schemas/alert.rb +1 -0
- data/lib/mihari/schemas/analyzer.rb +2 -2
- data/lib/mihari/schemas/concerns/orrable.rb +24 -0
- data/lib/mihari/schemas/emitter.rb +1 -2
- data/lib/mihari/schemas/enricher.rb +3 -4
- data/lib/mihari/schemas/macros.rb +1 -1
- data/lib/mihari/schemas/options.rb +0 -2
- data/lib/mihari/schemas/rule.rb +1 -2
- data/lib/mihari/services/{rule_builder.rb → builders.rb} +1 -6
- data/lib/mihari/services/creators.rb +22 -0
- data/lib/mihari/services/destroyers.rb +41 -0
- data/lib/mihari/services/enrichers.rb +25 -0
- data/lib/mihari/services/feed.rb +107 -0
- data/lib/mihari/services/getters.rb +58 -0
- data/lib/mihari/services/initializers.rb +22 -0
- data/lib/mihari/services/{alert_builder.rb → proxies.rb} +10 -40
- data/lib/mihari/services/searchers.rb +91 -0
- data/lib/mihari/sidekiq/application.rb +13 -0
- data/lib/mihari/sidekiq/jobs.rb +36 -0
- data/lib/mihari/structs/censys.rb +1 -1
- data/lib/mihari/structs/config.rb +10 -10
- data/lib/mihari/structs/filters.rb +12 -86
- data/lib/mihari/structs/google_public_dns.rb +1 -1
- data/lib/mihari/structs/greynoise.rb +1 -1
- data/lib/mihari/structs/mmdb.rb +115 -0
- data/lib/mihari/structs/onyphe.rb +1 -1
- data/lib/mihari/structs/shodan.rb +2 -2
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/{app.rb → application.rb} +28 -15
- data/lib/mihari/web/endpoints/alerts.rb +34 -81
- data/lib/mihari/web/endpoints/artifacts.rb +43 -63
- data/lib/mihari/web/endpoints/configs.rb +3 -5
- data/lib/mihari/web/endpoints/ip_addresses.rb +14 -15
- data/lib/mihari/web/endpoints/rules.rb +58 -137
- data/lib/mihari/web/endpoints/tags.rb +21 -17
- data/lib/mihari/web/middleware/capture_exceptions.rb +25 -0
- data/lib/mihari/web/middleware/{connection_adapter.rb → connection.rb} +4 -2
- data/lib/mihari/web/public/assets/index-cQUcyII5.js +1766 -0
- data/lib/mihari/web/public/assets/index-dVaNxqTC.css +1 -0
- data/lib/mihari/web/public/index.html +2 -3
- data/lib/mihari/web/public/redoc-static.html +385 -381
- data/lib/mihari.rb +56 -28
- data/mihari.gemspec +16 -8
- data/mkdocs.yml +5 -2
- data/requirements.txt +1 -1
- metadata +173 -42
- data/lib/mihari/commands/mixins.rb +0 -11
- data/lib/mihari/enrichers/ipinfo.rb +0 -52
- data/lib/mihari/entities/message.rb +0 -9
- data/lib/mihari/feed/parser.rb +0 -38
- data/lib/mihari/feed/reader.rb +0 -111
- data/lib/mihari/mixins/configurable.rb +0 -68
- data/lib/mihari/schemas/mixins.rb +0 -20
- data/lib/mihari/services/alert_runner.rb +0 -20
- data/lib/mihari/structs/ipinfo.rb +0 -53
- data/lib/mihari/web/middleware/error_notification_adapter.rb +0 -35
- data/lib/mihari/web/public/assets/index-1d77cd61.js +0 -1756
- data/lib/mihari/web/public/assets/index-4c8509ee.css +0 -1
- /data/lib/mihari/web/public/assets/{mode-yaml-24faa242.js → mode-yaml-BC4MIiYj.js} +0 -0
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mihari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_errors
|
@@ -44,14 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capybara
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.39'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '3.39'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: coveralls_reborn
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0.28'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_bot
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '6.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '6.4'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: fakefs
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,14 +268,42 @@ dependencies:
|
|
240
268
|
requirements:
|
241
269
|
- - "~>"
|
242
270
|
- !ruby/object:Gem::Version
|
243
|
-
version: '0.
|
271
|
+
version: '0.9'
|
244
272
|
type: :development
|
245
273
|
prerelease: false
|
246
274
|
version_requirements: !ruby/object:Gem::Requirement
|
247
275
|
requirements:
|
248
276
|
- - "~>"
|
249
277
|
- !ruby/object:Gem::Version
|
250
|
-
version: '0.
|
278
|
+
version: '0.9'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: rubocop-rake
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0.6'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "~>"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0.6'
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: rubocop-factory_bot
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - "~>"
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '2.24'
|
300
|
+
type: :development
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - "~>"
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '2.24'
|
251
307
|
- !ruby/object:Gem::Dependency
|
252
308
|
name: simplecov-lcov
|
253
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,14 +324,14 @@ dependencies:
|
|
268
324
|
requirements:
|
269
325
|
- - "~>"
|
270
326
|
- !ruby/object:Gem::Version
|
271
|
-
version: '1.
|
327
|
+
version: '1.33'
|
272
328
|
type: :development
|
273
329
|
prerelease: false
|
274
330
|
version_requirements: !ruby/object:Gem::Requirement
|
275
331
|
requirements:
|
276
332
|
- - "~>"
|
277
333
|
- !ruby/object:Gem::Version
|
278
|
-
version: '1.
|
334
|
+
version: '1.33'
|
279
335
|
- !ruby/object:Gem::Dependency
|
280
336
|
name: test-prof
|
281
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,16 +406,16 @@ dependencies:
|
|
350
406
|
name: addressable
|
351
407
|
requirement: !ruby/object:Gem::Requirement
|
352
408
|
requirements:
|
353
|
-
- -
|
409
|
+
- - "~>"
|
354
410
|
- !ruby/object:Gem::Version
|
355
|
-
version: 2.8
|
411
|
+
version: '2.8'
|
356
412
|
type: :runtime
|
357
413
|
prerelease: false
|
358
414
|
version_requirements: !ruby/object:Gem::Requirement
|
359
415
|
requirements:
|
360
|
-
- -
|
416
|
+
- - "~>"
|
361
417
|
- !ruby/object:Gem::Version
|
362
|
-
version: 2.8
|
418
|
+
version: '2.8'
|
363
419
|
- !ruby/object:Gem::Dependency
|
364
420
|
name: anyway_config
|
365
421
|
requirement: !ruby/object:Gem::Requirement
|
@@ -632,14 +688,14 @@ dependencies:
|
|
632
688
|
requirements:
|
633
689
|
- - '='
|
634
690
|
- !ruby/object:Gem::Version
|
635
|
-
version: 1.
|
691
|
+
version: 1.24.0
|
636
692
|
type: :runtime
|
637
693
|
prerelease: false
|
638
694
|
version_requirements: !ruby/object:Gem::Requirement
|
639
695
|
requirements:
|
640
696
|
- - '='
|
641
697
|
- !ruby/object:Gem::Version
|
642
|
-
version: 1.
|
698
|
+
version: 1.24.0
|
643
699
|
- !ruby/object:Gem::Dependency
|
644
700
|
name: plissken
|
645
701
|
requirement: !ruby/object:Gem::Requirement
|
@@ -710,6 +766,20 @@ dependencies:
|
|
710
766
|
- - '='
|
711
767
|
- !ruby/object:Gem::Version
|
712
768
|
version: 2.0.1
|
769
|
+
- !ruby/object:Gem::Dependency
|
770
|
+
name: rack-session
|
771
|
+
requirement: !ruby/object:Gem::Requirement
|
772
|
+
requirements:
|
773
|
+
- - '='
|
774
|
+
- !ruby/object:Gem::Version
|
775
|
+
version: 2.0.0
|
776
|
+
type: :runtime
|
777
|
+
prerelease: false
|
778
|
+
version_requirements: !ruby/object:Gem::Requirement
|
779
|
+
requirements:
|
780
|
+
- - '='
|
781
|
+
- !ruby/object:Gem::Version
|
782
|
+
version: 2.0.0
|
713
783
|
- !ruby/object:Gem::Dependency
|
714
784
|
name: rackup
|
715
785
|
requirement: !ruby/object:Gem::Requirement
|
@@ -724,6 +794,20 @@ dependencies:
|
|
724
794
|
- - '='
|
725
795
|
- !ruby/object:Gem::Version
|
726
796
|
version: 2.1.0
|
797
|
+
- !ruby/object:Gem::Dependency
|
798
|
+
name: search_cop
|
799
|
+
requirement: !ruby/object:Gem::Requirement
|
800
|
+
requirements:
|
801
|
+
- - '='
|
802
|
+
- !ruby/object:Gem::Version
|
803
|
+
version: 1.2.3
|
804
|
+
type: :runtime
|
805
|
+
prerelease: false
|
806
|
+
version_requirements: !ruby/object:Gem::Requirement
|
807
|
+
requirements:
|
808
|
+
- - '='
|
809
|
+
- !ruby/object:Gem::Version
|
810
|
+
version: 1.2.3
|
727
811
|
- !ruby/object:Gem::Dependency
|
728
812
|
name: semantic_logger
|
729
813
|
requirement: !ruby/object:Gem::Requirement
|
@@ -744,14 +828,42 @@ dependencies:
|
|
744
828
|
requirements:
|
745
829
|
- - "~>"
|
746
830
|
- !ruby/object:Gem::Version
|
747
|
-
version: '5.
|
831
|
+
version: '5.15'
|
748
832
|
type: :runtime
|
749
833
|
prerelease: false
|
750
834
|
version_requirements: !ruby/object:Gem::Requirement
|
751
835
|
requirements:
|
752
836
|
- - "~>"
|
753
837
|
- !ruby/object:Gem::Version
|
754
|
-
version: '5.
|
838
|
+
version: '5.15'
|
839
|
+
- !ruby/object:Gem::Dependency
|
840
|
+
name: sentry-sidekiq
|
841
|
+
requirement: !ruby/object:Gem::Requirement
|
842
|
+
requirements:
|
843
|
+
- - "~>"
|
844
|
+
- !ruby/object:Gem::Version
|
845
|
+
version: '5.15'
|
846
|
+
type: :runtime
|
847
|
+
prerelease: false
|
848
|
+
version_requirements: !ruby/object:Gem::Requirement
|
849
|
+
requirements:
|
850
|
+
- - "~>"
|
851
|
+
- !ruby/object:Gem::Version
|
852
|
+
version: '5.15'
|
853
|
+
- !ruby/object:Gem::Dependency
|
854
|
+
name: sidekiq
|
855
|
+
requirement: !ruby/object:Gem::Requirement
|
856
|
+
requirements:
|
857
|
+
- - '='
|
858
|
+
- !ruby/object:Gem::Version
|
859
|
+
version: 7.2.0
|
860
|
+
type: :runtime
|
861
|
+
prerelease: false
|
862
|
+
version_requirements: !ruby/object:Gem::Requirement
|
863
|
+
requirements:
|
864
|
+
- - '='
|
865
|
+
- !ruby/object:Gem::Version
|
866
|
+
version: 7.2.0
|
755
867
|
- !ruby/object:Gem::Dependency
|
756
868
|
name: slack-notifier
|
757
869
|
requirement: !ruby/object:Gem::Requirement
|
@@ -772,14 +884,14 @@ dependencies:
|
|
772
884
|
requirements:
|
773
885
|
- - "~>"
|
774
886
|
- !ruby/object:Gem::Version
|
775
|
-
version: '1.
|
887
|
+
version: '1.7'
|
776
888
|
type: :runtime
|
777
889
|
prerelease: false
|
778
890
|
version_requirements: !ruby/object:Gem::Requirement
|
779
891
|
requirements:
|
780
892
|
- - "~>"
|
781
893
|
- !ruby/object:Gem::Version
|
782
|
-
version: '1.
|
894
|
+
version: '1.7'
|
783
895
|
- !ruby/object:Gem::Dependency
|
784
896
|
name: thor
|
785
897
|
requirement: !ruby/object:Gem::Requirement
|
@@ -862,6 +974,7 @@ files:
|
|
862
974
|
- ".rspec"
|
863
975
|
- ".rubocop.yml"
|
864
976
|
- ".standard.yml"
|
977
|
+
- Dockerfile
|
865
978
|
- Gemfile
|
866
979
|
- LICENSE
|
867
980
|
- README.md
|
@@ -870,6 +983,7 @@ files:
|
|
870
983
|
- bin/setup
|
871
984
|
- build_frontend.sh
|
872
985
|
- config.ru
|
986
|
+
- docker-compose.yml
|
873
987
|
- exe/mihari
|
874
988
|
- lefthook.yml
|
875
989
|
- lib/mihari.rb
|
@@ -895,10 +1009,13 @@ files:
|
|
895
1009
|
- lib/mihari/analyzers/virustotal_intelligence.rb
|
896
1010
|
- lib/mihari/analyzers/zoomeye.rb
|
897
1011
|
- lib/mihari/cli/alert.rb
|
1012
|
+
- lib/mihari/cli/application.rb
|
1013
|
+
- lib/mihari/cli/artifact.rb
|
898
1014
|
- lib/mihari/cli/base.rb
|
1015
|
+
- lib/mihari/cli/config.rb
|
899
1016
|
- lib/mihari/cli/database.rb
|
900
|
-
- lib/mihari/cli/main.rb
|
901
1017
|
- lib/mihari/cli/rule.rb
|
1018
|
+
- lib/mihari/cli/tag.rb
|
902
1019
|
- lib/mihari/clients/base.rb
|
903
1020
|
- lib/mihari/clients/binaryedge.rb
|
904
1021
|
- lib/mihari/clients/censys.rb
|
@@ -910,23 +1027,35 @@ files:
|
|
910
1027
|
- lib/mihari/clients/greynoise.rb
|
911
1028
|
- lib/mihari/clients/hunterhow.rb
|
912
1029
|
- lib/mihari/clients/misp.rb
|
1030
|
+
- lib/mihari/clients/mmdb.rb
|
913
1031
|
- lib/mihari/clients/onyphe.rb
|
914
1032
|
- lib/mihari/clients/otx.rb
|
915
1033
|
- lib/mihari/clients/passivetotal.rb
|
916
1034
|
- lib/mihari/clients/publsedive.rb
|
917
1035
|
- lib/mihari/clients/securitytrails.rb
|
918
1036
|
- lib/mihari/clients/shodan.rb
|
1037
|
+
- lib/mihari/clients/shodan_internet_db.rb
|
919
1038
|
- lib/mihari/clients/the_hive.rb
|
920
1039
|
- lib/mihari/clients/urlscan.rb
|
921
1040
|
- lib/mihari/clients/virustotal.rb
|
922
1041
|
- lib/mihari/clients/zoomeye.rb
|
923
1042
|
- lib/mihari/commands/alert.rb
|
1043
|
+
- lib/mihari/commands/artifact.rb
|
1044
|
+
- lib/mihari/commands/config.rb
|
924
1045
|
- lib/mihari/commands/database.rb
|
925
|
-
- lib/mihari/commands/mixins.rb
|
926
1046
|
- lib/mihari/commands/rule.rb
|
927
1047
|
- lib/mihari/commands/search.rb
|
1048
|
+
- lib/mihari/commands/sidekiq.rb
|
1049
|
+
- lib/mihari/commands/tag.rb
|
928
1050
|
- lib/mihari/commands/version.rb
|
929
1051
|
- lib/mihari/commands/web.rb
|
1052
|
+
- lib/mihari/concerns/autonomous_system_normalizable.rb
|
1053
|
+
- lib/mihari/concerns/configurable.rb
|
1054
|
+
- lib/mihari/concerns/database_connectable.rb
|
1055
|
+
- lib/mihari/concerns/error_unwrappable.rb
|
1056
|
+
- lib/mihari/concerns/falsepositive_validatable.rb
|
1057
|
+
- lib/mihari/concerns/refangable.rb
|
1058
|
+
- lib/mihari/concerns/retriable.rb
|
930
1059
|
- lib/mihari/config.rb
|
931
1060
|
- lib/mihari/constants.rb
|
932
1061
|
- lib/mihari/data_type.rb
|
@@ -939,7 +1068,7 @@ files:
|
|
939
1068
|
- lib/mihari/emitters/webhook.rb
|
940
1069
|
- lib/mihari/enrichers/base.rb
|
941
1070
|
- lib/mihari/enrichers/google_public_dns.rb
|
942
|
-
- lib/mihari/enrichers/
|
1071
|
+
- lib/mihari/enrichers/mmdb.rb
|
943
1072
|
- lib/mihari/enrichers/shodan.rb
|
944
1073
|
- lib/mihari/enrichers/whois.rb
|
945
1074
|
- lib/mihari/entities/alert.rb
|
@@ -950,25 +1079,19 @@ files:
|
|
950
1079
|
- lib/mihari/entities/dns.rb
|
951
1080
|
- lib/mihari/entities/geolocation.rb
|
952
1081
|
- lib/mihari/entities/ip_address.rb
|
953
|
-
- lib/mihari/entities/
|
1082
|
+
- lib/mihari/entities/messages.rb
|
1083
|
+
- lib/mihari/entities/pagination.rb
|
954
1084
|
- lib/mihari/entities/port.rb
|
955
1085
|
- lib/mihari/entities/reverse_dns.rb
|
956
1086
|
- lib/mihari/entities/rule.rb
|
957
1087
|
- lib/mihari/entities/tag.rb
|
958
1088
|
- lib/mihari/entities/whois.rb
|
959
1089
|
- lib/mihari/errors.rb
|
960
|
-
- lib/mihari/feed/parser.rb
|
961
|
-
- lib/mihari/feed/reader.rb
|
962
1090
|
- lib/mihari/http.rb
|
963
|
-
- lib/mihari/mixins/autonomous_system.rb
|
964
|
-
- lib/mihari/mixins/configurable.rb
|
965
|
-
- lib/mihari/mixins/falsepositive.rb
|
966
|
-
- lib/mihari/mixins/refang.rb
|
967
|
-
- lib/mihari/mixins/retriable.rb
|
968
|
-
- lib/mihari/mixins/unwrap_error.rb
|
969
1091
|
- lib/mihari/models/alert.rb
|
970
1092
|
- lib/mihari/models/artifact.rb
|
971
1093
|
- lib/mihari/models/autonomous_system.rb
|
1094
|
+
- lib/mihari/models/concerns/searchable.rb
|
972
1095
|
- lib/mihari/models/cpe.rb
|
973
1096
|
- lib/mihari/models/dns.rb
|
974
1097
|
- lib/mihari/models/geolocation.rb
|
@@ -981,16 +1104,24 @@ files:
|
|
981
1104
|
- lib/mihari/rule.rb
|
982
1105
|
- lib/mihari/schemas/alert.rb
|
983
1106
|
- lib/mihari/schemas/analyzer.rb
|
1107
|
+
- lib/mihari/schemas/concerns/orrable.rb
|
984
1108
|
- lib/mihari/schemas/emitter.rb
|
985
1109
|
- lib/mihari/schemas/enricher.rb
|
986
1110
|
- lib/mihari/schemas/macros.rb
|
987
|
-
- lib/mihari/schemas/mixins.rb
|
988
1111
|
- lib/mihari/schemas/options.rb
|
989
1112
|
- lib/mihari/schemas/rule.rb
|
990
1113
|
- lib/mihari/service.rb
|
991
|
-
- lib/mihari/services/
|
992
|
-
- lib/mihari/services/
|
993
|
-
- lib/mihari/services/
|
1114
|
+
- lib/mihari/services/builders.rb
|
1115
|
+
- lib/mihari/services/creators.rb
|
1116
|
+
- lib/mihari/services/destroyers.rb
|
1117
|
+
- lib/mihari/services/enrichers.rb
|
1118
|
+
- lib/mihari/services/feed.rb
|
1119
|
+
- lib/mihari/services/getters.rb
|
1120
|
+
- lib/mihari/services/initializers.rb
|
1121
|
+
- lib/mihari/services/proxies.rb
|
1122
|
+
- lib/mihari/services/searchers.rb
|
1123
|
+
- lib/mihari/sidekiq/application.rb
|
1124
|
+
- lib/mihari/sidekiq/jobs.rb
|
994
1125
|
- lib/mihari/structs/binaryedge.rb
|
995
1126
|
- lib/mihari/structs/censys.rb
|
996
1127
|
- lib/mihari/structs/config.rb
|
@@ -999,7 +1130,7 @@ files:
|
|
999
1130
|
- lib/mihari/structs/google_public_dns.rb
|
1000
1131
|
- lib/mihari/structs/greynoise.rb
|
1001
1132
|
- lib/mihari/structs/hunterhow.rb
|
1002
|
-
- lib/mihari/structs/
|
1133
|
+
- lib/mihari/structs/mmdb.rb
|
1003
1134
|
- lib/mihari/structs/onyphe.rb
|
1004
1135
|
- lib/mihari/structs/shodan.rb
|
1005
1136
|
- lib/mihari/structs/urlscan.rb
|
@@ -1007,18 +1138,18 @@ files:
|
|
1007
1138
|
- lib/mihari/types.rb
|
1008
1139
|
- lib/mihari/version.rb
|
1009
1140
|
- lib/mihari/web/api.rb
|
1010
|
-
- lib/mihari/web/
|
1141
|
+
- lib/mihari/web/application.rb
|
1011
1142
|
- lib/mihari/web/endpoints/alerts.rb
|
1012
1143
|
- lib/mihari/web/endpoints/artifacts.rb
|
1013
1144
|
- lib/mihari/web/endpoints/configs.rb
|
1014
1145
|
- lib/mihari/web/endpoints/ip_addresses.rb
|
1015
1146
|
- lib/mihari/web/endpoints/rules.rb
|
1016
1147
|
- lib/mihari/web/endpoints/tags.rb
|
1017
|
-
- lib/mihari/web/middleware/
|
1018
|
-
- lib/mihari/web/middleware/
|
1019
|
-
- lib/mihari/web/public/assets/index-
|
1020
|
-
- lib/mihari/web/public/assets/index-
|
1021
|
-
- lib/mihari/web/public/assets/mode-yaml-
|
1148
|
+
- lib/mihari/web/middleware/capture_exceptions.rb
|
1149
|
+
- lib/mihari/web/middleware/connection.rb
|
1150
|
+
- lib/mihari/web/public/assets/index-cQUcyII5.js
|
1151
|
+
- lib/mihari/web/public/assets/index-dVaNxqTC.css
|
1152
|
+
- lib/mihari/web/public/assets/mode-yaml-BC4MIiYj.js
|
1022
1153
|
- lib/mihari/web/public/favicon.ico
|
1023
1154
|
- lib/mihari/web/public/index.html
|
1024
1155
|
- lib/mihari/web/public/redoc-static.html
|
@@ -1046,7 +1177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1046
1177
|
- !ruby/object:Gem::Version
|
1047
1178
|
version: '0'
|
1048
1179
|
requirements: []
|
1049
|
-
rubygems_version: 3.
|
1180
|
+
rubygems_version: 3.5.3
|
1050
1181
|
signing_key:
|
1051
1182
|
specification_version: 4
|
1052
1183
|
summary: A query aggregator for OSINT based threat hunting
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mihari
|
4
|
-
module Enrichers
|
5
|
-
#
|
6
|
-
# IPInfo enricher
|
7
|
-
#
|
8
|
-
class IPInfo < Base
|
9
|
-
# @return [String, nil]
|
10
|
-
attr_reader :api_key
|
11
|
-
|
12
|
-
#
|
13
|
-
# @param [Hash, nil] options
|
14
|
-
# @param [String, nil] api_key
|
15
|
-
#
|
16
|
-
def initialize(options: nil, api_key: nil)
|
17
|
-
@api_key = api_key || Mihari.config.ipinfo_api_key
|
18
|
-
|
19
|
-
super(options: options)
|
20
|
-
end
|
21
|
-
|
22
|
-
def configuration_keys
|
23
|
-
%w[ipinfo_api_key]
|
24
|
-
end
|
25
|
-
|
26
|
-
#
|
27
|
-
# Query IPInfo
|
28
|
-
#
|
29
|
-
# @param [String] ip
|
30
|
-
#
|
31
|
-
# @return [Mihari::Structs::IPInfo::Response]
|
32
|
-
#
|
33
|
-
def call(ip)
|
34
|
-
url = "https://ipinfo.io/#{ip}/json"
|
35
|
-
res = http.get(url)
|
36
|
-
Structs::IPInfo::Response.from_dynamic! JSON.parse(res.body.to_s)
|
37
|
-
end
|
38
|
-
memo_wise :call
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def headers
|
43
|
-
authorization = api_key.nil? ? nil : "Bearer #{api_key}"
|
44
|
-
{ authorization: authorization }.compact
|
45
|
-
end
|
46
|
-
|
47
|
-
def http
|
48
|
-
HTTP::Factory.build headers: headers, timeout: timeout
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/lib/mihari/feed/parser.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "jr/cli/core_ext"
|
4
|
-
|
5
|
-
module Mihari
|
6
|
-
module Feed
|
7
|
-
#
|
8
|
-
# Feed parser
|
9
|
-
#
|
10
|
-
class Parser
|
11
|
-
# @return [Array<Hash>, Array<Array<String>>]
|
12
|
-
attr_reader :data
|
13
|
-
|
14
|
-
#
|
15
|
-
# @param [Array<Hash>, Array<Array<String>>] data
|
16
|
-
#
|
17
|
-
def initialize(data)
|
18
|
-
@data = data
|
19
|
-
end
|
20
|
-
|
21
|
-
#
|
22
|
-
# Parse data by selector
|
23
|
-
#
|
24
|
-
# @param [String] selector
|
25
|
-
#
|
26
|
-
# @return [Array<String>]
|
27
|
-
#
|
28
|
-
def parse(selector)
|
29
|
-
parsed = data.instance_eval(selector)
|
30
|
-
|
31
|
-
raise TypeError unless parsed.is_a?(Array) || parsed.is_a?(Enumerator)
|
32
|
-
raise TypeError unless parsed.all?(String)
|
33
|
-
|
34
|
-
parsed.to_a
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/mihari/feed/reader.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "csv"
|
4
|
-
|
5
|
-
module Mihari
|
6
|
-
module Feed
|
7
|
-
#
|
8
|
-
# Feed reader
|
9
|
-
#
|
10
|
-
class Reader
|
11
|
-
# @return [String]
|
12
|
-
attr_reader :url
|
13
|
-
|
14
|
-
# @return [Hash]
|
15
|
-
attr_reader :headers
|
16
|
-
|
17
|
-
# @return [Hash, nil]
|
18
|
-
attr_reader :params
|
19
|
-
|
20
|
-
# @return [Hash, nil]
|
21
|
-
attr_reader :json
|
22
|
-
|
23
|
-
# @return [Hash, nil]
|
24
|
-
attr_reader :data
|
25
|
-
|
26
|
-
# @return [String]
|
27
|
-
attr_reader :method
|
28
|
-
|
29
|
-
# @return [Integer, nil]
|
30
|
-
attr_reader :timeout
|
31
|
-
|
32
|
-
def initialize(url, headers: {}, method: "GET", params: nil, json: nil, data: nil, timeout: nil)
|
33
|
-
@url = Addressable::URI.parse(url)
|
34
|
-
@headers = headers
|
35
|
-
@method = method
|
36
|
-
@timeout = timeout
|
37
|
-
|
38
|
-
@params = params
|
39
|
-
@json = json
|
40
|
-
@data = data
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# @return [Array<Hash>]
|
45
|
-
#
|
46
|
-
def read
|
47
|
-
return read_file(url.path) if url.scheme == "file"
|
48
|
-
|
49
|
-
res = nil
|
50
|
-
res = http.get(url, params: params) if method == "GET"
|
51
|
-
res = http.post(url, params: params, json: json, form: data) if method == "POST"
|
52
|
-
|
53
|
-
return [] if res.nil?
|
54
|
-
|
55
|
-
body = res.body.to_s
|
56
|
-
content_type = res["Content-Type"].to_s
|
57
|
-
return convert_as_json(body) if content_type.include?("application/json")
|
58
|
-
|
59
|
-
convert_as_csv(body)
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Convert text as JSON
|
64
|
-
#
|
65
|
-
# @param [String] text
|
66
|
-
#
|
67
|
-
# @return [Array<Hash>]
|
68
|
-
#
|
69
|
-
def convert_as_json(text)
|
70
|
-
parsed = JSON.parse(text, symbolize_names: true)
|
71
|
-
return parsed if parsed.is_a?(Array)
|
72
|
-
|
73
|
-
[parsed]
|
74
|
-
end
|
75
|
-
|
76
|
-
#
|
77
|
-
# Convert text as CSV
|
78
|
-
#
|
79
|
-
# @param [String] text
|
80
|
-
#
|
81
|
-
# @return [Array<Hash>]
|
82
|
-
#
|
83
|
-
def convert_as_csv(text)
|
84
|
-
text_without_comments = text.lines.reject { |line| line.start_with? "#" }.join("\n")
|
85
|
-
|
86
|
-
CSV.new(text_without_comments).to_a.reject(&:empty?)
|
87
|
-
end
|
88
|
-
|
89
|
-
#
|
90
|
-
# Read & convert a file
|
91
|
-
#
|
92
|
-
# @param [String] path
|
93
|
-
#
|
94
|
-
# @return [Array<Hash>]
|
95
|
-
#
|
96
|
-
def read_file(path)
|
97
|
-
text = File.read(path)
|
98
|
-
|
99
|
-
return convert_as_json(text) if path.end_with?(".json")
|
100
|
-
|
101
|
-
convert_as_csv text
|
102
|
-
end
|
103
|
-
|
104
|
-
private
|
105
|
-
|
106
|
-
def http
|
107
|
-
HTTP::Factory.build headers: headers, timeout: timeout
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|