ruby-zoom 4.4.4 → 4.5.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
  SHA1:
3
- metadata.gz: d1ebdb3016a0d860ae122704737fe8a53131e013
4
- data.tar.gz: 93835fd7930544ff57f5fcf87d1d25e967b45113
3
+ metadata.gz: 7e24741581c5ef1f83d4decb56f4174ba0daf8fe
4
+ data.tar.gz: e891c15c54c8d463da1bf1cf6df704d174f2c93b
5
5
  SHA512:
6
- metadata.gz: c8a9de026c8ce274bc6c4311c7042f990ae709965df8ae5f54ccabf4843bcb0170c2b9ee317d32441554a556d42300a6c41d158b84f76512babb42c3daf2adea
7
- data.tar.gz: ce6dbdfb1fa4fc2f9f10fce3ac85f14e43804cb6c53bef16f468149a188256a412f23d28911109d48ab604d7621dd2c6cb45fb7b674e30bfbe5a9d524e631a86
6
+ metadata.gz: a8328bc8f7e697de49828c0dea1e81fc464eb8130a52294af8b60bb35ccf168a2a044055048d37f39250c9bb2160a162ce551fd1e997548dd242b5858c65a962
7
+ data.tar.gz: 88da71aee03e6e74d28c58981cc7ee608b6f8ec6f47e5cbf262a0db54ea8fb37c65d35235dfbec539a3d0f61df200debafa527910107ac2ba9358288ffd0e470
@@ -1,3 +1,4 @@
1
+ require "fagin"
1
2
  require "pathname"
2
3
 
3
4
  class Zoom
@@ -82,4 +83,17 @@ require "zoom/config"
82
83
  require "zoom/editor"
83
84
  require "zoom/error"
84
85
  require "zoom/profile"
86
+ Fagin.find_children(
87
+ "Zoom::Profile",
88
+ "#{File.dirname(__FILE__)}/zoom/profile"
89
+ )
85
90
  require "zoom/profile_manager"
91
+ require "zoom/security_profile"
92
+ Fagin.find_children(
93
+ "Zoom::SecurityProfile",
94
+ "#{File.dirname(__FILE__)}/zoom/profile"
95
+ )
96
+
97
+ # Load custom profiles
98
+ Fagin.find_children("Zoom::Profile", "~/.config/zoom")
99
+ Fagin.find_children("Zoom::SecurityProfile", "~/.config/zoom")
@@ -220,15 +220,3 @@ class Zoom::Profile < Hash
220
220
  return ""
221
221
  end
222
222
  end
223
-
224
- require "zoom/profile/ack"
225
- require "zoom/profile/ag"
226
- require "zoom/profile/find"
227
- require "zoom/profile/grep"
228
- require "zoom/profile/passwords"
229
- require "zoom/profile/pt"
230
- require "zoom/profile/unsafe_c"
231
- require "zoom/profile/unsafe_java"
232
- require "zoom/profile/unsafe_js"
233
- require "zoom/profile/unsafe_php"
234
- require "zoom/profile/unsafe_python"
@@ -1,23 +1,18 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::Passwords < superclass
1
+ class Zoom::SecurityProfile::Passwords < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case"
12
7
  when "ag"
13
8
  flags = "-Su"
14
- when "pt"
15
- flags = "-SU --hidden"
16
9
  when "grep"
17
10
  flags = "-ai"
11
+ when "pt"
12
+ flags = "-SU --hidden"
18
13
  end
19
14
 
20
- super(n, op, flags, b, a)
15
+ super(n, nil, flags, b, a)
21
16
  @pattern = "(key|pass(wd|word)?)[^:=,>]? *[:=,>]"
22
17
  @taggable = true
23
18
  end
@@ -1,23 +1,18 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::UnsafeC < superclass
1
+ class Zoom::SecurityProfile::UnsafeC < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case --cc --cpp"
12
7
  when "ag"
13
8
  flags = "-S -G \"\\.(c|h)(pp)?$\""
14
- when "pt"
15
- flags = "-S -G \"\\.(c|h)(pp)?$\""
16
9
  when "grep"
17
10
  flags = "-i --include=\"*.[ch]\" --include=\"*.[ch]pp\""
11
+ when "pt"
12
+ flags = "-S -G \"\\.(c|h)(pp)?$\""
18
13
  end
19
14
 
