jekyll-secinfo 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b42c9fb47ecdc616942907528198f12fa11aef810c9faf2de279aa1966dc2f37
4
- data.tar.gz: 65dc27e0c3accdc565444e94b9f9912e922e7490d24fac11abc170354dea3910
3
+ metadata.gz: 94058d5a6a3b7d28418354ef6409c786349617d754ced6c7e61f5e602875888e
4
+ data.tar.gz: 576a3f35e9d428e2e72c6e89f28ff2d08cb91ce96ba60b37cd188b6226915e11
5
5
  SHA512:
6
- metadata.gz: 624d7ce5cbea3b4bb58960efa53aeb56fb10f80f1ccad37ae0ef5d35bec7fb8f9d3e6fcad6b3ece64a8447dd149143aacd9ea665a6a39c38b5e4fe40dfc16f70
7
- data.tar.gz: 2b5802638bb9b581e1f5f9a06bc086f31cbe062dad18a35de1d3d22edb6422be424d57a7dd50ecba9f92e4f0c1b63a91a0328bda3c1231300f8afb9f93d352aa
6
+ metadata.gz: 7d8f0eb6e9afd5c2d22fb912d7a7b0c8ed300397626062022f3279b41e104a2ba306a4bf6a65b07b785c12f6914585817f434deeb97ae148c204dd29e9eb97c1
7
+ data.tar.gz: 34f99f5d49b8694836612b245cd764f2550f6d398b8fcf5c82cda1620e0288860049be6aed5f5550642c73e5ade92a0d613f73c3bf1a12e8c5ac16d5aebc2a5c
@@ -9,6 +9,7 @@ require "jekyll-secinfo/logger"
9
9
  # Core
10
10
  require "jekyll-secinfo/cve"
11
11
  require "jekyll-secinfo/cwe"
12
+ require "jekyll-secinfo/divd"
12
13
 
13
14
  module Jekyll::Secinfo
14
15
  Logger.display_info
@@ -11,8 +11,12 @@ module Jekyll::Secinfo
11
11
  def self.get(site_config, page)
12
12
  config = {
13
13
  "cve" => {},
14
- "cwe" => {}
14
+ "cwe" => {},
15
+ "divd" => {}
15
16
  }
17
+
18
+ # CVE
19
+
16
20
  if site_config && site_config.key?(CONFIG_NAME)
17
21
  #config["site"] = site_config[CONFIG_NAME]
18
22
  if site_config[CONFIG_NAME].key?("cve") && site_config[CONFIG_NAME]["cve"]
@@ -23,14 +27,6 @@ module Jekyll::Secinfo
23
27
  config["cve"]["url"] = site_config[CONFIG_NAME]["cve"]["url"]
24
28
  end
25
29
  end
26
- if site_config[CONFIG_NAME].key?("cwe") && site_config[CONFIG_NAME]["cwe"]
27
- if site_config[CONFIG_NAME]["cwe"].key?("style") && site_config[CONFIG_NAME]["cwe"]["style"]
28
- config["cwe"]["style"] = site_config[CONFIG_NAME]["cwe"]["style"]
29
- end
30
- if site_config[CONFIG_NAME]["cwe"].key?("url") && site_config[CONFIG_NAME]["cwe"]["url"]
31
- config["cwe"]["url"] = site_config[CONFIG_NAME]["cwe"]["url"]
32
- end
33
- end
34
30
  end
35
31
 
36
32
  if page.key?(CONFIG_NAME) && page[CONFIG_NAME]
@@ -44,16 +40,6 @@ module Jekyll::Secinfo
44
40
  config["cve"].delete("style")
45
41
  end
46
42
  end
47
- if page[CONFIG_NAME].key?("cwe") && page[CONFIG_NAME]["cwe"]
48
- if page[CONFIG_NAME]["cwe"].key?("style") && page[CONFIG_NAME]["cwe"]["style"]
49
- config["cwe"]["style"]=page[CONFIG_NAME]["cwe"]["style"]
50
- config["cwe"].delete("url")
51
- end
52
- if page[CONFIG_NAME]["cwe"].key?("url") && page[CONFIG_NAME]["cwe"]["url"]
53
- config["cwe"]["url"]=page[CONFIG_NAME]["cwe"]["url"]
54
- config["cwe"].delete("style")
55
- end
56
- end
57
43
  end
58
44
 
59
45
  if not config["cve"]["url"]
@@ -70,6 +56,32 @@ module Jekyll::Secinfo
70
56
  end
71
57
  end
72
58
 
