mihari 5.0.1 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/docker/Dockerfile +1 -1
  4. data/lib/mihari/analyzers/binaryedge.rb +9 -7
  5. data/lib/mihari/analyzers/censys.rb +3 -5
  6. data/lib/mihari/analyzers/circl.rb +4 -6
  7. data/lib/mihari/analyzers/crtsh.rb +6 -7
  8. data/lib/mihari/analyzers/dnpedia.rb +3 -7
  9. data/lib/mihari/analyzers/dnstwister.rb +3 -5
  10. data/lib/mihari/analyzers/feed.rb +12 -10
  11. data/lib/mihari/analyzers/greynoise.rb +3 -5
  12. data/lib/mihari/analyzers/onyphe.rb +3 -4
  13. data/lib/mihari/analyzers/otx.rb +1 -3
  14. data/lib/mihari/analyzers/passivetotal.rb +5 -7
  15. data/lib/mihari/analyzers/pulsedive.rb +5 -7
  16. data/lib/mihari/analyzers/shodan.rb +3 -9
  17. data/lib/mihari/analyzers/urlscan.rb +7 -6
  18. data/lib/mihari/analyzers/virustotal.rb +4 -6
  19. data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -5
  20. data/lib/mihari/analyzers/zoomeye.rb +4 -10
  21. data/lib/mihari/cli/database.rb +11 -0
  22. data/lib/mihari/cli/main.rb +10 -4
  23. data/lib/mihari/cli/rule.rb +11 -0
  24. data/lib/mihari/clients/base.rb +53 -0
  25. data/lib/mihari/clients/binaryedge.rb +33 -0
  26. data/lib/mihari/clients/censys.rb +42 -0
  27. data/lib/mihari/clients/circl.rb +59 -0
  28. data/lib/mihari/clients/crtsh.rb +31 -0
  29. data/lib/mihari/clients/dnpedia.rb +64 -0
  30. data/lib/mihari/clients/dnstwister.rb +40 -0
  31. data/lib/mihari/clients/greynoise.rb +29 -0
  32. data/lib/mihari/clients/misp.rb +24 -0
  33. data/lib/mihari/clients/onyphe.rb +23 -0
  34. data/lib/mihari/clients/otx.rb +29 -0
  35. data/lib/mihari/clients/passivetotal.rb +65 -0
  36. data/lib/mihari/clients/publsedive.rb +39 -0
  37. data/lib/mihari/clients/shodan.rb +30 -0
  38. data/lib/mihari/clients/the_hive.rb +28 -0
  39. data/lib/mihari/clients/urlscan.rb +31 -0
  40. data/lib/mihari/clients/virustotal.rb +56 -0
  41. data/lib/mihari/clients/zoomeye.rb +68 -0
  42. data/lib/mihari/commands/database.rb +28 -0
  43. data/lib/mihari/commands/{initializer.rb → rule.rb} +27 -6
  44. data/lib/mihari/commands/searcher.rb +5 -0
  45. data/lib/mihari/database.rb +8 -22
  46. data/lib/mihari/emitters/misp.rb +13 -20
  47. data/lib/mihari/emitters/the_hive.rb +3 -5
  48. data/lib/mihari/emitters/webhook.rb +2 -2
  49. data/lib/mihari/feed/reader.rb +14 -11
  50. data/lib/mihari/http.rb +29 -21
  51. data/lib/mihari/mixins/database.rb +2 -0
  52. data/lib/mihari/mixins/retriable.rb +3 -1
  53. data/lib/mihari/schemas/analyzer.rb +5 -4
  54. data/lib/mihari/version.rb +1 -1
  55. data/lib/mihari.rb +21 -0
  56. data/mihari.gemspec +14 -20
  57. metadata +61 -238
  58. data/lib/mihari/analyzers/clients/otx.rb +0 -36
  59. data/lib/mihari/commands/validator.rb +0 -31
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: 5.0.1
4
+ version: 5.1.1
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-02-19 00:00:00.000000000 Z
11
+ date: 2023-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,33 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.4'
55
55
  - !ruby/object:Gem::Dependency
56
- name: mysql2
56
+ name: fuubar
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.5'
61
+ version: '2.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.5'
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
- name: overcommit
70
+ name: mysql2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.60'
75
+ version: '0.5'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.60'
82
+ version: '0.5'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pg
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '1.24'
195
- - !ruby/object:Gem::Dependency
196
- name: steep
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '1.3'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '1.3'
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: timecop
211
197
  requirement: !ruby/object:Gem::Requirement
