mihari 3.12.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mihari/analyzers/base.rb +6 -6
  3. data/lib/mihari/analyzers/binaryedge.rb +3 -5
  4. data/lib/mihari/analyzers/censys.rb +1 -3
  5. data/lib/mihari/analyzers/circl.rb +0 -3
  6. data/lib/mihari/analyzers/crtsh.rb +7 -5
  7. data/lib/mihari/analyzers/dnpedia.rb +4 -4
  8. data/lib/mihari/analyzers/dnstwister.rb +1 -4
  9. data/lib/mihari/analyzers/feed.rb +0 -3
  10. data/lib/mihari/analyzers/greynoise.rb +1 -3
  11. data/lib/mihari/analyzers/onyphe.rb +1 -3
  12. data/lib/mihari/analyzers/otx.rb +0 -3
  13. data/lib/mihari/analyzers/passivetotal.rb +8 -9
  14. data/lib/mihari/analyzers/pulsedive.rb +7 -5
  15. data/lib/mihari/analyzers/rule.rb +5 -6
  16. data/lib/mihari/analyzers/securitytrails.rb +10 -7
  17. data/lib/mihari/analyzers/shodan.rb +2 -4
  18. data/lib/mihari/analyzers/spyse.rb +10 -11
  19. data/lib/mihari/analyzers/urlscan.rb +5 -6
  20. data/lib/mihari/analyzers/virustotal.rb +8 -9
  21. data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -5
  22. data/lib/mihari/analyzers/zoomeye.rb +4 -5
  23. data/lib/mihari/cli/base.rb +0 -5
  24. data/lib/mihari/cli/init.rb +0 -2
  25. data/lib/mihari/cli/main.rb +4 -6
  26. data/lib/mihari/cli/mixins/utils.rb +2 -18
  27. data/lib/mihari/commands/init.rb +0 -18
  28. data/lib/mihari/commands/search.rb +20 -15
  29. data/lib/mihari/commands/validator.rb +7 -19
  30. data/lib/mihari/commands/web.rb +0 -3
  31. data/lib/mihari/database.rb +67 -15
  32. data/lib/mihari/emitters/misp.rb +0 -1
  33. data/lib/mihari/emitters/slack.rb +3 -4
  34. data/lib/mihari/emitters/stdout.rb +0 -2
  35. data/lib/mihari/emitters/the_hive.rb +0 -1
  36. data/lib/mihari/emitters/webhook.rb +1 -5
  37. data/lib/mihari/enrichers/ipinfo.rb +0 -2
  38. data/lib/mihari/errors.rb +2 -0
  39. data/lib/mihari/feed/reader.rb +22 -8
  40. data/lib/mihari/mixins/database.rb +14 -0
  41. data/lib/mihari/mixins/disallowed_data_value.rb +1 -4
  42. data/lib/mihari/mixins/rule.rb +34 -31
  43. data/lib/mihari/models/alert.rb +3 -3
  44. data/lib/mihari/models/artifact.rb +0 -5
  45. data/lib/mihari/models/autonomous_system.rb +0 -2
  46. data/lib/mihari/models/dns.rb +0 -3
  47. data/lib/mihari/models/geolocation.rb +0 -1
  48. data/lib/mihari/models/reverse_dns.rb +0 -3
  49. data/lib/mihari/models/rule.rb +73 -0
  50. data/lib/mihari/models/tag.rb +0 -2
  51. data/lib/mihari/models/tagging.rb +0 -2
  52. data/lib/mihari/models/whois.rb +0 -2
  53. data/lib/mihari/notifiers/exception_notifier.rb +0 -2
  54. data/lib/mihari/schemas/analyzer.rb +0 -5
  55. data/lib/mihari/schemas/macros.rb +0 -2
  56. data/lib/mihari/schemas/rule.rb +0 -5
  57. data/lib/mihari/structs/alert.rb +0 -3
  58. data/lib/mihari/structs/censys.rb +3 -4
  59. data/lib/mihari/structs/greynoise.rb +3 -4
  60. data/lib/mihari/structs/ipinfo.rb +0 -3
  61. data/lib/mihari/structs/onyphe.rb +5 -6
  62. data/lib/mihari/structs/rule.rb +121 -0
  63. data/lib/mihari/structs/shodan.rb +3 -4
  64. data/lib/mihari/structs/urlscan.rb +0 -3
  65. data/lib/mihari/structs/virustotal_intelligence.rb +3 -4
  66. data/lib/mihari/type_checker.rb +2 -6
  67. data/lib/mihari/types.rb +0 -2
  68. data/lib/mihari/version.rb +1 -1
  69. data/lib/mihari/web/api.rb +4 -0
  70. data/lib/mihari/web/app.rb +5 -7
  71. data/lib/mihari/web/endpoints/alerts.rb +7 -3
  72. data/lib/mihari/web/endpoints/artifacts.rb +6 -3
  73. data/lib/mihari/web/endpoints/command.rb +2 -1
  74. data/lib/mihari/web/endpoints/configs.rb +2 -1
  75. data/lib/mihari/web/endpoints/ip_addresses.rb +2 -1
  76. data/lib/mihari/web/endpoints/rules.rb +140 -0
  77. data/lib/mihari/web/endpoints/sources.rb +2 -1
  78. data/lib/mihari/web/endpoints/tags.rb +4 -2
  79. data/lib/mihari/web/entities/artifact.rb +2 -0
  80. data/lib/mihari/web/entities/rule.rb +35 -0
  81. data/lib/mihari/web/middleware/connection_adapter.rb +19 -0
  82. data/lib/mihari/web/public/index.html +1 -1
  83. data/lib/mihari/web/public/redoc-static.html +35 -21
  84. data/lib/mihari/web/public/static/js/app.49ab738a.js +21 -0
  85. data/lib/mihari/web/public/static/js/app.49ab738a.js.map +1 -0
  86. data/lib/mihari.rb +40 -34
  87. data/mihari.gemspec +3 -5
  88. data/sig/lib/mihari/analyzers/binaryedge.rbs +0 -3
  89. data/sig/lib/mihari/analyzers/censys.rbs +0 -3
  90. data/sig/lib/mihari/analyzers/circl.rbs +1 -3
  91. data/sig/lib/mihari/analyzers/crtsh.rbs +1 -3
  92. data/sig/lib/mihari/analyzers/dnpedia.rbs +1 -4
  93. data/sig/lib/mihari/analyzers/dnstwister.rbs +1 -3
  94. data/sig/lib/mihari/analyzers/feed.rbs +0 -3
  95. data/sig/lib/mihari/analyzers/onyphe.rbs +0 -3
  96. data/sig/lib/mihari/analyzers/otx.rbs +1 -3
  97. data/sig/lib/mihari/analyzers/passivetotal.rbs +3 -5
  98. data/sig/lib/mihari/analyzers/pulsedive.rbs +2 -4
  99. data/sig/lib/mihari/analyzers/securitytrails.rbs +3 -5
  100. data/sig/lib/mihari/analyzers/shodan.rbs +0 -3
  101. data/sig/lib/mihari/analyzers/spyse.rbs +4 -6
  102. data/sig/lib/mihari/analyzers/urlscan.rbs +1 -3
  103. data/sig/lib/mihari/analyzers/virustotal.rbs +4 -6
  104. data/sig/lib/mihari/analyzers/virustotal_intelligence.rbs +0 -3
  105. data/sig/lib/mihari/analyzers/zoomeye.rbs +2 -4
  106. data/sig/lib/mihari/commands/init.rbs +0 -2
  107. data/sig/lib/mihari/commands/validator.rbs +0 -2
  108. data/sig/lib/mihari/emitters/slack.rbs +0 -1
  109. data/sig/lib/mihari/feed/reader.rbs +1 -1
  110. data/sig/lib/mihari/mixins/disallowed_data_value.rbs +0 -2
  111. data/sig/lib/mihari/mixins/rule.rbs +5 -12
  112. data/sig/lib/mihari/models/alert.rbs +1 -1
  113. data/sig/lib/mihari/models/artifact.rbs +2 -0
  114. data/sig/lib/mihari/models/rule.rbs +14 -0
  115. data/sig/lib/mihari/structs/rule.rbs +56 -0
  116. data/sig/lib/mihari.rbs +0 -2
  117. metadata +18 -79
  118. data/lib/mihari/cli/analyzer.rb +0 -55
  119. data/lib/mihari/commands/binaryedge.rb +0 -21
  120. data/lib/mihari/commands/censys.rb +0 -22
  121. data/lib/mihari/commands/circl.rb +0 -21
  122. data/lib/mihari/commands/crtsh.rb +0 -22
  123. data/lib/mihari/commands/dnpedia.rb +0 -21
  124. data/lib/mihari/commands/dnstwister.rb +0 -21
  125. data/lib/mihari/commands/feed.rb +0 -26
  126. data/lib/mihari/commands/greynoise.rb +0 -21
  127. data/lib/mihari/commands/json.rb +0 -42
  128. data/lib/mihari/commands/onyphe.rb +0 -21
  129. data/lib/mihari/commands/otx.rb +0 -21
  130. data/lib/mihari/commands/passivetotal.rb +0 -22
  131. data/lib/mihari/commands/pulsedive.rb +0 -21
  132. data/lib/mihari/commands/securitytrails.rb +0 -22
  133. data/lib/mihari/commands/shodan.rb +0 -21
  134. data/lib/mihari/commands/spyse.rb +0 -22
  135. data/lib/mihari/commands/urlscan.rb +0 -22
  136. data/lib/mihari/commands/virustotal.rb +0 -22
  137. data/lib/mihari/commands/virustotal_intelligence.rb +0 -22
  138. data/lib/mihari/commands/zoomeye.rb +0 -22
  139. data/lib/mihari/mixins/configuration.rb +0 -100
  140. data/lib/mihari/mixins/hash.rb +0 -20
  141. data/lib/mihari/schemas/configuration.rb +0 -44
  142. data/lib/mihari/web/public/grape.rb +0 -73
  143. data/sig/lib/mihari/cli/analyzer.rbs +0 -43
  144. data/sig/lib/mihari/commands/binaryedge.rbs +0 -7
  145. data/sig/lib/mihari/commands/censys.rbs +0 -7
  146. data/sig/lib/mihari/commands/circl.rbs +0 -7
  147. data/sig/lib/mihari/commands/crtsh.rbs +0 -7
  148. data/sig/lib/mihari/commands/dnpedia.rbs +0 -7
  149. data/sig/lib/mihari/commands/dnstwister.rbs +0 -7
  150. data/sig/lib/mihari/commands/feed.rbs +0 -7
  151. data/sig/lib/mihari/commands/onyphe.rbs +0 -7
  152. data/sig/lib/mihari/commands/otx.rbs +0 -7
  153. data/sig/lib/mihari/commands/passivetotal.rbs +0 -7
  154. data/sig/lib/mihari/commands/pulsedive.rbs +0 -7
  155. data/sig/lib/mihari/commands/securitytrails.rbs +0 -7
  156. data/sig/lib/mihari/commands/shodan.rbs +0 -7
  157. data/sig/lib/mihari/commands/spyse.rbs +0 -7
  158. data/sig/lib/mihari/commands/urlscan.rbs +0 -7
  159. data/sig/lib/mihari/commands/virustotal.rbs +0 -7
  160. data/sig/lib/mihari/commands/zoomeye.rbs +0 -7
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.12.0
4
+ version: 4.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: 2022-01-03 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - '='
242
242
  - !ruby/object:Gem::Version