59
+ # CWE
60
+
61
+ if site_config && site_config.key?(CONFIG_NAME)
62
+ if site_config[CONFIG_NAME].key?("cwe") && site_config[CONFIG_NAME]["cwe"]
63
+ if site_config[CONFIG_NAME]["cwe"].key?("style") && site_config[CONFIG_NAME]["cwe"]["style"]
64
+ config["cwe"]["style"] = site_config[CONFIG_NAME]["cwe"]["style"]
65
+ end
66
+ if site_config[CONFIG_NAME]["cwe"].key?("url") && site_config[CONFIG_NAME]["cwe"]["url"]
67
+ config["cwe"]["url"] = site_config[CONFIG_NAME]["cwe"]["url"]
68
+ end
69
+ end
70
+ end
71
+
72
+ if page.key?(CONFIG_NAME) && page[CONFIG_NAME]
73
+ if page[CONFIG_NAME].key?("cwe") && page[CONFIG_NAME]["cwe"]
74
+ if page[CONFIG_NAME]["cwe"].key?("style") && page[CONFIG_NAME]["cwe"]["style"]
75
+ config["cwe"]["style"]=page[CONFIG_NAME]["cwe"]["style"]
76
+ config["cwe"].delete("url")
77
+ end
78
+ if page[CONFIG_NAME]["cwe"].key?("url") && page[CONFIG_NAME]["cwe"]["url"]
79
+ config["cwe"]["url"]=page[CONFIG_NAME]["cwe"]["url"]
80
+ config["cwe"].delete("style")
81
+ end
82
+ end
83
+ end
84
+
73
85
  if not config["cwe"]["url"]
74
86
  case config["cwe"]["style"]
75
87
  when "mitre", "nvd"
@@ -82,6 +94,35 @@ module Jekyll::Secinfo
82
94
  end
83
95
  end
84
96
 
97
+ # DIVD
98
+
99
+ if site_config && site_config.key?(CONFIG_NAME)
100
+ if site_config[CONFIG_NAME].key?("divd") && site_config[CONFIG_NAME]["divd"]
101
+ if site_config[CONFIG_NAME]["divd"].key?("url") && site_config[CONFIG_NAME]["divd"]["url"]
102
+ config["divd"]["url"] = site_config[CONFIG_NAME]["divd"]["url"]
103
+ end
104
+ end
105
+ end
106
+
107
+ if page.key?(CONFIG_NAME) && page[CONFIG_NAME]
108
+ if page[CONFIG_NAME].key?("divd")
109
+ if page[CONFIG_NAME]["divd"]
110
+ if page[CONFIG_NAME]["divd"].key?("url")
111
+ if page[CONFIG_NAME]["divd"]["url"]
112
+ config["divd"]["url"]=page[CONFIG_NAME]["divd"]["url"]
113
+ else
114
+ config["divd"].delete("url")
115
+ end
116
+ end
117
+ else
118
+ config["divd"] = {}
119
+ end
120
+ end
121
+ end
122
+
123
+ if not config["divd"]["url"]
124
+ config["divd"]["url"] = "https://csirt.divd.nl/DIVD-"
125
+ end
85
126
 
86
127
  return config
87
128
  end #get_config
@@ -0,0 +1,64 @@
1
+ # External
2
+ require "jekyll"
3
+ require "jekyll-secinfo/version"
4
+
5
+ # Support
6
+ require "jekyll-secinfo/logger"
7
+ require "jekyll-secinfo/config"
8
+
9
+ module Jekyll::Secinfo
10
+ class Divd
11
+
12
+ def self.to_link(text, site, page)
13
+ #Logger.log(context)
14
+ config = Jekyll::Secinfo::Config.get(site, page)
15
+
16
+ m = text.match(/^(DIVD-|divd-)?(\d{4}\-\d+)/)
17
+ if m
18
+ if config["divd"]["url"] =~ /\%s/
19
+ url=config["divd"]["url"] % m[2]
20
+ else
21
+ url="#{config["divd"]["url"]}#{m[2]}"
22
+ end
23
+ return "<a href='#{url}' class='divd secinfo'>DIVD-#{m[2]}</a>"
24
+ else
25
+ return nil
26
+ end
27
+ end
28
+ end
29
+
30
+ class DivdTag < Liquid::Tag
31
+
32
+ def initialize(tagName, text, tokens)
33
+ super
34
+ @text = text
35
+ end
36
+
37
+ def render(context)
38
+ divd_text = @text.strip
39
+ out = Divd.to_link(divd_text, context["site"], context["page"])
40
+ return out if out
41
+ return @text
42
+ end
43
+
44
+ end
45
+
46
+ module DivdFilter
47
+ def divd(divdtxt, niets = nil)
48
+ if divdtxt
49
+ link = Divd.to_link(divdtxt, @context.registers[:site].config, @context.registers[:page])
50
+ if link
51
+ return link
52
+ else
53
+ return divdtxt
54
+ end
55
+ else
56
+ return ""
57
+ end
58
+ end
59
+ end
60
+
61
+ Liquid::Template.register_tag("divd", Jekyll::Secinfo::DivdTag)
62
+ Liquid::Template.register_filter(DivdFilter)
63
+
64
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Secinfo
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-secinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Breedijk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -115,6 +115,7 @@ files:
115
115
  - lib/jekyll-secinfo/config.rb
116
116
  - lib/jekyll-secinfo/cve.rb
117
117
  - lib/jekyll-secinfo/cwe.rb
118
+ - lib/jekyll-secinfo/divd.rb
118
119
  - lib/jekyll-secinfo/logger.rb
119
120
  - lib/jekyll-secinfo/version.rb
120
121
  homepage: https://github.com/MrSeccubus/jekyll-secinfo