mihari 3.8.0 → 3.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +6 -7
  3. data/config.ru +1 -1
  4. data/lib/mihari/analyzers/rule.rb +24 -20
  5. data/lib/mihari/commands/search.rb +3 -2
  6. data/lib/mihari/commands/web.rb +9 -5
  7. data/lib/mihari/database.rb +1 -1
  8. data/lib/mihari/errors.rb +2 -0
  9. data/lib/mihari/mixins/configuration.rb +12 -2
  10. data/lib/mihari/models/alert.rb +29 -54
  11. data/lib/mihari/models/artifact.rb +3 -0
  12. data/lib/mihari/structs/alert.rb +45 -0
  13. data/lib/mihari/structs/ipinfo.rb +3 -4
  14. data/lib/mihari/types.rb +6 -1
  15. data/lib/mihari/version.rb +1 -1
  16. data/lib/mihari/web/api.rb +43 -0
  17. data/lib/mihari/web/app.rb +48 -30
  18. data/lib/mihari/web/endpoints/alerts.rb +74 -0
  19. data/lib/mihari/web/endpoints/artifacts.rb +92 -0
  20. data/lib/mihari/web/endpoints/command.rb +32 -0
  21. data/lib/mihari/web/endpoints/configs.rb +22 -0
  22. data/lib/mihari/web/endpoints/ip_addresses.rb +27 -0
  23. data/lib/mihari/web/endpoints/sources.rb +18 -0
  24. data/lib/mihari/web/endpoints/tags.rb +38 -0
  25. data/lib/mihari/web/entities/alert.rb +23 -0
  26. data/lib/mihari/web/entities/artifact.rb +24 -0
  27. data/lib/mihari/web/entities/autonomous_system.rb +9 -0
  28. data/lib/mihari/web/entities/command.rb +14 -0
  29. data/lib/mihari/web/entities/config.rb +16 -0
  30. data/lib/mihari/web/entities/dns.rb +10 -0
  31. data/lib/mihari/web/entities/geolocation.rb +10 -0
  32. data/lib/mihari/web/entities/ip_address.rb +13 -0
  33. data/lib/mihari/web/entities/message.rb +9 -0
  34. data/lib/mihari/web/entities/reverse_dns.rb +9 -0
  35. data/lib/mihari/web/entities/source.rb +9 -0
  36. data/lib/mihari/web/entities/tag.rb +13 -0
  37. data/lib/mihari/web/entities/whois.rb +16 -0
  38. data/lib/mihari/web/public/grape.rb +73 -0
  39. data/lib/mihari/web/public/index.html +1 -1
  40. data/lib/mihari/web/public/redoc-static.html +53 -27
  41. data/lib/mihari/web/public/static/js/app.14008741.js +21 -0
  42. data/lib/mihari/web/public/static/js/app.14008741.js.map +1 -0
  43. data/lib/mihari/web/public/static/js/app.378da3dc.js +50 -0
  44. data/lib/mihari/web/public/static/js/app.378da3dc.js.map +1 -0
  45. data/lib/mihari/web/public/static/js/app.6b636b62.js +50 -0
  46. data/lib/mihari/web/public/static/js/app.6b636b62.js.map +1 -0
  47. data/lib/mihari/web/public/static/js/app.a862ebca.js +50 -0
  48. data/lib/mihari/web/public/static/js/app.a862ebca.js.map +1 -0
  49. data/lib/mihari.rb +3 -12
  50. data/mihari.gemspec +9 -6
  51. data/sig/lib/mihari/analyzers/rule.rbs +3 -3
  52. data/sig/lib/mihari/models/alert.rbs +3 -31
  53. data/sig/lib/mihari/structs/alert.rbs +27 -0
  54. data/sig/lib/mihari/web/app.rbs +2 -2
  55. metadata +132 -76
  56. data/lib/mihari/serializers/alert.rb +0 -14
  57. data/lib/mihari/serializers/artifact.rb +0 -18
  58. data/lib/mihari/serializers/autonomous_system.rb +0 -9
  59. data/lib/mihari/serializers/dns.rb +0 -11
  60. data/lib/mihari/serializers/geolocation.rb +0 -11
  61. data/lib/mihari/serializers/reverse_dns.rb +0 -11
  62. data/lib/mihari/serializers/tag.rb +0 -11
  63. data/lib/mihari/serializers/whois.rb +0 -11
  64. data/lib/mihari/web/controllers/alerts_controller.rb +0 -74
  65. data/lib/mihari/web/controllers/analyzers_controller.rb +0 -38
  66. data/lib/mihari/web/controllers/artifacts_controller.rb +0 -94
  67. data/lib/mihari/web/controllers/base_controller.rb +0 -22
  68. data/lib/mihari/web/controllers/command_controller.rb +0 -26
  69. data/lib/mihari/web/controllers/config_controller.rb +0 -13
  70. data/lib/mihari/web/controllers/ip_address_controller.rb +0 -21
  71. data/lib/mihari/web/controllers/sources_controller.rb +0 -12
  72. data/lib/mihari/web/controllers/tags_controller.rb +0 -30
  73. data/lib/mihari/web/helpers/json.rb +0 -53