@@ -249,117 +235,89 @@ dependencies:
249
235
  - !ruby/object:Gem::Version
250
236
  version: '3.18'
251
237
  - !ruby/object:Gem::Dependency
252
- name: activerecord
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - '='
256
- - !ruby/object:Gem::Version
257
- version: 7.0.4.2
258
- type: :runtime
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - '='
263
- - !ruby/object:Gem::Version
264
- version: 7.0.4.2
265
- - !ruby/object:Gem::Dependency
266
- name: addressable
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - '='
270
- - !ruby/object:Gem::Version
271
- version: 2.8.1
272
- type: :runtime
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - '='
277
- - !ruby/object:Gem::Version
278
- version: 2.8.1
279
- - !ruby/object:Gem::Dependency
280
- name: awrence
238
+ name: overcommit
281
239
  requirement: !ruby/object:Gem::Requirement
282
240
  requirements:
283
- - - '='
241
+ - - "~>"
284
242
  - !ruby/object:Gem::Version
285
- version: 2.0.1
286
- type: :runtime
243
+ version: '0.60'
244
+ type: :development
287
245
  prerelease: false
288
246
  version_requirements: !ruby/object:Gem::Requirement
289
247
  requirements:
290
- - - '='
248
+ - - "~>"
291
249
  - !ruby/object:Gem::Version
292
- version: 2.0.1
250
+ version: '0.60'
293
251
  - !ruby/object:Gem::Dependency
294
- name: binaryedge
252
+ name: ruby-lsp
295
253
  requirement: !ruby/object:Gem::Requirement
296
254
  requirements:
297
- - - '='
255
+ - - "~>"
298
256
  - !ruby/object:Gem::Version
299
- version: 0.1.0
300
- type: :runtime
257
+ version: '0.4'
258
+ type: :development
301
259
  prerelease: false
302
260
  version_requirements: !ruby/object:Gem::Requirement
303
261
  requirements:
304
- - - '='
262
+ - - "~>"
305
263
  - !ruby/object:Gem::Version
306
- version: 0.1.0
264
+ version: '0.4'
307
265
  - !ruby/object:Gem::Dependency
308
- name: censysx
266
+ name: steep
309
267
  requirement: !ruby/object:Gem::Requirement
310
268
  requirements:
311
- - - '='
269
+ - - "~>"
312
270
  - !ruby/object:Gem::Version
313
- version: 0.1.1
314
- type: :runtime
271
+ version: '1.3'
272
+ type: :development
315
273
  prerelease: false
316
274
  version_requirements: !ruby/object:Gem::Requirement
317
275
  requirements:
318
- - - '='
276
+ - - "~>"
319
277
  - !ruby/object:Gem::Version
320
- version: 0.1.1
278
+ version: '1.3'
321
279
  - !ruby/object:Gem::Dependency
322
- name: crtsh-rb
280
+ name: activerecord
323
281
  requirement: !ruby/object:Gem::Requirement
324
282
  requirements:
325
283
  - - '='
326
284
  - !ruby/object:Gem::Version
327
- version: 0.3.1
285
+ version: 7.0.4.2
328
286
  type: :runtime
329
287
  prerelease: false
330
288
  version_requirements: !ruby/object:Gem::Requirement
331
289
  requirements:
332
290
  - - '='
333
291
  - !ruby/object:Gem::Version
334
- version: 0.3.1
292
+ version: 7.0.4.2
335
293
  - !ruby/object:Gem::Dependency
336
- name: dnpedia
294
+ name: addressable
337
295
  requirement: !ruby/object:Gem::Requirement
338
296
  requirements:
339
297
  - - '='
340
298
  - !ruby/object:Gem::Version
341
- version: 0.1.0
299
+ version: 2.8.1
342
300
  type: :runtime
343
301
  prerelease: false
344
302
  version_requirements: !ruby/object:Gem::Requirement
345
303
  requirements:
346
304
  - - '='
347
305
  - !ruby/object:Gem::Version
348
- version: 0.1.0
306
+ version: 2.8.1
349
307
  - !ruby/object:Gem::Dependency
350
- name: dnstwister
308
+ name: awrence
351
309
  requirement: !ruby/object:Gem::Requirement
352
310
  requirements:
353
311
  - - '='
354
312
  - !ruby/object:Gem::Version