243
- version: 7.0.0
243
+ version: 7.0.1
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - '='
249
249
  - !ruby/object:Gem::Version
250
- version: 7.0.0
250
+ version: 7.0.1
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: addressable
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -332,20 +332,6 @@ dependencies:
332
332
  - - "~>"
333
333
  - !ruby/object:Gem::Version
334
334
  version: '0.3'
335
- - !ruby/object:Gem::Dependency
336
- name: cymbal
337
- requirement: !ruby/object:Gem::Requirement
338
- requirements:
339
- - - "~>"
340
- - !ruby/object:Gem::Version
341
- version: '2.0'
342
- type: :runtime
343
- prerelease: false
344
- version_requirements: !ruby/object:Gem::Requirement
345
- requirements:
346
- - - "~>"
347
- - !ruby/object:Gem::Version
348
- version: '2.0'
349
335
  - !ruby/object:Gem::Dependency
350
336
  name: dnpedia
351
337
  requirement: !ruby/object:Gem::Requirement
@@ -394,14 +380,14 @@ dependencies:
394
380
  requirements:
395
381
  - - '='
396
382
  - !ruby/object:Gem::Version
397
- version: 0.13.0
383
+ version: 0.14.0
398
384
  type: :runtime
399
385
  prerelease: false
400
386
  version_requirements: !ruby/object:Gem::Requirement
