mihari 5.1.1 → 5.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/.rubocop.yml +6 -0
  4. data/README.md +0 -1
  5. data/lib/mihari/analyzers/base.rb +32 -27
  6. data/lib/mihari/analyzers/binaryedge.rb +8 -2
  7. data/lib/mihari/analyzers/censys.rb +10 -61
  8. data/lib/mihari/analyzers/circl.rb +13 -19
  9. data/lib/mihari/analyzers/crtsh.rb +6 -0
  10. data/lib/mihari/analyzers/dnstwister.rb +12 -19
  11. data/lib/mihari/analyzers/feed.rb +21 -0
  12. data/lib/mihari/analyzers/greynoise.rb +5 -28
  13. data/lib/mihari/analyzers/onyphe.rb +8 -33
  14. data/lib/mihari/analyzers/otx.rb +11 -17
  15. data/lib/mihari/analyzers/passivetotal.rb +13 -19
  16. data/lib/mihari/analyzers/pulsedive.rb +3 -1
  17. data/lib/mihari/analyzers/rule.rb +0 -1
  18. data/lib/mihari/analyzers/securitytrails.rb +18 -29
  19. data/lib/mihari/analyzers/shodan.rb +13 -92
  20. data/lib/mihari/analyzers/urlscan.rb +12 -4
  21. data/lib/mihari/analyzers/virustotal.rb +4 -0
  22. data/lib/mihari/analyzers/virustotal_intelligence.rb +9 -6
  23. data/lib/mihari/analyzers/zoomeye.rb +9 -0
  24. data/lib/mihari/clients/binaryedge.rb +5 -0
  25. data/lib/mihari/clients/censys.rb +4 -4
  26. data/lib/mihari/clients/circl.rb +3 -3
  27. data/lib/mihari/clients/greynoise.rb +6 -1
  28. data/lib/mihari/clients/misp.rb +8 -1
  29. data/lib/mihari/clients/onyphe.rb +13 -1
  30. data/lib/mihari/clients/otx.rb +20 -0
  31. data/lib/mihari/clients/passivetotal.rb +6 -2
  32. data/lib/mihari/clients/publsedive.rb +18 -1
  33. data/lib/mihari/clients/securitytrails.rb +94 -0
  34. data/lib/mihari/clients/shodan.rb +14 -3
  35. data/lib/mihari/clients/the_hive.rb +6 -1
  36. data/lib/mihari/clients/urlscan.rb +3 -1
  37. data/lib/mihari/clients/virustotal.rb +9 -3
  38. data/lib/mihari/clients/zoomeye.rb +7 -1
  39. data/lib/mihari/commands/database.rb +1 -6
  40. data/lib/mihari/commands/searcher.rb +1 -2
  41. data/lib/mihari/database.rb +9 -0
  42. data/lib/mihari/http.rb +14 -18
  43. data/lib/mihari/structs/censys.rb +62 -0
  44. data/lib/mihari/structs/greynoise.rb +43 -0
  45. data/lib/mihari/structs/onyphe.rb +45 -0
  46. data/lib/mihari/structs/shodan.rb +83 -0
  47. data/lib/mihari/version.rb +1 -1
  48. data/lib/mihari/web/middleware/connection_adapter.rb +1 -3
  49. data/lib/mihari/web/public/assets/{index-63900d73.js → index-7d0fb8c4.js} +2 -2
  50. data/lib/mihari/web/public/index.html +1 -1
  51. data/lib/mihari/web/public/redoc-static.html +2 -2
  52. data/lib/mihari.rb +1 -3
  53. data/mihari.gemspec +2 -3
  54. metadata +8 -24
  55. data/lib/mihari/analyzers/dnpedia.rb +0 -33
  56. data/lib/mihari/clients/dnpedia.rb +0 -64
  57. data/lib/mihari/mixins/database.rb +0 -16
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
7
  <link rel="icon" href="/favicon.ico" />
8
8
  <title>Mihari</title>
