ronin-code-sql 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-code-sql - A Ruby DSL for crafting SQL Injections.
4
4
  #
5
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-code-sql is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,8 +18,8 @@
18
18
  # along with ronin-code-sql. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/code/sql/statement_list'
22
- require 'ronin/code/sql/injection'
21
+ require_relative 'sql/mixin'
22
+ require_relative 'sqli'
23
23
 
24
24
  module Ronin
25
25
  module Code
@@ -30,67 +30,8 @@ module Ronin
30
30
  # @see http://en.wikipedia.org/wiki/SQL_injection
31
31
  #
32
32
  module SQL
33
-
34
- #
35
- # Creates a new SQL statement list.
36
- #
37
- # @yield [(statements)]
38
- # If a block is given, it will be evaluated within the statement list.
39
- # If the block accepts an argument, the block will be called with the
40
- # new statement list.
41
- #
42
- # @yieldparam [StatementList] statements
43
- # The new statement list.
44
- #
45
- # @return [StatementList]
46
- # The new SQL statement list.
47
- #
48
- # @example
49
- # sql { select(1,2,3,4,id).from(users) }
50
- # # => #<Ronin::Code::SQL::StatementList: SELECT (1,2,3,4,id) FROM users>
51
- #
52
- # @api public
53
- #
54
- def sql(&block)
55
- StatementList.new(&block)
56
- end
57
-
58
- #
59
- # Creates a new SQL injection (SQLi)
60
- #
61
- # @param [Hash{Symbol => Object}] kwargs
62
- # Additional keyword arguments for {Injection#initialize}.
63
- #
64
- # @option kwargs [:integer, :decimal, :string, :column] :escape
65
- # The type of element to escape out of.
66
- #
67
- # @option kwargs [Boolean] :terminate
68
- # Specifies whether to terminate the SQLi with a comment.
69
- #
70
- # @option kwargs [String, Symbol, Integer] :place_holder
71
- # Place-holder data.
72
- #
73
- # @yield [(injection)]
74
- # If a block is given, it will be evaluated within the injection.
75
- # If the block accepts an argument, the block will be called with the
76
- # new injection.
77
- #
78
- # @yieldparam [Injection] injection
79
- # The new injection.
80
- #
81
- # @return [Injection]
82
- # The new SQL injection.
83
- #
84
- # @example
85
- # sqli { self.and { 1 == 1 }.select(1,2,3,4,id).from(users) }
86
- # # => #<Ronin::Code::SQL::Injection: 1 AND 1=1; SELECT (1,2,3,4,id) FROM users; SELECT (1,2,3,4,id) FROM users>
87
- #
88
- # @api public
89
- #
90
- def sqli(**kwargs,&block)
91
- Injection.new(**kwargs,&block)
92
- end
93
-
33
+ include Mixin
34
+ extend Mixin
94
35
  end
95
36
  end
96
37
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-code-sql - A Ruby DSL for crafting SQL Injections.
4
+ #
5
+ # Copyright (c) 2007-2025 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-code-sql is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-code-sql is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-code-sql. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require_relative 'sql/injection'
22
+
23
+ module Ronin
24
+ module Code
25
+ # Alias for {SQL::Injection}.
26
+ #
27
+ # @since 2.1.0
28
+ SQLI = SQL::Injection
29
+ end
30
+ end
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
4
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.homepage = gemspec['homepage']
23
23
  gem.metadata = gemspec['metadata'] if gemspec['metadata']
24
24
 
25
- glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+ glob = ->(patterns) { gem.files & Dir[*patterns] }
26
26
 
27
27
  gem.files = `git ls-files`.split($/)
28
28
  gem.files = glob[gemspec['files']] if gemspec['files']
@@ -33,7 +33,6 @@ Gem::Specification.new do |gem|
33
33
  gem.executables = gemspec.fetch('executables') do
34
34
  glob['bin/*'].map { |path| File.basename(path) }
35
35
  end
36
- gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
37
36
 
38
37
  gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
39
38
  gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
@@ -47,7 +46,7 @@ Gem::Specification.new do |gem|
47
46
  gem.required_rubygems_version = gemspec['required_rubygems_version']
48
47
  gem.post_install_message = gemspec['post_install_message']
49
48
 
50
- split = lambda { |string| string.split(/,\s*/) }
49
+ split = ->(string) { string.split(/,\s*/) }
51
50
 
52
51
  if gemspec['dependencies']
53
52
  gemspec['dependencies'].each do |name,versions|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-code-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2025-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ronin-support
@@ -53,6 +53,7 @@ files:
53
53
  - ".gitignore"
54
54
  - ".mailmap"
55
55
  - ".rspec"
56
+ - ".rubocop.yml"
56
57
  - ".ruby-version"
57
58
  - ".yardopts"
58
59
  - COPYING.txt
@@ -75,16 +76,18 @@ files:
75
76
  - lib/ronin/code/sql/injection_expr.rb
76
77
  - lib/ronin/code/sql/literal.rb
77
78
  - lib/ronin/code/sql/literals.rb
79
+ - lib/ronin/code/sql/mixin.rb
78
80
  - lib/ronin/code/sql/operators.rb
79
81
  - lib/ronin/code/sql/statement.rb
80
82
  - lib/ronin/code/sql/statement_list.rb
81
83
  - lib/ronin/code/sql/statements.rb
82
84
  - lib/ronin/code/sql/unary_expr.rb
83
85
  - lib/ronin/code/sql/version.rb
86
+ - lib/ronin/code/sqli.rb
84
87
  - ronin-code-sql.gemspec
85
88
  homepage: https://github.com/ronin-rb/ronin-code-sql#readme
86
89
  licenses:
87
- - LGPL-3.0
90
+ - LGPL-3.0-or-later
88
91
  metadata:
89
92
  documentation_uri: https://ronin-rb.dev/docs/ronin-code-sql
90
93
  source_code_uri: https://github.com/ronin-rb/ronin-code-sql
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
109
  - !ruby/object:Gem::Version
107
110
  version: '0'
108
111
  requirements: []
109
- rubygems_version: 3.3.26
112
+ rubygems_version: 3.5.22
110
113
  signing_key:
111
114
  specification_version: 4
112
115
  summary: A Ruby DSL for crafting SQL Injections.