401
387
  requirements:
402
388
  - - '='
403
389
  - !ruby/object:Gem::Version
404
- version: 0.13.0
390
+ version: 0.14.0
405
391
  - !ruby/object:Gem::Dependency
406
392
  name: dry-container
407
393
  requirement: !ruby/object:Gem::Requirement
@@ -436,14 +422,14 @@ dependencies:
436
422
  requirements:
437
423
  - - '='
438
424
  - !ruby/object:Gem::Version
439
- version: 3.0.4
425
+ version: 3.1.1
440
426
  type: :runtime
441
427
  prerelease: false
442
428
  version_requirements: !ruby/object:Gem::Requirement
443
429
  requirements:
444
430
  - - '='
445
431
  - !ruby/object:Gem::Version
446
- version: 3.0.4
432
+ version: 3.1.1
447
433
  - !ruby/object:Gem::Dependency
448
434
  name: dry-struct
449
435
  requirement: !ruby/object:Gem::Requirement
@@ -612,20 +598,6 @@ dependencies:
612
598
  - - "~>"
613
599
  - !ruby/object:Gem::Version
614
600
  version: '2.5'
615
- - !ruby/object:Gem::Dependency
616
- name: mem
617
- requirement: !ruby/object:Gem::Requirement
618
- requirements:
619
- - - "~>"
620
- - !ruby/object:Gem::Version
621
- version: '0.1'
622
- type: :runtime
623
- prerelease: false
624
- version_requirements: !ruby/object:Gem::Requirement
625
- requirements:
626
- - - "~>"
627
- - !ruby/object:Gem::Version
628
- version: '0.1'
629
601
  - !ruby/object:Gem::Dependency