data/lib/mihari.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "awrence"
3
4
  require "colorize"
4
5
  require "dry/configurable"
5
6
  require "dry/files"
6
7
  require "mem"
8
+ require "plissken"
7
9
  require "yaml"
8
10
 
9
11
  # Load .env
@@ -108,6 +110,7 @@ require "mihari/constants"
108
110
  require "mihari/types"
109
111
 
110
112
  # Structs
113
+ require "mihari/structs/alert"
111
114
  require "mihari/structs/censys"
112
115
  require "mihari/structs/ipinfo"
113
116
  require "mihari/structs/onyphe"
@@ -134,18 +137,6 @@ require "mihari/models/tag"
134
137
  require "mihari/models/tagging"
135
138
  require "mihari/models/whois"
136
139
 
137
- # Serializers
138
- require "mihari/serializers/autonomous_system"
139
- require "mihari/serializers/dns"
140
- require "mihari/serializers/geolocation"
141
- require "mihari/serializers/reverse_dns"
142
- require "mihari/serializers/tag"
143
- require "mihari/serializers/whois"
144
-
145
- require "mihari/serializers/artifact"
146
-
147
- require "mihari/serializers/alert"
148
-
149
140
  # Analyzers
150
141
  require "mihari/analyzers/base"
151
142
  require "mihari/analyzers/basic"
data/mihari.gemspec CHANGED
@@ -42,7 +42,6 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "vcr", "~> 6.0"
43
43
  spec.add_development_dependency "webmock", "~> 3.14"
44
44
 
45
- spec.add_dependency "active_model_serializers", "~> 0.10"
46
45
  spec.add_dependency "activerecord", "~> 6.1"
47
46
  spec.add_dependency "activerecord-filter", "~> 6.1"
48
47
  spec.add_dependency "addressable", "~> 2.8"
@@ -56,11 +55,16 @@ Gem::Specification.new do |spec|
56
55
  spec.add_dependency "dnstwister", "~> 0.1"
57
56
  spec.add_dependency "dotenv", "~> 2.7"
58
57
  spec.add_dependency "dry-configurable", "~> 0.13"
58
+ spec.add_dependency "dry-container", "~> 0.9"
59
59
  spec.add_dependency "dry-files", "~> 0.1"
60
60
  spec.add_dependency "dry-initializer", "~> 3.0"
61
61
  spec.add_dependency "dry-struct", "~> 1.4"
62
62
  spec.add_dependency "dry-validation", "~> 1.7"
63
63
  spec.add_dependency "email_address", "~> 0.2"