9
- <script type="module" crossorigin src="/assets/index-63900d73.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-7d0fb8c4.js"></script>
10
10
  <link rel="stylesheet" href="/assets/index-625e95fe.css">
11
11
  </head>
12
12
  <body>
@@ -26,7 +26,7 @@
26
26
  `;var ga=ua;function ya(e){return t=>{if(t.theme.extensionsHook)return t.theme.extensionsHook(e,t)}}const va=ga.div`
27
27
  padding: 20px;
28
28
  color: red;
29
- `;class ba extends n.Component{constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e){return this.setState({error:e}),!1}render(){return this.state.error?n.createElement(va,null,n.createElement("h1",null,"Something went wrong..."),n.createElement("small",null," ",this.state.error.message," "),n.createElement("p",null,n.createElement("details",null,n.createElement("summary",null,"Stack trace"),n.createElement("pre",null,this.state.error.stack))),n.createElement("small",null," ReDoc Version: ","2.0.0-rc.77")," ",n.createElement("br",null),n.createElement("small",null," Commit: ","580f883")):n.createElement(n.Fragment,null,n.Children.only(this.props.children))}}const wa=fa`
29
+ `;class ba extends n.Component{constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e){return this.setState({error:e}),!1}render(){return this.state.error?n.createElement(va,null,n.createElement("h1",null,"Something went wrong..."),n.createElement("small",null," ",this.state.error.message," "),n.createElement("p",null,n.createElement("details",null,n.createElement("summary",null,"Stack trace"),n.createElement("pre",null,this.state.error.stack))),n.createElement("small",null," ReDoc Version: ","2.0.0")," ",n.createElement("br",null),n.createElement("small",null," Commit: ","5fb4daa")):n.createElement(n.Fragment,null,n.Children.only(this.props.children))}}const wa=fa`
30
30
  0% {
31
31
  transform: rotate(0deg); }