630
602
  name: memist
631
603
  requirement: !ruby/object:Gem::Requirement
@@ -1106,36 +1078,15 @@ files:
1106
1078
  - lib/mihari/analyzers/virustotal.rb
1107
1079
  - lib/mihari/analyzers/virustotal_intelligence.rb
1108
1080
  - lib/mihari/analyzers/zoomeye.rb
1109
- - lib/mihari/cli/analyzer.rb
1110
1081
  - lib/mihari/cli/base.rb
1111
1082
  - lib/mihari/cli/init.rb
1112
1083
  - lib/mihari/cli/main.rb
1113
1084
  - lib/mihari/cli/mixins/utils.rb
1114
1085
  - lib/mihari/cli/validator.rb
1115
- - lib/mihari/commands/binaryedge.rb
1116
- - lib/mihari/commands/censys.rb
1117
- - lib/mihari/commands/circl.rb
1118
- - lib/mihari/commands/crtsh.rb
1119
- - lib/mihari/commands/dnpedia.rb
1120
- - lib/mihari/commands/dnstwister.rb
1121
- - lib/mihari/commands/feed.rb
1122
- - lib/mihari/commands/greynoise.rb
1123
1086
  - lib/mihari/commands/init.rb
1124
- - lib/mihari/commands/json.rb
1125
- - lib/mihari/commands/onyphe.rb
1126
- - lib/mihari/commands/otx.rb
1127
- - lib/mihari/commands/passivetotal.rb
1128
- - lib/mihari/commands/pulsedive.rb
1129
1087
  - lib/mihari/commands/search.rb