64
+ spec.add_dependency "grape", "~> 1.6"
65
+ spec.add_dependency "grape-entity", "~> 0.10"
66
+ spec.add_dependency "grape-swagger", "~> 1.4"
67
+ spec.add_dependency "grape-swagger-entity", "~> 0.5"
64
68
  spec.add_dependency "hachi", "~> 1.0"
65
69
  spec.add_dependency "http", "~> 5.0"
66
70
  spec.add_dependency "launchy", "~> 2.5"
@@ -71,20 +75,19 @@ Gem::Specification.new do |spec|
71
75
  spec.add_dependency "normalize_country", "0.3"
72
76
  spec.add_dependency "onyphe", "~> 2.0"
73
77
  spec.add_dependency "otx_ruby", "~> 0.9"
74
- spec.add_dependency "parallel", "~> 1.20"
78
+ spec.add_dependency "parallel", "~> 1.21"
75
79
  spec.add_dependency "passive_circl", "~> 0.1"
76
80
  spec.add_dependency "passivetotalx", "~> 0.1"
81
+ spec.add_dependency "plissken", "~> 1.4"
77
82
  spec.add_dependency "public_suffix", "~> 4.0"
78
83
  spec.add_dependency "pulsedive", "~> 0.1"
79
- spec.add_dependency "puma", "~> 5.4"
84
+ spec.add_dependency "puma", "~> 5.5"
80
85
  spec.add_dependency "rack", "~> 2.2"
81
86
  spec.add_dependency "rack-contrib", "~> 2.3"
87
+ spec.add_dependency "rack-cors", "~> 1.1"
82
88
  spec.add_dependency "safe_shell", "~> 1.1"
83
89
  spec.add_dependency "securitytrails", "~> 1.0"
84
90
  spec.add_dependency "shodanx", "~> 0.2"
85
- spec.add_dependency "sinatra", "~> 2.1"
86
- spec.add_dependency "sinatra-contrib", "~> 2.1"
87
- spec.add_dependency "sinatra-param", "~> 1.6"
88
91
  spec.add_dependency "slack-notifier", "~> 2.4"
89
92
  spec.add_dependency "spysex", "~> 0.2"
90
93
  spec.add_dependency "sqlite3", "~> 1.4"
@@ -1,5 +1,7 @@
1
1
  module Mihari
2
2
  module Analyzers
3
+ ANALYZER_TO_CLASS: Hash[String, singleton(Mihari::Analyzers::Base)]
4
+
3
5
  class Rule < Base
4
6
  include Mihari::Mixins::DisallowedDataValue
5
7
 
@@ -14,14 +16,12 @@ module Mihari
14
16
 
15
17
  def initialize: (**untyped kwargs) -> void
16
18
 
17
- ANALYZER_TO_CLASS: Hash[String, singleton(Mihari::Analyzers::Base)]
18
-
19
19
  #
20
20
  # Returns a list of artifacts matched with queries
21
21
  #
22
22
  # @return [Array<Mihari::Artifact>]
23
23
  #
24
- def artifacts: () -> (Array[String] | Array[Mihari::Artifact])
24
+ def artifacts: () -> (Array[Mihari::Artifact])
25
25
 
26
26
  #
27
27
  # Normalize artifacts
@@ -7,40 +7,12 @@ module Mihari
7
7
  attr_accessor artifacts(): Array[Mihari::Artifact]
8
8
  attr_accessor Tags(): Array[Mihari::Tag]
9
9
 
10
- #
11
- # Search alerts
12
- #
13
- # @param [String, nil] artifact_data
14
- # @param [String, nil] description
15
- # @param [String, nil] source
16
- # @param [String, nil] tag_name
17
- # @param [String, nil] title
18
- # @param [DateTime, nil] from_at
19
- # @param [DateTime, nil] to_at
20
- # @param [Integer, nil] limit
21
- # @param [Integer, nil] page
22
- #
23
- # @return [Array<Hash>]
24
- #
25
- def self.search: (?artifact_data: String? artifact_data, ?description: String? description, ?source: String? source, ?tag_name: String? tag_name, ?title: String? title, ?from_at: DateTime? from_at, ?to_at: DateTime? to_at, ?limit: ::Integer limit, ?page: ::Integer page) -> Array[Hash[(String | Symbol), untyped]]
10
+ def self.search: (Mihari::Structs::Alert::SearchFilterWithPagination filter) -> Array[Hash[(String | Symbol), untyped]]
26
11
 