355
- version: 0.1.0
313
+ version: 2.0.1
356
314
  type: :runtime
357
315
  prerelease: false
358
316
  version_requirements: !ruby/object:Gem::Requirement
359
317
  requirements:
360
318
  - - '='
361
319
  - !ruby/object:Gem::Version
362
- version: 0.1.0
320
+ version: 2.0.1
363
321
  - !ruby/object:Gem::Dependency
364
322
  name: dotenv
365
323
  requirement: !ruby/object:Gem::Requirement
@@ -542,34 +500,6 @@ dependencies:
542
500
  - - '='
543
501
  - !ruby/object:Gem::Version
544
502
  version: 0.5.1
545
- - !ruby/object:Gem::Dependency
546
- name: greynoise
547
- requirement: !ruby/object:Gem::Requirement
548
- requirements:
549
- - - '='
550
- - !ruby/object:Gem::Version
551
- version: 0.1.1
552
- type: :runtime
553
- prerelease: false
554
- version_requirements: !ruby/object:Gem::Requirement
555
- requirements:
556
- - - '='
557
- - !ruby/object:Gem::Version
558
- version: 0.1.1
559
- - !ruby/object:Gem::Dependency
560
- name: hachi
561
- requirement: !ruby/object:Gem::Requirement
562
- requirements:
563
- - - '='
564
- - !ruby/object:Gem::Version
565
- version: 2.0.0
566
- type: :runtime
567
- prerelease: false
568
- version_requirements: !ruby/object:Gem::Requirement
569
- requirements:
570
- - - '='
571
- - !ruby/object:Gem::Version
572
- version: 2.0.0
573
503
  - !ruby/object:Gem::Dependency
574
504
  name: insensitive_hash
575
505
  requirement: !ruby/object:Gem::Requirement
@@ -626,20 +556,6 @@ dependencies:
626
556
  - - '='
627
557
  - !ruby/object:Gem::Version
628
558
  version: 2.0.2
629
- - !ruby/object:Gem::Dependency
630
- name: misp
631
- requirement: !ruby/object:Gem::Requirement
632
- requirements:
633
- - - '='
634
- - !ruby/object:Gem::Version
635
- version: 0.1.4
636
- type: :runtime
637
- prerelease: false
638
- version_requirements: !ruby/object:Gem::Requirement
639
- requirements:
640
- - - '='
641
- - !ruby/object:Gem::Version
642
- version: 0.1.4
643
559
  - !ruby/object:Gem::Dependency
644
560
  name: net-ping
645
561
  requirement: !ruby/object:Gem::Requirement
@@ -668,20 +584,6 @@ dependencies:
668
584
  - - '='
669
585
  - !ruby/object:Gem::Version
670
586
  version: 0.3.2
671
- - !ruby/object:Gem::Dependency
672
- name: onyphe
673
- requirement: !ruby/object:Gem::Requirement
674
- requirements:
675
- - - '='
676
- - !ruby/object:Gem::Version
677
- version: 2.0.0
678
- type: :runtime
679
- prerelease: false
680
- version_requirements: !ruby/object:Gem::Requirement
681
- requirements:
682
- - - '='
683
- - !ruby/object:Gem::Version
684
- version: 2.0.0
685
587
  - !ruby/object:Gem::Dependency
686
588
  name: parallel
687
589
  requirement: !ruby/object:Gem::Requirement
@@ -696,34 +598,6 @@ dependencies:
696
598
  - - '='
697
599
  - !ruby/object:Gem::Version
698
600
  version: 1.22.1
699
- - !ruby/object:Gem::Dependency
700
- name: passive_circl
701
- requirement: !ruby/object:Gem::Requirement
702
- requirements:
703
- - - '='
704
- - !ruby/object:Gem::Version
705
- version: 0.1.0
706
- type: :runtime
707
- prerelease: false
708
- version_requirements: !ruby/object:Gem::Requirement
709
- requirements:
710
- - - '='
711
- - !ruby/object:Gem::Version
712
- version: 0.1.0
713
- - !ruby/object:Gem::Dependency
714
- name: passivetotalx
715
- requirement: !ruby/object:Gem::Requirement
716
- requirements:
717
- - - '='
718
- - !ruby/object:Gem::Version
719
- version: 0.1.1
720
- type: :runtime
721
- prerelease: false
722
- version_requirements: !ruby/object:Gem::Requirement
723
- requirements:
724
- - - '='
725
- - !ruby/object:Gem::Version
726
- version: 0.1.1
727
601
  - !ruby/object:Gem::Dependency