20
- super(n, op, flags, b, a)
15
+ super(n, nil, flags, b, a)
21
16
  @pattern = [
22
17
  "(",
23
18
  [
@@ -1,27 +1,22 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::UnsafeJava < superclass
1
+ class Zoom::SecurityProfile::UnsafeJava < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case --java"
12
7
  when "ag"
13
8
  flags = "-S -G \"\\.(java|properties)$\""
14
- when "pt"
15
- flags = "-S -G \"\\.(java|properties)$\""
16
9
  when "grep"
17
10
  flags = [
18
11
  "-i",
19
12
  "--include=\"*.java\"",
20
13
  "--include=\"*.properties\""
21
14
  ].join(" ")
15
+ when "pt"
16
+ flags = "-S -G \"\\.(java|properties)$\""
22
17
  end
23
18
 
24
- super(n, op, flags, b, a)
19
+ super(n, nil, flags, b, a)
25
20
  @pattern = [
26
21
  "(sun\\.misc\\.)?Unsafe",
27
22
  "(\\.getRuntime|readObject|Runtime)\\("
@@ -1,23 +1,18 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::UnsafeJs < superclass
1
+ class Zoom::SecurityProfile::UnsafeJs < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case --js"
12
7
  when "ag"
13
8
  flags = "-S -G \"\\.js$\""
14
- when "pt"
15
- flags = "-S -G \"\\.js$\""
16
9
  when "grep"
17
10
  flags = "-i --include=\"*.js\""
11
+ when "pt"
12
+ flags = "-S -G \"\\.js$\""
18
13
  end
19
14
 
20
- super(n, op, flags, b, a)
15
+ super(n, nil, flags, b, a)
21
16
  @pattern = "\\.((append|eval|html)\\(|innerHTML)"
22
17
  @taggable = true
23
18
  end
@@ -1,18 +1,11 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::UnsafePhp < superclass
1
+ class Zoom::SecurityProfile::UnsafePhp < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case --php"
12
7
  when "ag"
13
8
  flags = "-S -G \"\\.ph(p[345t]?|tml)$\""
14
- when "pt"
15
- flags = "-S -G \"\\.ph(p[345t]?|tml)$\""
16
9
  when "grep"
17
10
  flags = [
18
11
  "-i",
@@ -20,9 +13,11 @@ class Zoom::Profile::UnsafePhp < superclass
20
13
  "--include=\"*.php[345t]\"",
21
14
  "--include=\"*.phtml\""
22
15
  ].join(" ")
16
+ when "pt"
17
+ flags = "-S -G \"\\.ph(p[345t]?|tml)$\""
23
18
  end
24
19
 
25
- super(n, op, flags, b, a)
20
+ super(n, nil, flags, b, a)
26
21
  # From here: https://www.eukhost.com/blog/webhosting/dangerous-php-functions-must-be-disabled/
27
22
  # OMG is anything safe?!
28
23
  @pattern = [
@@ -1,23 +1,18 @@
1
- require "zoom/profile_manager"
2
-
3
- clas = Zoom::ProfileManager.default_profile.capitalize
4
- superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
5
- class Zoom::Profile::UnsafePython < superclass
1
+ class Zoom::SecurityProfile::UnsafePython < Zoom::SecurityProfile
6
2
  def initialize(n, o = nil, f = "", b = "", a = "")
7
3
  flags = ""
8
- op = Zoom::ProfileManager.default_profile
9
- case op
4
+ case Zoom::ProfileManager.default_profile
10
5
  when /^ack(-grep)?$/
11
6
  flags = "--smart-case --python"
12
7
  when "ag"
13
8
  flags = "-S -G \"\\.py$\""
14
- when "pt"
15
- flags = "-S -G \"\\.py$\""
16
9
  when "grep"
17
10
  flags = "-i --include=\"*.py\""
11
+ when "pt"
12
+ flags = "-S -G \"\\.py$\""
18
13
  end
19
14
 
20
- super(n, op, flags, b, a)
15
+ super(n, nil, flags, b, a)
21
16
  @pattern = [
22
17
  "(",
23
18
  [
@@ -0,0 +1,41 @@
1
+ class Zoom::SecurityProfile::UnsafeRuby < Zoom::SecurityProfile
2
+ def initialize(n, o = nil, f = "", b = "", a = "")
3
+ flags = ""
4
+ case Zoom::ProfileManager.default_profile
5
+ when /^ack(-grep)?$/
6
+ flags = "--smart-case --ruby"
7
+ when "ag"
8
+ flags = [
9
+ "-S",
10
+ "-G \"\\.(erb|r(ake|b|html|js|xml)|spec)$|Rakefile\""
11
+ ].join(" ")
12
+ when "grep"
13
+ flags = [
14
+ "-i",
15
+ "--include=\"*.erb\"",
16
+ "--include=\"*.rake\"",
17
+ "--include=\"*.rb\"",
18
+ "--include=\"*.rhtml\"",
19
+ "--include=\"*.rjs\"",
20
+ "--include=\"*.rxml\"",
21
+ "--include=\"*.spec\"",
22
+ "--include=\"Rakefile\""
23
+ ].join(" ")
24
+ when "pt"
25
+ flags = [
26
+ "-S",
27
+ "-G \"\\.(erb|r(ake|b|html|js|xml)|spec)$|Rakefile\""
28
+ ].join(" ")
29
+ end
30
+
31
+ super(n, nil, flags, b, a)
32
+ @pattern = [
33
+ "%x\\(",
34
+ "\\.constantize",
35
+ "instance_eval",
36
+ "(public_)?send",
37
+ "system"
38
+ ].join("|")
39
+ @taggable = true
40
+ end
41
+ end
@@ -1,14 +1,7 @@
1
+ require "fagin"
1
2
  require "pathname"
2
3
  require "scoobydoo"
3
4
 
4
- # Load custom profiles
5
- config_dir = Pathname.new("~/.config/zoom").expand_path
6
- if (config_dir.exist?)
7
- Dir["#{config_dir}/*.rb"].each do |file|
8
- require_relative file
9
- end
10
- end
11
-
12
5
  class Zoom::ProfileManager
13
6
  @@ranking = [
14
7
  ["ag", "Zoom::Profile::Ag", "-Su"],
@@ -44,13 +37,15 @@ class Zoom::ProfileManager
44
37
  end
45
38
 
46
39
  def self.security_profiles
47
- return [
48
- Zoom::Profile::Passwords.new("passwords"),
49
- Zoom::Profile::UnsafeC.new("unsafe_c"),
50
- Zoom::Profile::UnsafeJava.new("unsafe_java"),
51
- Zoom::Profile::UnsafeJs.new("unsafe_js"),
52
- Zoom::Profile::UnsafePhp.new("unsafe_php"),
53
- Zoom::Profile::UnsafePython.new("unsafe_python")
54
- ]
40
+ profs = Array.new
41
+ Zoom::SecurityProfile.subclasses.each do |clas|
42
+ # Convert camelcase class to unscore separated string
43
+ name = clas.to_s.split("::")[-1]
44
+ name.gsub!(/([A-Z]+)([A-Z][a-z])/, "\\1_\\2")
45
+ name.gsub!(/([a-z0-9])([A-Z])/, "\\1_\\2")
46
+ name.tr!("-", "_")
47
+ profs.push(clas.new(name.downcase))
48
+ end
49
+ return profs
55
50
  end
56
51
  end
@@ -0,0 +1,7 @@
1
+ clas = Zoom::ProfileManager.default_profile.capitalize
2
+ superclass = Zoom::Profile.profile_by_name("Zoom::Profile::#{clas}")
3
+ class Zoom::SecurityProfile < superclass
4
+ def initialize(n, o = nil, f = "", b = "", a = "")
5
+ super(n, Zoom::ProfileManager.default_profile, f, b, a)
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.4
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -70,6 +70,26 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 2.0.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: fagin
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '1.0'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 1.0.0
73
93
  - !ruby/object:Gem::Dependency
74
94
  name: hilighter
75
95
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +199,9 @@ files:
179
199
  - lib/zoom/profile/unsafe_js.rb
180
200
  - lib/zoom/profile/unsafe_php.rb
181
201
  - lib/zoom/profile/unsafe_python.rb
202
+ - lib/zoom/profile/unsafe_ruby.rb
182
203
  - lib/zoom/profile_manager.rb
204
+ - lib/zoom/security_profile.rb
183
205
  - lib/zoom/wish/add_wish.rb
184
206
  - lib/zoom/wish/color_wish.rb
185
207
  - lib/zoom/wish/copy_wish.rb