27
- #
28
- # Count alerts
29
- #
30
- # @param [String, nil] artifact_data
31
- # @param [String, nil] description
32
- # @param [String, nil] source
33
- # @param [String, nil] tag_name
34
- # @param [String, nil] title
35
- # @param [DateTime, nil] from_at
36
- # @param [DateTime, nil] to_at
37
- #
38
- # @return [Integer]
39
- #
40
- def self.count: (?artifact_data: String? artifact_data, ?description: String? description, ?source: String? source, ?tag_name: String? tag_name, ?title: String? title, ?from_at: DateTime? from_at, ?to_at: DateTime? to_at) -> Integer
12
+ def self.count: (Mihari::Structs::Alert::SearchFilter filter) -> Integer
41
13
 
42
14
  private
43
15
 
44
- def self.build_relation: (?artifact_data: String? artifact_data, ?title: String? title, ?description: String? description, ?source: String? source, ?tag_name: String? tag_name, ?from_at: DateTime? from_at, ?to_at: DateTime? to_at) -> Mihari::Alert
16
+ def self.build_relation: (Mihari::Structs::Alert::SearchFilter filter) -> Mihari::Alert
45
17
  end
46
18
  end
@@ -0,0 +1,27 @@
1
+ module Mihari
2
+ module Structs
3
+ module Alert
4
+ class SearchFilter
5
+ attr_reader artifact_data: String?
6
+ attr_reader description: String?
7
+ attr_reader source: String?
8
+ attr_reader tag_name: String?
9
+ attr_reader title: String?
10
+ attr_reader from_at: DateTime?
11
+ attr_reader to_at: DateTime?
12
+ attr_reader asn: Integer?
13
+ attr_reader dns_record: String?
14
+ attr_reader reverse_dns_name: String?
15
+
16
+ def has_valid_artifact_filters: () -> bool
17
+ end
18
+
19
+ class SearchFilterWithPagination
20
+ attr_reader page: Integer
21
+ attr_reader limit: Integer
22
+
23
+ def without_pagination: () -> Mihari::Structs::Alert::SearchFilter
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Mihari
2
- class App # < Sinatra::Base
3
- def self.run!: (?port: ::Integer port, ?host: ::String host) -> void
2
+ class App
3
+ def self.run!: (?port: ::Integer port, ?host: ::String host, ?threads: ::String threads, ?verbose: bool verbose) -> void
4
4
  end
5
5
  end
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: 3.8.0
4
+ version: 3.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-18 00:00:00.000000000 Z
11
+ date: 2021-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -234,20 +234,6 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '3.14'
237
- - !ruby/object:Gem::Dependency
238
- name: active_model_serializers
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: '0.10'
244
- type: :runtime
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: '0.10'
251
237
  - !ruby/object:Gem::Dependency
252
238
  name: activerecord
253
239
  requirement: !ruby/object:Gem::Requirement
@@ -430,6 +416,20 @@ dependencies:
430
416
  - - "~>"
431
417
  - !ruby/object:Gem::Version
432
418
  version: '0.13'
419
+ - !ruby/object:Gem::Dependency
420
+ name: dry-container
421
+ requirement: !ruby/object:Gem::Requirement
422
+ requirements:
423
+ - - "~>"
424
+ - !ruby/object:Gem::Version
425
+ version: '0.9'
426
+ type: :runtime
427
+ prerelease: false
428
+ version_requirements: !ruby/object:Gem::Requirement
429
+ requirements:
430
+ - - "~>"
431
+ - !ruby/object:Gem::Version
432
+ version: '0.9'
433
433
  - !ruby/object:Gem::Dependency