728
602
  name: plissken
729
603
  requirement: !ruby/object:Gem::Requirement
@@ -752,20 +626,6 @@ dependencies:
752
626
  - - '='
753
627
  - !ruby/object:Gem::Version
754
628
  version: 5.0.1
755
- - !ruby/object:Gem::Dependency
756
- name: pulsedive
757
- requirement: !ruby/object:Gem::Requirement
758
- requirements:
759
- - - '='
760
- - !ruby/object:Gem::Version
761
- version: 0.1.5
762
- type: :runtime
763
- prerelease: false
764
- version_requirements: !ruby/object:Gem::Requirement
765
- requirements:
766
- - - '='
767
- - !ruby/object:Gem::Version
768
- version: 0.1.5
769
629
  - !ruby/object:Gem::Dependency
770
630
  name: puma
771
631
  requirement: !ruby/object:Gem::Requirement
@@ -856,28 +716,14 @@ dependencies:
856
716
  requirements:
857
717
  - - '='
858
718
  - !ruby/object:Gem::Version
859
- version: 5.7.0
719
+ version: 5.8.0
860
720
  type: :runtime
861
721
  prerelease: false
862
722
  version_requirements: !ruby/object:Gem::Requirement
863
723
  requirements:
864
724
  - - '='
865
725
  - !ruby/object:Gem::Version
866
- version: 5.7.0
867
- - !ruby/object:Gem::Dependency
868
- name: shodanx
869
- requirement: !ruby/object:Gem::Requirement
870
- requirements:
871
- - - '='
872
- - !ruby/object:Gem::Version
873
- version: 0.2.1
874
- type: :runtime
875
- prerelease: false
876
- version_requirements: !ruby/object:Gem::Requirement
877
- requirements:
878
- - - '='
879
- - !ruby/object:Gem::Version
880
- version: 0.2.1
726
+ version: 5.8.0
881
727
  - !ruby/object:Gem::Dependency
882
728
  name: slack-notifier
883
729
  requirement: !ruby/object:Gem::Requirement
@@ -898,14 +744,14 @@ dependencies:
898
744
  requirements:
899
745
  - - '='
900
746
  - !ruby/object:Gem::Version
901
- version: 1.6.0
747
+ version: 1.6.1
902
748
  type: :runtime
903
749
  prerelease: false
904
750
  version_requirements: !ruby/object:Gem::Requirement
905
751
  requirements:
906
752
  - - '='
907
753
  - !ruby/object:Gem::Version
908
- version: 1.6.0
754
+ version: 1.6.1
909
755
  - !ruby/object:Gem::Dependency
910
756
  name: thor
911
757
  requirement: !ruby/object:Gem::Requirement
@@ -920,20 +766,6 @@ dependencies:
920
766
  - - '='
921
767
  - !ruby/object:Gem::Version
922
768
  version: 1.2.1
923
- - !ruby/object:Gem::Dependency
924
- name: urlscan
925
- requirement: !ruby/object:Gem::Requirement
926
- requirements:
927
- - - '='
928
- - !ruby/object:Gem::Version
929
- version: 0.8.0
930
- type: :runtime
931
- prerelease: false
932
- version_requirements: !ruby/object:Gem::Requirement
933
- requirements:
934
- - - '='
935
- - !ruby/object:Gem::Version
936
- version: 0.8.0
937
769
  - !ruby/object:Gem::Dependency
938
770
  name: uuidtools
939
771
  requirement: !ruby/object:Gem::Requirement
@@ -948,20 +780,6 @@ dependencies:
948
780
  - - '='
949
781
  - !ruby/object:Gem::Version
950
782
  version: 2.2.0
951
- - !ruby/object:Gem::Dependency
952
- name: virustotalx
953
- requirement: !ruby/object:Gem::Requirement
954
- requirements:
955
- - - '='
956
- - !ruby/object:Gem::Version
957
- version: 1.2.0
958
- type: :runtime
959
- prerelease: false
960
- version_requirements: !ruby/object:Gem::Requirement
961
- requirements:
962
- - - '='
963
- - !ruby/object:Gem::Version
964
- version: 1.2.0
965
783
  - !ruby/object:Gem::Dependency
966
784
  name: whois
967
785
  requirement: !ruby/object:Gem::Requirement
@@ -990,20 +808,6 @@ dependencies:
990
808
  - - '='