1130
- - lib/mihari/commands/securitytrails.rb
1131
- - lib/mihari/commands/shodan.rb
1132
- - lib/mihari/commands/spyse.rb
1133
- - lib/mihari/commands/urlscan.rb
1134
1088
  - lib/mihari/commands/validator.rb
1135
- - lib/mihari/commands/virustotal.rb
1136
- - lib/mihari/commands/virustotal_intelligence.rb
1137
1089
  - lib/mihari/commands/web.rb
1138
- - lib/mihari/commands/zoomeye.rb
1139
1090
  - lib/mihari/constants.rb
1140
1091
  - lib/mihari/database.rb
1141
1092
  - lib/mihari/emitters/base.rb
@@ -1152,9 +1103,8 @@ files:
1152
1103
  - lib/mihari/feed/reader.rb
1153
1104
  - lib/mihari/mixins/autonomous_system.rb
1154
1105
  - lib/mihari/mixins/configurable.rb
1155
- - lib/mihari/mixins/configuration.rb
1106
+ - lib/mihari/mixins/database.rb
1156
1107
  - lib/mihari/mixins/disallowed_data_value.rb
1157
- - lib/mihari/mixins/hash.rb
1158
1108
  - lib/mihari/mixins/refang.rb
1159
1109
  - lib/mihari/mixins/retriable.rb
1160
1110
  - lib/mihari/mixins/rule.rb
@@ -1164,6 +1114,7 @@ files:
1164
1114
  - lib/mihari/models/dns.rb
1165
1115
  - lib/mihari/models/geolocation.rb
1166
1116
  - lib/mihari/models/reverse_dns.rb
1117
+ - lib/mihari/models/rule.rb
1167
1118
  - lib/mihari/models/tag.rb
1168
1119
  - lib/mihari/models/tagging.rb
1169
1120
  - lib/mihari/models/whois.rb
@@ -1171,7 +1122,6 @@ files:
1171
1122
  - lib/mihari/notifiers/exception_notifier.rb
1172
1123
  - lib/mihari/notifiers/slack.rb
1173
1124
  - lib/mihari/schemas/analyzer.rb
1174
- - lib/mihari/schemas/configuration.rb
1175
1125
  - lib/mihari/schemas/macros.rb
1176
1126
  - lib/mihari/schemas/rule.rb
1177
1127
  - lib/mihari/status.rb
@@ -1180,6 +1130,7 @@ files:
1180
1130
  - lib/mihari/structs/greynoise.rb
1181
1131
  - lib/mihari/structs/ipinfo.rb
1182
1132
  - lib/mihari/structs/onyphe.rb
1133
+ - lib/mihari/structs/rule.rb
1183
1134
  - lib/mihari/structs/shodan.rb
1184
1135
  - lib/mihari/structs/urlscan.rb
1185
1136
  - lib/mihari/structs/virustotal_intelligence.rb
@@ -1194,6 +1145,7 @@ files:
1194
1145
  - lib/mihari/web/endpoints/command.rb
1195
1146
  - lib/mihari/web/endpoints/configs.rb
1196
1147
  - lib/mihari/web/endpoints/ip_addresses.rb
1148
+ - lib/mihari/web/endpoints/rules.rb
1197
1149
  - lib/mihari/web/endpoints/sources.rb
1198
1150
  - lib/mihari/web/endpoints/tags.rb
1199
1151
  - lib/mihari/web/entities/alert.rb
@@ -1206,10 +1158,11 @@ files:
1206
1158
  - lib/mihari/web/entities/ip_address.rb
1207
1159
  - lib/mihari/web/entities/message.rb
1208
1160
  - lib/mihari/web/entities/reverse_dns.rb