434
434
  name: dry-files
435
435
  requirement: !ruby/object:Gem::Requirement
@@ -500,6 +500,62 @@ dependencies:
500
500
  - - "~>"
501
501
  - !ruby/object:Gem::Version
502
502
  version: '0.2'
503
+ - !ruby/object:Gem::Dependency
504
+ name: grape
505
+ requirement: !ruby/object:Gem::Requirement
506
+ requirements:
507
+ - - "~>"
508
+ - !ruby/object:Gem::Version
509
+ version: '1.6'
510
+ type: :runtime
511
+ prerelease: false
512
+ version_requirements: !ruby/object:Gem::Requirement
513
+ requirements:
514
+ - - "~>"
515
+ - !ruby/object:Gem::Version
516
+ version: '1.6'
517
+ - !ruby/object:Gem::Dependency
518
+ name: grape-entity
519
+ requirement: !ruby/object:Gem::Requirement
520
+ requirements:
521
+ - - "~>"
522
+ - !ruby/object:Gem::Version
523
+ version: '0.10'
524
+ type: :runtime
525
+ prerelease: false
526
+ version_requirements: !ruby/object:Gem::Requirement
527
+ requirements:
528
+ - - "~>"
529
+ - !ruby/object:Gem::Version
530
+ version: '0.10'
531
+ - !ruby/object:Gem::Dependency
532
+ name: grape-swagger
533
+ requirement: !ruby/object:Gem::Requirement
534
+ requirements:
535
+ - - "~>"
536
+ - !ruby/object:Gem::Version
537
+ version: '1.4'
538
+ type: :runtime
539
+ prerelease: false
540
+ version_requirements: !ruby/object:Gem::Requirement
541
+ requirements:
542
+ - - "~>"
543
+ - !ruby/object:Gem::Version
544
+ version: '1.4'
545
+ - !ruby/object:Gem::Dependency
546
+ name: grape-swagger-entity
547
+ requirement: !ruby/object:Gem::Requirement
548
+ requirements:
549
+ - - "~>"
550
+ - !ruby/object:Gem::Version
551
+ version: '0.5'
552
+ type: :runtime
553
+ prerelease: false
554
+ version_requirements: !ruby/object:Gem::Requirement
555
+ requirements:
556
+ - - "~>"
557
+ - !ruby/object:Gem::Version
558
+ version: '0.5'
503
559
  - !ruby/object:Gem::Dependency
504
560
  name: hachi
505
561
  requirement: !ruby/object:Gem::Requirement
@@ -646,14 +702,14 @@ dependencies:
646
702
  requirements:
647
703
  - - "~>"
648
704
  - !ruby/object:Gem::Version
649
- version: '1.20'
705
+ version: '1.21'
650
706
  type: :runtime
651
707
  prerelease: false
652
708
  version_requirements: !ruby/object:Gem::Requirement
653
709
  requirements:
654
710
  - - "~>"
655
711
  - !ruby/object:Gem::Version
656
- version: '1.20'
712
+ version: '1.21'
657
713
  - !ruby/object:Gem::Dependency
658
714
  name: passive_circl
659
715
  requirement: !ruby/object:Gem::Requirement
@@ -682,6 +738,20 @@ dependencies:
682
738
  - - "~>"
683
739
  - !ruby/object:Gem::Version
684
740
  version: '0.1'
741
+ - !ruby/object:Gem::Dependency
742
+ name: plissken
743
+ requirement: !ruby/object:Gem::Requirement
744
+ requirements:
745
+ - - "~>"
746
+ - !ruby/object:Gem::Version
747
+ version: '1.4'
748
+ type: :runtime
749
+ prerelease: false
750
+ version_requirements: !ruby/object:Gem::Requirement
751
+ requirements:
752
+ - - "~>"
753
+ - !ruby/object:Gem::Version
754
+ version: '1.4'
685
755
  - !ruby/object:Gem::Dependency