991
809
  - !ruby/object:Gem::Version
992
810
  version: 2.0.0
993
- - !ruby/object:Gem::Dependency
994
- name: zoomeye-rb
995
- requirement: !ruby/object:Gem::Requirement
996
- requirements:
997
- - - '='
998
- - !ruby/object:Gem::Version
999
- version: 0.2.0
1000
- type: :runtime
1001
- prerelease: false
1002
- version_requirements: !ruby/object:Gem::Requirement
1003
- requirements:
1004
- - - '='
1005
- - !ruby/object:Gem::Version
1006
- version: 0.2.0
1007
811
  description:
1008
812
  email:
1009
813
  - manabu.niseki@gmail.com
@@ -1048,7 +852,6 @@ files:
1048
852
  - lib/mihari/analyzers/binaryedge.rb
1049
853
  - lib/mihari/analyzers/censys.rb
1050
854
  - lib/mihari/analyzers/circl.rb
1051
- - lib/mihari/analyzers/clients/otx.rb
1052
855
  - lib/mihari/analyzers/crtsh.rb
1053
856
  - lib/mihari/analyzers/dnpedia.rb
1054
857
  - lib/mihari/analyzers/dnstwister.rb
@@ -1066,10 +869,30 @@ files:
1066
869
  - lib/mihari/analyzers/virustotal_intelligence.rb
1067
870
  - lib/mihari/analyzers/zoomeye.rb
1068
871
  - lib/mihari/cli/base.rb
872
+ - lib/mihari/cli/database.rb
1069
873
  - lib/mihari/cli/main.rb
1070
- - lib/mihari/commands/initializer.rb
874
+ - lib/mihari/cli/rule.rb
875
+ - lib/mihari/clients/base.rb
876
+ - lib/mihari/clients/binaryedge.rb
877
+ - lib/mihari/clients/censys.rb
878
+ - lib/mihari/clients/circl.rb
879
+ - lib/mihari/clients/crtsh.rb
880
+ - lib/mihari/clients/dnpedia.rb
881
+ - lib/mihari/clients/dnstwister.rb
882
+ - lib/mihari/clients/greynoise.rb
883
+ - lib/mihari/clients/misp.rb
884
+ - lib/mihari/clients/onyphe.rb
885
+ - lib/mihari/clients/otx.rb
886
+ - lib/mihari/clients/passivetotal.rb
887
+ - lib/mihari/clients/publsedive.rb
888
+ - lib/mihari/clients/shodan.rb
889
+ - lib/mihari/clients/the_hive.rb
890
+ - lib/mihari/clients/urlscan.rb
891
+ - lib/mihari/clients/virustotal.rb
892
+ - lib/mihari/clients/zoomeye.rb
893
+ - lib/mihari/commands/database.rb
894
+ - lib/mihari/commands/rule.rb
1071
895
  - lib/mihari/commands/searcher.rb
1072
- - lib/mihari/commands/validator.rb
1073
896
  - lib/mihari/commands/version.rb
1074
897
  - lib/mihari/commands/web.rb
1075
898
  - lib/mihari/constants.rb
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Analyzers
5
- module Clients
6
- class OTX
7
- attr_reader :api_key
8
-
9
- def initialize(api_key)
10
- @api_key = api_key
11
- end
12
-
13
- def query_by_ip(ip)
14
- get "https://otx.alienvault.com/api/v1/indicators/IPv4/#{ip}/passive_dns"
15
- end
16
-
17
- def query_by_domain(domain)
18
- get "https://otx.alienvault.com/api/v1/indicators/domain/#{domain}/passive_dns"
19
- end
20
-
21
- private
22
-
23
- def headers
24
- { "x-otx-api-key": api_key }
25
- end
26
-
27
- def get(url)
28
- res = HTTP.get(url, headers: headers)
29
- JSON.parse(res.body.to_s)
30
- rescue HTTPError
31
- nil
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Validator
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "validate [PATH]", "Validate a rule file"
9
- #
10
- # Validate format of a rule
11
- #
12
- # @param [String] path
13
- #
14
- # @return [nil]
15
- #
16
- def validate(path)
17
- rule = Structs::Rule.from_path_or_id(path)
18
-
19
- begin
20
- rule.validate!
21
- Mihari.logger.info "Valid format. The input is parsed as the following:"
22
- Mihari.logger.info rule.data.to_yaml
23
- rescue RuleValidationError
24
- nil
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end