1161
+ - lib/mihari/web/entities/rule.rb
1209
1162
  - lib/mihari/web/entities/source.rb
1210
1163
  - lib/mihari/web/entities/tag.rb
1211
1164
  - lib/mihari/web/entities/whois.rb
1212
- - lib/mihari/web/public/grape.rb
1165
+ - lib/mihari/web/middleware/connection_adapter.rb
1213
1166
  - lib/mihari/web/public/index.html
1214
1167
  - lib/mihari/web/public/redoc-static.html
1215
1168
  - lib/mihari/web/public/static/favicon.ico
@@ -1253,6 +1206,8 @@ files:
1253
1206
  - lib/mihari/web/public/static/js/app.365f1907.js.map
1254
1207
  - lib/mihari/web/public/static/js/app.378da3dc.js
1255
1208
  - lib/mihari/web/public/static/js/app.378da3dc.js.map
1209
+ - lib/mihari/web/public/static/js/app.49ab738a.js
1210
+ - lib/mihari/web/public/static/js/app.49ab738a.js.map
1256
1211
  - lib/mihari/web/public/static/js/app.5dc97aae.js
1257
1212
  - lib/mihari/web/public/static/js/app.5dc97aae.js.map
1258
1213
  - lib/mihari/web/public/static/js/app.6b636b62.js
@@ -1295,34 +1250,16 @@ files:
1295
1250
  - sig/lib/mihari/analyzers/virustotal.rbs
1296
1251
  - sig/lib/mihari/analyzers/virustotal_intelligence.rbs
1297
1252
  - sig/lib/mihari/analyzers/zoomeye.rbs
1298
- - sig/lib/mihari/cli/analyzer.rbs
1299
1253
  - sig/lib/mihari/cli/base.rbs
1300
1254
  - sig/lib/mihari/cli/init.rbs
1301
1255
  - sig/lib/mihari/cli/main.rbs
1302
1256
  - sig/lib/mihari/cli/mixins/utils.rbs
1303
1257
  - sig/lib/mihari/cli/validator.rbs
1304
- - sig/lib/mihari/commands/binaryedge.rbs
1305
- - sig/lib/mihari/commands/censys.rbs
1306
- - sig/lib/mihari/commands/circl.rbs
1307
- - sig/lib/mihari/commands/crtsh.rbs
1308
- - sig/lib/mihari/commands/dnpedia.rbs
1309
- - sig/lib/mihari/commands/dnstwister.rbs
1310
- - sig/lib/mihari/commands/feed.rbs
1311
1258
  - sig/lib/mihari/commands/init.rbs
1312
1259
  - sig/lib/mihari/commands/json.rbs
1313
- - sig/lib/mihari/commands/onyphe.rbs
1314
- - sig/lib/mihari/commands/otx.rbs
1315
- - sig/lib/mihari/commands/passivetotal.rbs
1316
- - sig/lib/mihari/commands/pulsedive.rbs
1317
1260
  - sig/lib/mihari/commands/search.rbs
1318
- - sig/lib/mihari/commands/securitytrails.rbs
1319
- - sig/lib/mihari/commands/shodan.rbs
1320
- - sig/lib/mihari/commands/spyse.rbs
1321
- - sig/lib/mihari/commands/urlscan.rbs
1322
1261
  - sig/lib/mihari/commands/validator.rbs
1323
- - sig/lib/mihari/commands/virustotal.rbs
1324
1262
  - sig/lib/mihari/commands/web.rbs
1325
- - sig/lib/mihari/commands/zoomeye.rbs
1326
1263
  - sig/lib/mihari/constants.rbs
1327
1264
  - sig/lib/mihari/database.rbs
1328
1265
  - sig/lib/mihari/emitters/base.rbs
@@ -1351,6 +1288,7 @@ files:
1351
1288
  - sig/lib/mihari/models/dns.rbs
1352
1289
  - sig/lib/mihari/models/geolocation.rbs
1353
1290
  - sig/lib/mihari/models/reverse_dns.rbs