686
756
  name: public_suffix
687
757
  requirement: !ruby/object:Gem::Requirement
@@ -716,14 +786,14 @@ dependencies:
716
786
  requirements:
717
787
  - - "~>"
718
788
  - !ruby/object:Gem::Version
719
- version: '5.4'
789
+ version: '5.5'
720
790
  type: :runtime
721
791
  prerelease: false
722
792
  version_requirements: !ruby/object:Gem::Requirement
723
793
  requirements:
724
794
  - - "~>"
725
795
  - !ruby/object:Gem::Version
726
- version: '5.4'
796
+ version: '5.5'
727
797
  - !ruby/object:Gem::Dependency
728
798
  name: rack
729
799
  requirement: !ruby/object:Gem::Requirement
@@ -753,7 +823,7 @@ dependencies:
753
823
  - !ruby/object:Gem::Version
754
824
  version: '2.3'
755
825
  - !ruby/object:Gem::Dependency
756
- name: safe_shell
826
+ name: rack-cors
757
827
  requirement: !ruby/object:Gem::Requirement
758
828
  requirements:
759
829
  - - "~>"
@@ -767,75 +837,47 @@ dependencies:
767
837
  - !ruby/object:Gem::Version
768
838
  version: '1.1'
769
839
  - !ruby/object:Gem::Dependency
770
- name: securitytrails
771
- requirement: !ruby/object:Gem::Requirement
772
- requirements:
773
- - - "~>"
774
- - !ruby/object:Gem::Version
775
- version: '1.0'
776
- type: :runtime
777
- prerelease: false
778
- version_requirements: !ruby/object:Gem::Requirement
779
- requirements:
780
- - - "~>"
781
- - !ruby/object:Gem::Version
782
- version: '1.0'
783
- - !ruby/object:Gem::Dependency
784
- name: shodanx
785
- requirement: !ruby/object:Gem::Requirement
786
- requirements:
787
- - - "~>"
788
- - !ruby/object:Gem::Version
789
- version: '0.2'
790
- type: :runtime
791
- prerelease: false
792
- version_requirements: !ruby/object:Gem::Requirement
793
- requirements:
794
- - - "~>"
795
- - !ruby/object:Gem::Version
796
- version: '0.2'
797
- - !ruby/object:Gem::Dependency
798
- name: sinatra
840
+ name: safe_shell
799
841
  requirement: !ruby/object:Gem::Requirement
800
842
  requirements:
801
843
  - - "~>"
802
844
  - !ruby/object:Gem::Version
803
- version: '2.1'
845
+ version: '1.1'
804
846
  type: :runtime
805
847
  prerelease: false
806
848
  version_requirements: !ruby/object:Gem::Requirement
807
849
  requirements:
808
850
  - - "~>"
809
851
  - !ruby/object:Gem::Version
810
- version: '2.1'
852
+ version: '1.1'
811
853
  - !ruby/object:Gem::Dependency
812
- name: sinatra-contrib
854
+ name: securitytrails
813
855
  requirement: !ruby/object:Gem::Requirement
814
856
  requirements:
815
857
  - - "~>"
816
858
  - !ruby/object:Gem::Version
817
- version: '2.1'
859
+ version: '1.0'
818
860
  type: :runtime
819
861
  prerelease: false
820
862
  version_requirements: !ruby/object:Gem::Requirement
821
863
  requirements:
822
864
  - - "~>"
823
865
  - !ruby/object:Gem::Version
824
- version: '2.1'
866
+ version: '1.0'
825
867
  - !ruby/object:Gem::Dependency
826
- name: sinatra-param
868
+ name: shodanx
827
869
  requirement: !ruby/object:Gem::Requirement
828
870
  requirements:
829
871
  - - "~>"
830
872
  - !ruby/object:Gem::Version
831
- version: '1.6'
873
+ version: '0.2'
832
874
  type: :runtime