32
32
  100% {
@@ -1816,7 +1816,7 @@
1816
1816
  cursor: pointer;
1817
1817
  font-style: normal;
1818
1818
  color: '#666';
1819
- `;var Hb=Object.defineProperty,Yb=Object.getOwnPropertyDescriptor;class Kb extends n.PureComponent{constructor(e){super(e),this.activeItemRef=null,this.clear=()=>{this.setState({results:[],noResults:!1,term:"",activeItemIdx:-1}),this.props.marker.unmark()},this.handleKeyDown=e=>{if(27===e.keyCode&&this.clear(),40===e.keyCode&&(this.setState({activeItemIdx:Math.min(this.state.activeItemIdx+1,this.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(this.setState({activeItemIdx:Math.max(0,this.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode){const e=this.state.results[this.state.activeItemIdx];if(e){const t=this.props.getItemById(e.meta);t&&this.props.onActivate(t)}}},this.search=e=>{const{minCharacterLengthToInitSearch:t}=this.context,n=e.target.value;n.length<t?this.clearResults(n):this.setState({term:n},(()=>this.searchCallback(this.state.term)))},this.state={results:[],noResults:!1,term:"",activeItemIdx:-1}}clearResults(e){this.setState({results:[],noResults:!1,term:e}),this.props.marker.unmark()}setResults(e,t){this.setState({results:e,noResults:0===e.length}),this.props.marker.mark(t)}searchCallback(e){this.props.search.search(e).then((t=>{this.setResults(t,e)}))}render(){const{activeItemIdx:e}=this.state,t=this.state.results.filter((e=>this.props.getItemById(e.meta))).map((e=>({item:this.props.getItemById(e.meta),score:e.score}))).sort(((e,t)=>t.score-e.score));return n.createElement(Ub,{role:"search"},this.state.term&&n.createElement(Wb,{onClick:this.clear},"×"),n.createElement(Bb,null),n.createElement(Vb,{value:this.state.term,onKeyDown:this.handleKeyDown,placeholder:"Search...","aria-label":"Search",type:"text",onChange:this.search}),t.length>0&&n.createElement(Pd,{options:{wheelPropagation:!1}},n.createElement(qb,{"data-role":"search:results"},t.map(((t,r)=>n.createElement(wb,{item:Object.create(t.item,{active:{value:r===e}}),onActivate:this.props.onActivate,withoutChildren:!0,key:t.item.id,"data-role":"search:result"}))))),this.state.term&&this.state.noResults?n.createElement(qb,{"data-role":"search:results"},lo("noResultsFound")):null)}}Kb.contextType=Sa,((e,t,n,r)=>{for(var o,i=Yb(t,n),a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);i&&Hb(t,n,i)})([Ra.bind,(0,Ra.debounce)(400)],Kb.prototype,"searchCallback");class Gb extends n.Component{componentDidMount(){this.props.store.onDidMount()}componentWillUnmount(){this.props.store.dispose()}render(){const{store:{spec:e,menu:t,options:r,search:o,marker:i}}=this.props,a=this.props.store;return n.createElement(ha,{theme:r.theme},n.createElement(Du,{value:a},n.createElement(Ea,{value:r},n.createElement(Mb,{className:"redoc-wrap"},n.createElement(Lb,{menu:t,className:"menu-content"},n.createElement(py,{info:e.info}),!r.disableSearch&&n.createElement(Kb,{search:o,marker:i,getItemById:t.getItemById,onActivate:t.activateAndScroll})||null,n.createElement($b,{menu:t})),n.createElement(Fb,{className:"api-content"},n.createElement(sy,{store:a}),n.createElement(lb,{items:t.items})),n.createElement(zb,null)))))}}Gb.propTypes={store:Oa.instanceOf(ey).isRequired};const Qb=function(e){const{spec:t,specUrl:o,options:i={},onLoaded:a}=e,s=bo(i.hideLoading,!1),l=new xo(i);if(void 0!==l.nonce)try{r.nc=l.nonce}catch(e){}return n.createElement(ba,null,n.createElement(Mu,{spec:t,specUrl:o,options:i,onLoaded:a},(({loading:e,store:t})=>e?s?null:n.createElement(_a,{color:l.theme.colors.primary.main}):n.createElement(Gb,{store:t}))))};var Xb=Object.defineProperty,Jb=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,ew=Object.prototype.propertyIsEnumerable,tw=(e,t,n)=>t in e?Xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nw=(e,t)=>{for(var n in t||(t={}))Zb.call(t,n)&&tw(e,n,t[n]);if(Jb)for(var n of Jb(t))ew.call(t,n)&&tw(e,n,t[n]);return e};Nt({useProxies:"ifavailable"});const rw="2.0.0-rc.77",ow="580f883";function iw(e){const t=function(e){const t={},n=e.attributes;for(let e=0;e<n.length;e++){const r=n[e];t[r.name]=r.value}return t}(e),n={};for(const e in t){const r=e.replace(/-(.)/g,((e,t)=>t.toUpperCase())),o=t[e];n[r]="theme"===e?JSON.parse(o):o}return n}function aw(e,t={},r=Wr("redoc"),o){if(null===r)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let a,s;"string"==typeof e?a=e:"object"==typeof e&&(s=e),(0,i.render)(n.createElement(Qb,{spec:s,onLoaded:o,specUrl:a,options:nw(nw({},t),iw(r))},["Loading..."]),r)}function sw(e=Wr("redoc")){e&&(0,i.unmountComponentAtNode)(e)}function lw(e,t=Wr("redoc"),r){const o=ey.fromJS(e);setTimeout((()=>{(0,i.hydrate)(n.createElement(Gb,{store:o}),t,r)}),0)}!function(){const e=Wr("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&aw(t,{},e)}()}(),o}()}));
1819
+ `;var Hb=Object.defineProperty,Yb=Object.getOwnPropertyDescriptor;class Kb extends n.PureComponent{constructor(e){super(e),this.activeItemRef=null,this.clear=()=>{this.setState({results:[],noResults:!1,term:"",activeItemIdx:-1}),this.props.marker.unmark()},this.handleKeyDown=e=>{if(27===e.keyCode&&this.clear(),40===e.keyCode&&(this.setState({activeItemIdx:Math.min(this.state.activeItemIdx+1,this.state.results.length-1)}),e.preventDefault()),38===e.keyCode&&(this.setState({activeItemIdx:Math.max(0,this.state.activeItemIdx-1)}),e.preventDefault()),13===e.keyCode){const e=this.state.results[this.state.activeItemIdx];if(e){const t=this.props.getItemById(e.meta);t&&this.props.onActivate(t)}}},this.search=e=>{const{minCharacterLengthToInitSearch:t}=this.context,n=e.target.value;n.length<t?this.clearResults(n):this.setState({term:n},(()=>this.searchCallback(this.state.term)))},this.state={results:[],noResults:!1,term:"",activeItemIdx:-1}}clearResults(e){this.setState({results:[],noResults:!1,term:e}),this.props.marker.unmark()}setResults(e,t){this.setState({results:e,noResults:0===e.length}),this.props.marker.mark(t)}searchCallback(e){this.props.search.search(e).then((t=>{this.setResults(t,e)}))}render(){const{activeItemIdx:e}=this.state,t=this.state.results.filter((e=>this.props.getItemById(e.meta))).map((e=>({item:this.props.getItemById(e.meta),score:e.score}))).sort(((e,t)=>t.score-e.score));return n.createElement(Ub,{role:"search"},this.state.term&&n.createElement(Wb,{onClick:this.clear},"×"),n.createElement(Bb,null),n.createElement(Vb,{value:this.state.term,onKeyDown:this.handleKeyDown,placeholder:"Search...","aria-label":"Search",type:"text",onChange:this.search}),t.length>0&&n.createElement(Pd,{options:{wheelPropagation:!1}},n.createElement(qb,{"data-role":"search:results"},t.map(((t,r)=>n.createElement(wb,{item:Object.create(t.item,{active:{value:r===e}}),onActivate:this.props.onActivate,withoutChildren:!0,key:t.item.id,"data-role":"search:result"}))))),this.state.term&&this.state.noResults?n.createElement(qb,{"data-role":"search:results"},lo("noResultsFound")):null)}}Kb.contextType=Sa,((e,t,n,r)=>{for(var o,i=Yb(t,n),a=e.length-1;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);i&&Hb(t,n,i)})([Ra.bind,(0,Ra.debounce)(400)],Kb.prototype,"searchCallback");class Gb extends n.Component{componentDidMount(){this.props.store.onDidMount()}componentWillUnmount(){this.props.store.dispose()}render(){const{store:{spec:e,menu:t,options:r,search:o,marker:i}}=this.props,a=this.props.store;return n.createElement(ha,{theme:r.theme},n.createElement(Du,{value:a},n.createElement(Ea,{value:r},n.createElement(Mb,{className:"redoc-wrap"},n.createElement(Lb,{menu:t,className:"menu-content"},n.createElement(py,{info:e.info}),!r.disableSearch&&n.createElement(Kb,{search:o,marker:i,getItemById:t.getItemById,onActivate:t.activateAndScroll})||null,n.createElement($b,{menu:t})),n.createElement(Fb,{className:"api-content"},n.createElement(sy,{store:a}),n.createElement(lb,{items:t.items})),n.createElement(zb,null)))))}}Gb.propTypes={store:Oa.instanceOf(ey).isRequired};const Qb=function(e){const{spec:t,specUrl:o,options:i={},onLoaded:a}=e,s=bo(i.hideLoading,!1),l=new xo(i);if(void 0!==l.nonce)try{r.nc=l.nonce}catch(e){}return n.createElement(ba,null,n.createElement(Mu,{spec:t,specUrl:o,options:i,onLoaded:a},(({loading:e,store:t})=>e?s?null:n.createElement(_a,{color:l.theme.colors.primary.main}):n.createElement(Gb,{store:t}))))};var Xb=Object.defineProperty,Jb=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,ew=Object.prototype.propertyIsEnumerable,tw=(e,t,n)=>t in e?Xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nw=(e,t)=>{for(var n in t||(t={}))Zb.call(t,n)&&tw(e,n,t[n]);if(Jb)for(var n of Jb(t))ew.call(t,n)&&tw(e,n,t[n]);return e};Nt({useProxies:"ifavailable"});const rw="2.0.0",ow="5fb4daa";function iw(e){const t=function(e){const t={},n=e.attributes;for(let e=0;e<n.length;e++){const r=n[e];t[r.name]=r.value}return t}(e),n={};for(const e in t){const r=e.replace(/-(.)/g,((e,t)=>t.toUpperCase())),o=t[e];n[r]="theme"===e?JSON.parse(o):o}return n}function aw(e,t={},r=Wr("redoc"),o){if(null===r)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let a,s;"string"==typeof e?a=e:"object"==typeof e&&(s=e),(0,i.render)(n.createElement(Qb,{spec:s,onLoaded:o,specUrl:a,options:nw(nw({},t),iw(r))},["Loading..."]),r)}function sw(e=Wr("redoc")){e&&(0,i.unmountComponentAtNode)(e)}function lw(e,t=Wr("redoc"),r){const o=ey.fromJS(e);setTimeout((()=>{(0,i.hydrate)(n.createElement(Gb,{store:o}),t,r)}),0)}!function(){const e=Wr("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&aw(t,{},e)}()}(),o}()}));
1820
1820
  //# sourceMappingURL=redoc.standalone.js.map</script><style data-styled="true" data-styled-version="5.3.0">.juinod{width:calc(100% - 40%);padding:0 40px;}/*!sc*/
1821
1821
  @media print,screen and (max-width:75rem){.juinod{width:100%;padding:40px 40px;}}/*!sc*/
1822
1822
  .bJcDWV{width:calc(100% - 40%);padding:0 40px;}/*!sc*/
data/lib/mihari.rb CHANGED
@@ -54,7 +54,6 @@ require "mihari/errors"
54
54
  # Mixins
55
55
  require "mihari/mixins/autonomous_system"
56
56
  require "mihari/mixins/configurable"
57
- require "mihari/mixins/database"
58
57
  require "mihari/mixins/falsepositive"
59
58
  require "mihari/mixins/error_notification"
60
59
  require "mihari/mixins/refang"
@@ -219,7 +218,6 @@ require "mihari/clients/binaryedge"
219
218
  require "mihari/clients/censys"
220
219
  require "mihari/clients/circl"
221
220
  require "mihari/clients/crtsh"
222
- require "mihari/clients/dnpedia"
223
221
  require "mihari/clients/dnstwister"
224
222
  require "mihari/clients/greynoise"
225
223
  require "mihari/clients/misp"
@@ -227,6 +225,7 @@ require "mihari/clients/onyphe"
227
225
  require "mihari/clients/otx"
228
226
  require "mihari/clients/passivetotal"
229
227
  require "mihari/clients/publsedive"
228
+ require "mihari/clients/securitytrails"
230
229
  require "mihari/clients/shodan"
231
230
  require "mihari/clients/the_hive"
232
231
  require "mihari/clients/urlscan"
@@ -240,7 +239,6 @@ require "mihari/analyzers/binaryedge"
240
239
  require "mihari/analyzers/censys"
241
240
  require "mihari/analyzers/circl"
242
241
  require "mihari/analyzers/crtsh"
243
- require "mihari/analyzers/dnpedia"
244
242
  require "mihari/analyzers/dnstwister"
245
243
  require "mihari/analyzers/feed"
246
244
  require "mihari/analyzers/greynoise"
data/mihari.gemspec CHANGED
@@ -44,7 +44,7 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency "rerun", "~> 0.14"
45
45
  spec.add_development_dependency "rspec", "~> 3.12"
46
46
  spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
47
- spec.add_development_dependency "standard", "~> 1.24"
47
+ spec.add_development_dependency "standard", "~> 1.25"
48
48
  spec.add_development_dependency "timecop", "~> 0.9"
49
49
  spec.add_development_dependency "vcr", "~> 6.1"
50
50
  spec.add_development_dependency "webmock", "~> 3.18"
@@ -55,7 +55,7 @@ Gem::Specification.new do |spec|
55
55
  spec.add_development_dependency "steep", "~> 1.3"
56
56
  end
57
57
 
58
- spec.add_dependency "activerecord", "7.0.4.2"
58
+ spec.add_dependency "activerecord", "7.0.4.3"
59
59
  spec.add_dependency "addressable", "2.8.1"
60
60
  spec.add_dependency "awrence", "2.0.1"
61
61
  spec.add_dependency "dotenv", "2.8.1"
@@ -84,7 +84,6 @@ Gem::Specification.new do |spec|
84
84
  spec.add_dependency "rack", "2.2.4"
85
85
  spec.add_dependency "rack-contrib", "2.3.0"
86
86
  spec.add_dependency "rack-cors", "1.1.1"
87
- spec.add_dependency "securitytrails", "1.0.0"
88
87
  spec.add_dependency "semantic_logger", "4.12.0"
89
88
  spec.add_dependency "sentry-ruby", "5.8.0"
90
89
  spec.add_dependency "slack-notifier", "2.4.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: 5.1.1
4
+ version: 5.1.3
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-03-11 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.24'
187
+ version: '1.25'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '1.24'
194
+ version: '1.25'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: timecop
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -282,14 +282,14 @@ dependencies:
282
282
  requirements:
283
283
  - - '='
284
284
  - !ruby/object:Gem::Version
285
- version: 7.0.4.2
285
+ version: 7.0.4.3
286
286
  type: :runtime
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - '='
291
291
  - !ruby/object:Gem::Version
292
- version: 7.0.4.2
292
+ version: 7.0.4.3
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: addressable
295
295
  requirement: !ruby/object:Gem::Requirement
@@ -682,20 +682,6 @@ dependencies:
682
682
  - - '='
683
683
  - !ruby/object:Gem::Version
684
684
  version: 1.1.1
685
- - !ruby/object:Gem::Dependency
686
- name: securitytrails
687
- requirement: !ruby/object:Gem::Requirement
688
- requirements:
689
- - - '='
690
- - !ruby/object:Gem::Version
691
- version: 1.0.0
692
- type: :runtime
693
- prerelease: false
694
- version_requirements: !ruby/object:Gem::Requirement
695
- requirements:
696
- - - '='
697
- - !ruby/object:Gem::Version
698
- version: 1.0.0
699
685
  - !ruby/object:Gem::Dependency
700
686
  name: semantic_logger
701
687
  requirement: !ruby/object:Gem::Requirement
@@ -853,7 +839,6 @@ files:
853
839
  - lib/mihari/analyzers/censys.rb
854
840
  - lib/mihari/analyzers/circl.rb
855
841
  - lib/mihari/analyzers/crtsh.rb
856
- - lib/mihari/analyzers/dnpedia.rb
857
842
  - lib/mihari/analyzers/dnstwister.rb
858
843
  - lib/mihari/analyzers/feed.rb
859
844
  - lib/mihari/analyzers/greynoise.rb
@@ -877,7 +862,6 @@ files:
877
862
  - lib/mihari/clients/censys.rb
878
863
  - lib/mihari/clients/circl.rb
879
864
  - lib/mihari/clients/crtsh.rb
880
- - lib/mihari/clients/dnpedia.rb
881
865
  - lib/mihari/clients/dnstwister.rb
882
866
  - lib/mihari/clients/greynoise.rb
883
867
  - lib/mihari/clients/misp.rb
@@ -885,6 +869,7 @@ files:
885
869
  - lib/mihari/clients/otx.rb
886
870
  - lib/mihari/clients/passivetotal.rb
887
871
  - lib/mihari/clients/publsedive.rb
872
+ - lib/mihari/clients/securitytrails.rb
888
873
  - lib/mihari/clients/shodan.rb
889
874
  - lib/mihari/clients/the_hive.rb
890
875
  - lib/mihari/clients/urlscan.rb
@@ -928,7 +913,6 @@ files:
928
913
  - lib/mihari/http.rb
929
914
  - lib/mihari/mixins/autonomous_system.rb
930
915
  - lib/mihari/mixins/configurable.rb
931
- - lib/mihari/mixins/database.rb
932
916
  - lib/mihari/mixins/error_notification.rb
933
917
  - lib/mihari/mixins/falsepositive.rb
934
918
  - lib/mihari/mixins/refang.rb
@@ -984,7 +968,7 @@ files:
984
968
  - lib/mihari/web/public/assets/fa-v4compatibility-7c377405.woff2
985
969
  - lib/mihari/web/public/assets/fa-v4compatibility-8d9500e8.ttf
986
970
  - lib/mihari/web/public/assets/index-625e95fe.css
987
- - lib/mihari/web/public/assets/index-63900d73.js
971
+ - lib/mihari/web/public/assets/index-7d0fb8c4.js
988
972
  - lib/mihari/web/public/favicon.ico
989
973
  - lib/mihari/web/public/index.html
990
974
  - lib/mihari/web/public/redoc-static.html
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Analyzers
5
- class DNPedia < Base
6
- param :query
7
-
8
- def artifacts
9
- search || []
10
- end
11
-
12
- private
13
-
14
- def client
15
- @client ||= Clients::DNPedia.new
16
- end
17
-
18
- #
19
- # Search
20
- #
21
- # @return [Array<Mihari::Artifact>]
22
- #
23
- def search
24
- res = client.search(query)
25
- rows = res["rows"] || []
26
- rows.map do |row|
27
- data = [row["name"], row["zoneid"]].join(".")
28
- Artifact.new(data: data, source: source, metadata: row)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "json"
4
- require "zlib"
5
-
6
- module Mihari
7
- module Clients
8
- class DNPedia < Base
9
- DEFAULT_HEADERS = {
10
- "Accept-Encoding" => "gzip",
11
- "Referer" => "https://dnpedia.com/tlds/search.php",
12
- "X-Requested-With" => "XMLHttpRequest"
13
- }.freeze
14
-
15
- DEFAULT_PARAMS = {
16
- cmd: "search",
17
- columns: "id,name,zoneid,length,idn,thedate,",
18
- ecf: "name",
19
- ecv: "",
20
- days: 2,
21
- mode: "added",
22
- _search: false,
23
- nd: 1_569_842_920_216,
24
- rows: 500,
25
- page: 1,
26
- sidx: "length",
27
- sord: "asc"
28
- }.freeze
29
-
30
- #
31
- # @param [String] base_url
32
- # @param [Hash] headers
33
- #
34
- def initialize(base_url = "https://dnpedia.com", headers: {})
35
- headers = headers.merge(DEFAULT_HEADERS)
36
-
37
- super(base_url, headers: headers)
38
- end
39
-
40
- #
41
- # @param [String] keyword
42
- #
43
- def search(keyword)
44
- params = DEFAULT_PARAMS.merge({ ecv: normalize(keyword) })
45
- res = get("/tlds/ajax.php", params: params)
46
-
47
- sio = StringIO.new(res.body.to_s)
48
- gz = Zlib::GzipReader.new(sio)
49
- page = gz.read
50
-
51
- JSON.parse page
52
- end
53
-
54
- private
55
-
56
- def normalize(word)
57
- return word if word.start_with?("~")
58
- return word unless word.include?("%")
59
-
60
- "~#{word}"
61
- end
62
- end
63
- end
64
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mihari
4
- module Mixins
5
- module Database
6
- def with_db_connection
7
- Mihari::Database.connect
8
- yield
9
- rescue ActiveRecord::StatementInvalid
10
- Mihari.logger.error("You haven't finished the DB migration! Please run 'mihari db migrate'.")
11
- ensure
12
- Mihari::Database.close
13
- end
14
- end
15
- end
16
- end