1291
+ - sig/lib/mihari/models/rule.rbs
1354
1292
  - sig/lib/mihari/models/tag.rbs
1355
1293
  - sig/lib/mihari/models/tagging.rbs
1356
1294
  - sig/lib/mihari/models/whois.rbs
@@ -1363,6 +1301,7 @@ files:
1363
1301
  - sig/lib/mihari/structs/greynoise.rbs
1364
1302
  - sig/lib/mihari/structs/ipinfo.rbs
1365
1303
  - sig/lib/mihari/structs/onyphe.rbs
1304
+ - sig/lib/mihari/structs/rule.rbs
1366
1305
  - sig/lib/mihari/structs/shodan.rbs
1367
1306
  - sig/lib/mihari/structs/urlscan.rbs
1368
1307
  - sig/lib/mihari/structs/virustotal_intelligence.rbs
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "mihari/commands/binaryedge"
4
- require "mihari/commands/censys"
5
- require "mihari/commands/circl"
6
- require "mihari/commands/crtsh"
7
- require "mihari/commands/dnpedia"
8
- require "mihari/commands/dnstwister"
9
- require "mihari/commands/feed"
10
- require "mihari/commands/greynoise"
11
- require "mihari/commands/onyphe"
12
- require "mihari/commands/otx"
13
- require "mihari/commands/passivetotal"
14
- require "mihari/commands/pulsedive"
15
- require "mihari/commands/securitytrails"
16
- require "mihari/commands/shodan"
17
- require "mihari/commands/spyse"
18
- require "mihari/commands/urlscan"
19
- require "mihari/commands/virustotal_intelligence"
20
- require "mihari/commands/virustotal"
21
- require "mihari/commands/zoomeye"
22
-
23
- require "mihari/commands/json"
24
-
25
- module Mihari
26
- module CLI
27
- class Analyzer < Base
28
- class_option :ignore_old_artifacts, type: :boolean, default: false, desc: "Whether to ignore old artifacts from checking or not."
29
- class_option :ignore_threshold, type: :numeric, default: 0, desc: "Number of days to define whether an artifact is old or not."
30
- class_option :interval, type: :numeric, default: 0, desc: "Seconds of the interval while calling API in a row."
31
- class_option :config, type: :string, desc: "Path to the config file"
32
-
33
- include Mihari::Commands::BinaryEdge
34
- include Mihari::Commands::Censys
35
- include Mihari::Commands::CIRCL
36
- include Mihari::Commands::Crtsh
37
- include Mihari::Commands::DNPedia
38
- include Mihari::Commands::DNSTwister
39
- include Mihari::Commands::Feed
40
- include Mihari::Commands::GreyNoise
41
- include Mihari::Commands::JSON
42
- include Mihari::Commands::Onyphe
43
- include Mihari::Commands::OTX
44
- include Mihari::Commands::PassiveTotal
45
- include Mihari::Commands::Pulsedive
46
- include Mihari::Commands::SecurityTrails
47
- include Mihari::Commands::Shodan
48
- include Mihari::Commands::Spyse
49
- include Mihari::Commands::Urlscan
50
- include Mihari::Commands::VirusTotal
51
- include Mihari::Commands::VirusTotalIntelligence
52
- include Mihari::Commands::ZoomEye
53
- end
54
- end
55
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module BinaryEdge
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "binaryedge [QUERY]", "BinaryEdge host search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def binaryedge(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::BinaryEdge, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Censys
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "censys [QUERY]", "Censys IPv4 search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- method_option :type, type: :string, desc: "type to search (ipv4 / websites / certificates)", default: "ipv4"
13
- def censys(query)
14
- with_error_handling do
15
- run_analyzer Analyzers::Censys, query: query, options: options
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module CIRCL
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "circl [DOMAIN|SHA1]", "CIRCL passive DNS/SSL search by a domain or SHA1 certificate fingerprint"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def circl(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::CIRCL, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Crtsh
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "crtsh [QUERY]", "crt.sh search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- method_option :exclude_expired, type: :boolean, desc: "exclude expired certificates"
13
- def crtsh(query)
14
- with_error_handling do
15
- run_analyzer Analyzers::Crtsh, query: query, options: options
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module DNPedia
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "dnpedia [QUERY]", "DNPedia domain search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def dnpedia(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::DNPedia, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module DNSTwister
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "dnstwister [DOMAIN]", "dnstwister search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def dnstwister(domain)
13
- with_error_handling do
14
- run_analyzer Analyzers::DNSTwister, query: domain, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Feed
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "feed [URL]", "ingest feed"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- method_option :http_request_method, type: :string, desc: "HTTP request method"
13
- method_option :http_request_headers, type: :hash, desc: "HTTP request headers"
14
- method_option :http_request_payload_type, type: :string, desc: "HTTP request payload type"
15
- method_option :http_request_payload, type: :hash, desc: "HTTP request payload"
16
- method_option :selector, type: :string, desc: "jr selector", required: true
17
- def feed(query)
18
- with_error_handling do
19
- run_analyzer Analyzers::Feed, query: query, options: options
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module GreyNoise
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "greynoise [QUERY]", "GreyNoise search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def greynoise(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::GreyNoise, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module JSON
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "import_from_json", "Give a JSON input via STDIN"
9
- def import_from_json(input = nil)
10
- with_error_handling do
11
- json = input || $stdin.gets.chomp
12
- raise ArgumentError, "Input not found: please give an input in a JSON format" unless json
13
-
14
- json = parse_as_json(json)
15
- raise ArgumentError, "Invalid input format: an input JSON data should have title, description and artifacts key" unless required_alert_keys?(json)
16
-
17
- title = json["title"]
18
- description = json["description"]
19
- artifacts = json["artifacts"]
20
- tags = json["tags"] || []
21
-
22
- basic = Analyzers::Basic.new(title: title, description: description, artifacts: artifacts, source: "json", tags: tags)
23
-
24
- basic.ignore_old_artifacts = options["ignore_old_artifacts"] || false
25
- basic.ignore_threshold = options["ignore_threshold"] || 0
26
-
27
- basic.run
28
- end
29
- end
30
-
31
- no_commands do
32
- def parse_as_json(input)
33
- ::JSON.parse input
34
- rescue ::JSON::ParserError => _e
35
- nil
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Onyphe
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "onyphe [QUERY]", "Onyphe datascan search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def onyphe(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::Onyphe, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module OTX
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "otx [IP|DOMAIN]", "OTX search by an IP or domain"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def otx(domain)
13
- with_error_handling do
14
- run_analyzer Analyzers::OTX, query: domain, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module PassiveTotal
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "passivetotal [IP|DOMAIN|EMAIL|SHA1]", "PassiveTotal search by an ip, domain, email or SHA1 certificate fingerprint"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def passivetotal(indicator)
13
- with_error_handling do
14
- run_analyzer Analyzers::PassiveTotal, query: indicator, options: options
15
- end
16
- end
17
- map "pt" => :passivetotal
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Pulsedive
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "pulsedive [IP|DOMAIN]", "Pulsedive search by an ip or domain"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def pulsedive(indiactor)
13
- with_error_handling do
14
- run_analyzer Analyzers::Pulsedive, query: indiactor, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module SecurityTrails
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "securitytrails [IP|DOMAIN|EMAIL]", "SecurityTrails search by an ip, domain or email"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def securitytrails(indiactor)
13
- with_error_handling do
14
- run_analyzer Analyzers::SecurityTrails, query: indiactor, options: options
15
- end
16
- end
17
- map "st" => :securitytrails
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Commands
5
- module Shodan
6
- def self.included(thor)
7
- thor.class_eval do
8
- desc "shodan [QUERY]", "Shodan host search"
9
- method_option :title, type: :string, desc: "title"
10
- method_option :description, type: :string, desc: "description"
11
- method_option :tags, type: :array, desc: "tags"
12
- def shodan(query)
13
- with_error_handling do
14
- run_analyzer Analyzers::Shodan, query: query, options: options
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end