833
875
  prerelease: false
834
876
  version_requirements: !ruby/object:Gem::Requirement
835
877
  requirements:
836
878
  - - "~>"
837
879
  - !ruby/object:Gem::Version
838
- version: '1.6'
880
+ version: '0.2'
839
881
  - !ruby/object:Gem::Dependency
840
882
  name: slack-notifier
841
883
  requirement: !ruby/object:Gem::Requirement
@@ -1112,15 +1154,8 @@ files:
1112
1154
  - lib/mihari/schemas/configuration.rb
1113
1155
  - lib/mihari/schemas/macros.rb
1114
1156
  - lib/mihari/schemas/rule.rb
1115
- - lib/mihari/serializers/alert.rb
1116
- - lib/mihari/serializers/artifact.rb
1117
- - lib/mihari/serializers/autonomous_system.rb
1118
- - lib/mihari/serializers/dns.rb
1119
- - lib/mihari/serializers/geolocation.rb
1120
- - lib/mihari/serializers/reverse_dns.rb
1121
- - lib/mihari/serializers/tag.rb
1122
- - lib/mihari/serializers/whois.rb
1123
1157
  - lib/mihari/status.rb
1158
+ - lib/mihari/structs/alert.rb
1124
1159
  - lib/mihari/structs/censys.rb
1125
1160
  - lib/mihari/structs/ipinfo.rb
1126
1161
  - lib/mihari/structs/onyphe.rb
@@ -1130,17 +1165,29 @@ files:
1130
1165
  - lib/mihari/type_checker.rb
1131
1166
  - lib/mihari/types.rb
1132
1167
  - lib/mihari/version.rb
1168
+ - lib/mihari/web/api.rb
1133
1169
  - lib/mihari/web/app.rb
1134
- - lib/mihari/web/controllers/alerts_controller.rb
1135
- - lib/mihari/web/controllers/analyzers_controller.rb
1136
- - lib/mihari/web/controllers/artifacts_controller.rb
1137
- - lib/mihari/web/controllers/base_controller.rb
1138
- - lib/mihari/web/controllers/command_controller.rb
1139
- - lib/mihari/web/controllers/config_controller.rb
1140
- - lib/mihari/web/controllers/ip_address_controller.rb
1141
- - lib/mihari/web/controllers/sources_controller.rb
1142
- - lib/mihari/web/controllers/tags_controller.rb
1143
- - lib/mihari/web/helpers/json.rb
1170
+ - lib/mihari/web/endpoints/alerts.rb
1171
+ - lib/mihari/web/endpoints/artifacts.rb
1172
+ - lib/mihari/web/endpoints/command.rb
1173
+ - lib/mihari/web/endpoints/configs.rb
1174
+ - lib/mihari/web/endpoints/ip_addresses.rb
1175
+ - lib/mihari/web/endpoints/sources.rb
1176
+ - lib/mihari/web/endpoints/tags.rb
1177
+ - lib/mihari/web/entities/alert.rb
1178
+ - lib/mihari/web/entities/artifact.rb
1179
+ - lib/mihari/web/entities/autonomous_system.rb
1180
+ - lib/mihari/web/entities/command.rb
1181
+ - lib/mihari/web/entities/config.rb
1182
+ - lib/mihari/web/entities/dns.rb
1183
+ - lib/mihari/web/entities/geolocation.rb
1184
+ - lib/mihari/web/entities/ip_address.rb
1185
+ - lib/mihari/web/entities/message.rb
1186
+ - lib/mihari/web/entities/reverse_dns.rb
1187
+ - lib/mihari/web/entities/source.rb
1188
+ - lib/mihari/web/entities/tag.rb
1189
+ - lib/mihari/web/entities/whois.rb
1190
+ - lib/mihari/web/public/grape.rb
1144
1191
  - lib/mihari/web/public/index.html
1145
1192
  - lib/mihari/web/public/redoc-static.html
1146
1193
  - lib/mihari/web/public/static/favicon.ico
@@ -1176,10 +1223,18 @@ files:
1176
1223
  - lib/mihari/web/public/static/img/fa-solid-900.37bc7099.svg
1177
1224
  - lib/mihari/web/public/static/js/app.06d5cf1c.js
1178
1225
  - lib/mihari/web/public/static/js/app.06d5cf1c.js.map
1226
+ - lib/mihari/web/public/static/js/app.14008741.js
1227
+ - lib/mihari/web/public/static/js/app.14008741.js.map
1179
1228
  - lib/mihari/web/public/static/js/app.365f1907.js
1180
1229
  - lib/mihari/web/public/static/js/app.365f1907.js.map
1230
+ - lib/mihari/web/public/static/js/app.378da3dc.js
1231
+ - lib/mihari/web/public/static/js/app.378da3dc.js.map
1232
+ - lib/mihari/web/public/static/js/app.6b636b62.js
1233
+ - lib/mihari/web/public/static/js/app.6b636b62.js.map
1181
1234
  - lib/mihari/web/public/static/js/app.8e3e5150.js
1182
1235
  - lib/mihari/web/public/static/js/app.8e3e5150.js.map
1236
+ - lib/mihari/web/public/static/js/app.a862ebca.js
1237
+ - lib/mihari/web/public/static/js/app.a862ebca.js.map
1183
1238
  - lib/mihari/web/public/static/js/app.ab213f7c.js
1184
1239
  - lib/mihari/web/public/static/js/app.ab213f7c.js.map
1185
1240
  - lib/mihari/web/public/static/js/app.b5914c39.js
@@ -1269,6 +1324,7 @@ files:
1269
1324
  - sig/lib/mihari/notifiers/exception_notifier.rbs
1270
1325
  - sig/lib/mihari/notifiers/slack.rbs
1271
1326
  - sig/lib/mihari/status.rbs
1327
+ - sig/lib/mihari/structs/alert.rbs
1272
1328
  - sig/lib/mihari/structs/censys.rbs
1273
1329
  - sig/lib/mihari/structs/ipinfo.rbs
1274
1330
  - sig/lib/mihari/structs/onyphe.rbs
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class AlertSerializer < ActiveModel::Serializer
8
- attributes :id, :title, :description, :source, :created_at
9
-
10
- has_many :artifacts, serializer: ArtifactSerializer
11
- has_many :tags, through: :taggings, serializer: TagSerializer
12
- end
13
- end
14
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class ArtifactSerializer < ActiveModel::Serializer
8
- attributes :id, :data, :data_type, :source
9
-
10
- has_one :autonomous_system, serializer: AutonomousSystemSerializer
11
- has_one :geolocation, serializer: GeolocationSerializer
12
- has_one :whois_record, serializer: WhoisRecordSerializer
13
-
14
- has_many :dns_records, serializer: DnsRecordSerializer
15
- has_many :reverse_dns_names, serializer: ReverseDnsNameSerializer
16
- end
17
- end
18
- end
@@ -1,9 +0,0 @@
1
- require "active_model_serializers"
2
-
3
- module Mihari
4
- module Serializers
5
- class AutonomousSystemSerializer < ActiveModel::Serializer
6
- attributes :asn
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class DnsRecordSerializer < ActiveModel::Serializer
8
- attributes :resource, :value
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class GeolocationSerializer < ActiveModel::Serializer
8
- attributes :country, :country_code
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class ReverseDnsNameSerializer < ActiveModel::Serializer
8
- attributes :name
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class TagSerializer < ActiveModel::Serializer
8
- attributes :id, :name
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_model_serializers"
4
-
5
- module Mihari
6
- module Serializers
7
- class WhoisRecordSerializer < ActiveModel::Serializer
8
- attributes :domain, :created_on, :updated_on, :expires_on, :registrar, :contacts
9
- end
10
- end
11
- end