ronin-sql 0.2.4 → 1.0.0
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.
- data/.document +4 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +623 -288
- data/{History.txt → ChangeLog.md} +33 -35
- data/Gemfile +25 -0
- data/README.md +110 -0
- data/Rakefile +30 -20
- data/bin/ronin-sql +18 -5
- data/gemspec.yml +16 -0
- data/lib/ronin/formatting/extensions/sql.rb +4 -3
- data/lib/ronin/formatting/extensions/sql/string.rb +83 -10
- data/lib/ronin/formatting/sql.rb +4 -3
- data/lib/ronin/sql.rb +5 -12
- data/lib/ronin/{code/sql/create_index.rb → sql/binary_expr.rb} +25 -18
- data/lib/ronin/sql/clause.rb +72 -0
- data/lib/ronin/sql/clauses.rb +297 -0
- data/lib/ronin/sql/emittable.rb +84 -0
- data/lib/ronin/sql/emitter.rb +375 -0
- data/lib/ronin/sql/field.rb +106 -0
- data/lib/ronin/{code/sql/as.rb → sql/fields.rb} +36 -17
- data/lib/ronin/{code/sql/binary_expr.rb → sql/function.rb} +27 -27
- data/lib/ronin/sql/functions.rb +989 -0
- data/lib/ronin/sql/injection.rb +125 -157
- data/lib/ronin/{code/sql/default_values_clause.rb → sql/literal.rb} +13 -11
- data/lib/ronin/sql/literals.rb +72 -0
- data/lib/ronin/sql/operators.rb +332 -0
- data/lib/ronin/sql/sql.rb +86 -0
- data/lib/ronin/sql/statement.rb +70 -0
- data/lib/ronin/sql/statement_list.rb +110 -0
- data/lib/ronin/sql/statements.rb +115 -0
- data/lib/ronin/{code/sql/desc.rb → sql/unary_expr.rb} +11 -11
- data/lib/ronin/sql/version.rb +5 -4
- data/ronin-sql.gemspec +61 -0
- data/spec/formatting/sql/string_spec.rb +172 -0
- data/spec/spec_helper.rb +1 -4
- data/spec/sql/binary_expr.rb +5 -0
- data/spec/sql/binary_expr_examples.rb +25 -0
- data/spec/sql/clause_examples.rb +43 -0
- data/spec/sql/clause_spec.rb +31 -0
- data/spec/sql/clauses_spec.rb +43 -0
- data/spec/sql/emittable_spec.rb +41 -0
- data/spec/sql/emitter_spec.rb +472 -0
- data/spec/sql/field_spec.rb +103 -0
- data/spec/sql/fields_spec.rb +40 -0
- data/spec/sql/function_examples.rb +30 -0
- data/spec/sql/function_spec.rb +25 -0
- data/spec/sql/functions_spec.rb +110 -0
- data/spec/sql/injection_spec.rb +233 -0
- data/spec/sql/literal_spec.rb +5 -0
- data/spec/sql/literals_spec.rb +46 -0
- data/spec/sql/operators_spec.rb +44 -0
- data/spec/sql/sql_spec.rb +18 -0
- data/spec/sql/statement_examples.rb +39 -0
- data/spec/sql/statement_list_spec.rb +48 -0
- data/spec/sql/statement_sql.rb +38 -0
- data/spec/sql/statements_spec.rb +22 -0
- data/spec/sql/unary_expr.rb +5 -0
- data/spec/sql/unary_expr_examples.rb +20 -0
- metadata +116 -217
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -108
- data/README.txt +0 -112
- data/lib/ronin/code/sql.rb +0 -22
- data/lib/ronin/code/sql/add_column_clause.rb +0 -42
- data/lib/ronin/code/sql/alter_table.rb +0 -52
- data/lib/ronin/code/sql/asc.rb +0 -36
- data/lib/ronin/code/sql/between.rb +0 -66
- data/lib/ronin/code/sql/clause.rb +0 -35
- data/lib/ronin/code/sql/code.rb +0 -35
- data/lib/ronin/code/sql/common_dialect.rb +0 -66
- data/lib/ronin/code/sql/create.rb +0 -74
- data/lib/ronin/code/sql/create_table.rb +0 -44
- data/lib/ronin/code/sql/create_view.rb +0 -41
- data/lib/ronin/code/sql/delete.rb +0 -52
- data/lib/ronin/code/sql/dialect.rb +0 -282
- data/lib/ronin/code/sql/drop.rb +0 -55
- data/lib/ronin/code/sql/drop_index.rb +0 -41
- data/lib/ronin/code/sql/drop_table.rb +0 -41
- data/lib/ronin/code/sql/drop_view.rb +0 -41
- data/lib/ronin/code/sql/emittable.rb +0 -100
- data/lib/ronin/code/sql/exceptions.rb +0 -24
- data/lib/ronin/code/sql/exceptions/unknown_clause.rb +0 -29
- data/lib/ronin/code/sql/exceptions/unknown_dialect.rb +0 -29
- data/lib/ronin/code/sql/exceptions/unknown_statement.rb +0 -29
- data/lib/ronin/code/sql/expr.rb +0 -102
- data/lib/ronin/code/sql/field.rb +0 -101
- data/lib/ronin/code/sql/fields_clause.rb +0 -46
- data/lib/ronin/code/sql/from_clause.rb +0 -42
- data/lib/ronin/code/sql/function.rb +0 -53
- data/lib/ronin/code/sql/group_by_clause.rb +0 -46
- data/lib/ronin/code/sql/having_clause.rb +0 -46
- data/lib/ronin/code/sql/in.rb +0 -47
- data/lib/ronin/code/sql/injected_statement.rb +0 -100
- data/lib/ronin/code/sql/injection.rb +0 -203
- data/lib/ronin/code/sql/insert.rb +0 -54
- data/lib/ronin/code/sql/intersect_clause.rb +0 -42
- data/lib/ronin/code/sql/join_clause.rb +0 -123
- data/lib/ronin/code/sql/like.rb +0 -73
- data/lib/ronin/code/sql/limit_clause.rb +0 -42
- data/lib/ronin/code/sql/modifier.rb +0 -48
- data/lib/ronin/code/sql/offset_clause.rb +0 -42
- data/lib/ronin/code/sql/on_clause.rb +0 -55
- data/lib/ronin/code/sql/order_by_clause.rb +0 -42
- data/lib/ronin/code/sql/program.rb +0 -225
- data/lib/ronin/code/sql/rename_to_clause.rb +0 -42
- data/lib/ronin/code/sql/replace.rb +0 -54
- data/lib/ronin/code/sql/select.rb +0 -103
- data/lib/ronin/code/sql/set_clause.rb +0 -42
- data/lib/ronin/code/sql/statement.rb +0 -180
- data/lib/ronin/code/sql/token.rb +0 -62
- data/lib/ronin/code/sql/unary_expr.rb +0 -47
- data/lib/ronin/code/sql/union_all_clause.rb +0 -42
- data/lib/ronin/code/sql/union_clause.rb +0 -42
- data/lib/ronin/code/sql/update.rb +0 -52
- data/lib/ronin/code/sql/values_clause.rb +0 -46
- data/lib/ronin/code/sql/where_clause.rb +0 -42
- data/lib/ronin/sql/error.rb +0 -26
- data/lib/ronin/sql/error/error.rb +0 -62
- data/lib/ronin/sql/error/extensions.rb +0 -22
- data/lib/ronin/sql/error/extensions/string.rb +0 -77
- data/lib/ronin/sql/error/message.rb +0 -62
- data/lib/ronin/sql/error/pattern.rb +0 -104
- data/lib/ronin/sql/error/patterns.rb +0 -99
- data/lib/ronin/sql/extensions.rb +0 -22
- data/lib/ronin/sql/extensions/uri.rb +0 -22
- data/lib/ronin/sql/extensions/uri/http.rb +0 -107
- data/spec/code/sql/common_dialect_spec.rb +0 -205
- data/spec/code/sql/create_examples.rb +0 -19
- data/spec/code/sql/create_index_spec.rb +0 -25
- data/spec/code/sql/create_table_spec.rb +0 -27
- data/spec/code/sql/create_view_spec.rb +0 -16
- data/spec/code/sql/delete_spec.rb +0 -14
- data/spec/code/sql/drop_examples.rb +0 -10
- data/spec/code/sql/drop_index_spec.rb +0 -16
- data/spec/code/sql/drop_table_spec.rb +0 -16
- data/spec/code/sql/drop_view_spec.rb +0 -16
- data/spec/code/sql/has_default_values_clause_examples.rb +0 -10
- data/spec/code/sql/has_fields_clause_examples.rb +0 -15
- data/spec/code/sql/has_from_clause_examples.rb +0 -13
- data/spec/code/sql/has_values_clause_examples.rb +0 -15
- data/spec/code/sql/has_where_clause_examples.rb +0 -15
- data/spec/code/sql/insert_spec.rb +0 -21
- data/spec/code/sql/replace_spec.rb +0 -21
- data/spec/code/sql/select_spec.rb +0 -105
- data/spec/code/sql/update_spec.rb +0 -26
- data/spec/helpers/code.rb +0 -14
- data/spec/sql/error_spec.rb +0 -24
- data/spec/sql/extensions/uri/http_spec.rb +0 -34
- data/spec/sql_spec.rb +0 -9
- data/tasks/spec.rb +0 -10
- data/tasks/yard.rb +0 -13
- metadata.gz.sig +0 -0
data.tar.gz.sig
DELETED
|
Binary file
|
data/Manifest.txt
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
History.txt
|
|
2
|
-
COPYING.txt
|
|
3
|
-
Manifest.txt
|
|
4
|
-
README.txt
|
|
5
|
-
Rakefile
|
|
6
|
-
bin/ronin-sql
|
|
7
|
-
lib/ronin/code/sql.rb
|
|
8
|
-
lib/ronin/code/sql/exceptions.rb
|
|
9
|
-
lib/ronin/code/sql/exceptions/unknown_dialect.rb
|
|
10
|
-
lib/ronin/code/sql/exceptions/unknown_statement.rb
|
|
11
|
-
lib/ronin/code/sql/exceptions/unknown_clause.rb
|
|
12
|
-
lib/ronin/code/sql/add_column_clause.rb
|
|
13
|
-
lib/ronin/code/sql/alter_table.rb
|
|
14
|
-
lib/ronin/code/sql/asc.rb
|
|
15
|
-
lib/ronin/code/sql/as.rb
|
|
16
|
-
lib/ronin/code/sql/between.rb
|
|
17
|
-
lib/ronin/code/sql/binary_expr.rb
|
|
18
|
-
lib/ronin/code/sql/clause.rb
|
|
19
|
-
lib/ronin/code/sql/code.rb
|
|
20
|
-
lib/ronin/code/sql/common_dialect.rb
|
|
21
|
-
lib/ronin/code/sql/create_index.rb
|
|
22
|
-
lib/ronin/code/sql/create.rb
|
|
23
|
-
lib/ronin/code/sql/create_table.rb
|
|
24
|
-
lib/ronin/code/sql/create_view.rb
|
|
25
|
-
lib/ronin/code/sql/default_values_clause.rb
|
|
26
|
-
lib/ronin/code/sql/delete.rb
|
|
27
|
-
lib/ronin/code/sql/desc.rb
|
|
28
|
-
lib/ronin/code/sql/dialect.rb
|
|
29
|
-
lib/ronin/code/sql/drop_index.rb
|
|
30
|
-
lib/ronin/code/sql/drop.rb
|
|
31
|
-
lib/ronin/code/sql/drop_table.rb
|
|
32
|
-
lib/ronin/code/sql/drop_view.rb
|
|
33
|
-
lib/ronin/code/sql/emittable.rb
|
|
34
|
-
lib/ronin/code/sql/exceptions.rb
|
|
35
|
-
lib/ronin/code/sql/expr.rb
|
|
36
|
-
lib/ronin/code/sql/field.rb
|
|
37
|
-
lib/ronin/code/sql/fields_clause.rb
|
|
38
|
-
lib/ronin/code/sql/from_clause.rb
|
|
39
|
-
lib/ronin/code/sql/function.rb
|
|
40
|
-
lib/ronin/code/sql/group_by_clause.rb
|
|
41
|
-
lib/ronin/code/sql/having_clause.rb
|
|
42
|
-
lib/ronin/code/sql/injected_statement.rb
|
|
43
|
-
lib/ronin/code/sql/injection.rb
|
|
44
|
-
lib/ronin/code/sql/in.rb
|
|
45
|
-
lib/ronin/code/sql/insert.rb
|
|
46
|
-
lib/ronin/code/sql/intersect_clause.rb
|
|
47
|
-
lib/ronin/code/sql/join_clause.rb
|
|
48
|
-
lib/ronin/code/sql/like.rb
|
|
49
|
-
lib/ronin/code/sql/limit_clause.rb
|
|
50
|
-
lib/ronin/code/sql/modifier.rb
|
|
51
|
-
lib/ronin/code/sql/offset_clause.rb
|
|
52
|
-
lib/ronin/code/sql/on_clause.rb
|
|
53
|
-
lib/ronin/code/sql/order_by_clause.rb
|
|
54
|
-
lib/ronin/code/sql/program.rb
|
|
55
|
-
lib/ronin/code/sql/rename_to_clause.rb
|
|
56
|
-
lib/ronin/code/sql/replace.rb
|
|
57
|
-
lib/ronin/code/sql/select.rb
|
|
58
|
-
lib/ronin/code/sql/set_clause.rb
|
|
59
|
-
lib/ronin/code/sql/statement.rb
|
|
60
|
-
lib/ronin/code/sql/token.rb
|
|
61
|
-
lib/ronin/code/sql/unary_expr.rb
|
|
62
|
-
lib/ronin/code/sql/union_all_clause.rb
|
|
63
|
-
lib/ronin/code/sql/union_clause.rb
|
|
64
|
-
lib/ronin/code/sql/update.rb
|
|
65
|
-
lib/ronin/code/sql/values_clause.rb
|
|
66
|
-
lib/ronin/code/sql/where_clause.rb
|
|
67
|
-
lib/ronin/formatting/sql.rb
|
|
68
|
-
lib/ronin/formatting/extensions/sql.rb
|
|
69
|
-
lib/ronin/formatting/extensions/sql/string.rb
|
|
70
|
-
lib/ronin/sql/extensions.rb
|
|
71
|
-
lib/ronin/sql/extensions/uri.rb
|
|
72
|
-
lib/ronin/sql/extensions/uri/http.rb
|
|
73
|
-
lib/ronin/sql/error.rb
|
|
74
|
-
lib/ronin/sql/error/extensions.rb
|
|
75
|
-
lib/ronin/sql/error/extensions/string.rb
|
|
76
|
-
lib/ronin/sql/error/message.rb
|
|
77
|
-
lib/ronin/sql/error/pattern.rb
|
|
78
|
-
lib/ronin/sql/error/error.rb
|
|
79
|
-
lib/ronin/sql/error/patterns.rb
|
|
80
|
-
lib/ronin/sql/injection.rb
|
|
81
|
-
lib/ronin/sql/version.rb
|
|
82
|
-
lib/ronin/sql.rb
|
|
83
|
-
tasks/spec.rb
|
|
84
|
-
tasks/yard.rb
|
|
85
|
-
spec/spec_helper.rb
|
|
86
|
-
spec/sql_spec.rb
|
|
87
|
-
spec/helpers/code.rb
|
|
88
|
-
spec/code/sql/has_default_values_clause_examples.rb
|
|
89
|
-
spec/code/sql/has_fields_clause_examples.rb
|
|
90
|
-
spec/code/sql/has_from_clause_examples.rb
|
|
91
|
-
spec/code/sql/has_values_clause_examples.rb
|
|
92
|
-
spec/code/sql/has_where_clause_examples.rb
|
|
93
|
-
spec/code/sql/create_examples.rb
|
|
94
|
-
spec/code/sql/create_table_spec.rb
|
|
95
|
-
spec/code/sql/create_index_spec.rb
|
|
96
|
-
spec/code/sql/create_view_spec.rb
|
|
97
|
-
spec/code/sql/drop_examples.rb
|
|
98
|
-
spec/code/sql/drop_table_spec.rb
|
|
99
|
-
spec/code/sql/drop_index_spec.rb
|
|
100
|
-
spec/code/sql/drop_view_spec.rb
|
|
101
|
-
spec/code/sql/insert_spec.rb
|
|
102
|
-
spec/code/sql/select_spec.rb
|
|
103
|
-
spec/code/sql/update_spec.rb
|
|
104
|
-
spec/code/sql/replace_spec.rb
|
|
105
|
-
spec/code/sql/delete_spec.rb
|
|
106
|
-
spec/code/sql/common_dialect_spec.rb
|
|
107
|
-
spec/sql/error_spec.rb
|
|
108
|
-
spec/sql/extensions/uri/http_spec.rb
|
data/README.txt
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
= Ronin SQL
|
|
2
|
-
|
|
3
|
-
* http://ronin.rubyforge.org/sql/
|
|
4
|
-
* http://github.com/postmodern/ronin-sql
|
|
5
|
-
* irc.freenode.net #ronin
|
|
6
|
-
* Postmodern (postmodern.mod3 at gmail.com)
|
|
7
|
-
|
|
8
|
-
== DESCRIPTION:
|
|
9
|
-
|
|
10
|
-
Ronin SQL is a Ruby library for Ronin that provids support for SQL related
|
|
11
|
-
security tasks.
|
|
12
|
-
|
|
13
|
-
Ronin is a Ruby platform for exploit development and security research.
|
|
14
|
-
Ronin allows for the rapid development and distribution of code, exploits
|
|
15
|
-
or payloads over many common Source-Code-Management (SCM) systems.
|
|
16
|
-
|
|
17
|
-
=== Ruby
|
|
18
|
-
|
|
19
|
-
Ronin's Ruby environment allows security researchers to leverage Ruby with
|
|
20
|
-
ease. The Ruby environment contains a multitude of convenience methods
|
|
21
|
-
for working with data in Ruby, a Ruby Object Database, a customized Ruby
|
|
22
|
-
Console and an extendable command-line interface.
|
|
23
|
-
|
|
24
|
-
=== Extend
|
|
25
|
-
|
|
26
|
-
Ronin's more specialized features are provided by additional Ronin
|
|
27
|
-
libraries, which users can choose to install. These libraries can allow
|
|
28
|
-
one to write and run Exploits and Payloads, scan for PHP vulnerabilities,
|
|
29
|
-
perform Google Dorks or run 3rd party scanners.
|
|
30
|
-
|
|
31
|
-
=== Publish
|
|
32
|
-
|
|
33
|
-
Ronin allows users to publish and share code, exploits, payloads or other
|
|
34
|
-
data via Overlays. Overlays are directories of code and data that can be
|
|
35
|
-
hosted on any SVN, Hg, Git or Rsync server. Ronin makes it easy to create,
|
|
36
|
-
install or update Overlays.
|
|
37
|
-
|
|
38
|
-
== FEATURES:
|
|
39
|
-
|
|
40
|
-
* Provides an Domain Specific Language (DSL) for crafting normal SQL and
|
|
41
|
-
SQL injections.
|
|
42
|
-
* Provides tests for finding SQL injections.
|
|
43
|
-
|
|
44
|
-
== SYNOPSIS:
|
|
45
|
-
|
|
46
|
-
* Start the Ronin Console with Ronin SQL preloaded:
|
|
47
|
-
|
|
48
|
-
$ ronin-sql
|
|
49
|
-
|
|
50
|
-
== EXAMPLES:
|
|
51
|
-
|
|
52
|
-
* Generate valid SQL using the Ronin SQL DSL:
|
|
53
|
-
|
|
54
|
-
Code.sql {
|
|
55
|
-
select(:from => :users, :where => (name == 'bob'))
|
|
56
|
-
}.to_s
|
|
57
|
-
# => "SELECT * FROM users WHERE name = 'bob'"
|
|
58
|
-
|
|
59
|
-
* Generate valid SQL injections using the Ronin SQL injection DSL:
|
|
60
|
-
|
|
61
|
-
Code.sql_injection {
|
|
62
|
-
escape_string { has_table?(:users) }
|
|
63
|
-
}.to_s
|
|
64
|
-
# => "' AND (SELECT count(*) FROM users) = 1 --"
|
|
65
|
-
|
|
66
|
-
* Test a URL for SQL Injection (SQLi):
|
|
67
|
-
|
|
68
|
-
require 'ronin/sql'
|
|
69
|
-
|
|
70
|
-
url = URI('http://redteatrosalternativos.com/_05enlaces/links/phpHoo3.php?viewCat=1')
|
|
71
|
-
url.has_sqli?
|
|
72
|
-
# => true
|
|
73
|
-
|
|
74
|
-
* Get the first viable SQLi vulnerability:
|
|
75
|
-
|
|
76
|
-
url.first_sqli
|
|
77
|
-
# => #<Ronin::SQL::Injection:0x67d6d38cba60 @http_method=:get, @url=#<URI::HTTP:0x67d6d8697190 URL:http://redteatrosalternativos.com/_05enlaces/links/phpHoo3.php?viewCat=1>, @params={:http_method=>:get}, @sql_options={:escape=>"1"}, @param="viewCat">
|
|
78
|
-
|
|
79
|
-
* Scan a URL for SQLi vulnerabilities:
|
|
80
|
-
|
|
81
|
-
url.sqli_scan
|
|
82
|
-
# => [#<Ronin::SQL::Injection:0x67d6d38792d8 @http_method=:get, @url=#<URI::HTTP:0x67d6d8697190 URL:http://redteatrosalternativos.com/_05enlaces/links/phpHoo3.php?viewCat=1>, @params={:http_method=>:get}, @sql_options={:escape=>"1"}, @param="viewCat">]
|
|
83
|
-
|
|
84
|
-
== REQUIREMENTS:
|
|
85
|
-
|
|
86
|
-
* {ronin}[http://ronin.rubyforge.org/] >= 0.3.0
|
|
87
|
-
* {ronin-web}[http://ronin.rubyforge.org/web/] >= 0.2.0
|
|
88
|
-
|
|
89
|
-
== INSTALL:
|
|
90
|
-
|
|
91
|
-
$ sudo gem install ronin-sql
|
|
92
|
-
|
|
93
|
-
== LICENSE:
|
|
94
|
-
|
|
95
|
-
Ronin SQL - A Ruby library for Ronin that provids support for SQL related
|
|
96
|
-
security tasks.
|
|
97
|
-
|
|
98
|
-
Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
99
|
-
|
|
100
|
-
This program is free software; you can redistribute it and/or modify
|
|
101
|
-
it under the terms of the GNU General Public License as published by
|
|
102
|
-
the Free Software Foundation; either version 2 of the License, or
|
|
103
|
-
(at your option) any later version.
|
|
104
|
-
|
|
105
|
-
This program is distributed in the hope that it will be useful,
|
|
106
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
107
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
108
|
-
GNU General Public License for more details.
|
|
109
|
-
|
|
110
|
-
You should have received a copy of the GNU General Public License
|
|
111
|
-
along with this program; if not, write to the Free Software
|
|
112
|
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
data/lib/ronin/code/sql.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin SQL - A Ronin library providing support for SQL related security
|
|
3
|
-
# tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program 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 General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/code/sql/code'
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin SQL - A Ronin library providing support for SQL related security
|
|
3
|
-
# tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program 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 General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/code/sql/clause'
|
|
23
|
-
|
|
24
|
-
module Ronin
|
|
25
|
-
module Code
|
|
26
|
-
module SQL
|
|
27
|
-
class AddColumnClause < Clause
|
|
28
|
-
|
|
29
|
-
attr_accessor :table
|
|
30
|
-
|
|
31
|
-
def initialize(table)
|
|
32
|
-
@table = table
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def emit
|
|
36
|
-
emit_token('ADD COLUMN') + emit_value(@table)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin SQL - A Ronin library providing support for SQL related security
|
|
3
|
-
# tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program 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 General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/code/sql/statement'
|
|
23
|
-
require 'ronin/code/sql/rename_to_clause'
|
|
24
|
-
require 'ronin/code/sql/add_column_clause'
|
|
25
|
-
|
|
26
|
-
module Ronin
|
|
27
|
-
module Code
|
|
28
|
-
module SQL
|
|
29
|
-
class AlterTable < Statement
|
|
30
|
-
|
|
31
|
-
clause :rename_to, RenameToClause
|
|
32
|
-
clause :add_column, AddColumnClause
|
|
33
|
-
|
|
34
|
-
def initialize(dialect,table=nil,options={},&block)
|
|
35
|
-
@table = table
|
|
36
|
-
|
|
37
|
-
super(dialect,options,&block)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def table(name=nil)
|
|
41
|
-
@table = name if name
|
|
42
|
-
return @table
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def emit
|
|
46
|
-
emit_token('ALTER TABLE') + emit_value(@table) + super
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
data/lib/ronin/code/sql/asc.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin SQL - A Ronin library providing support for SQL related security
|
|
3
|
-
# tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program 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 General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/code/sql/modifier'
|
|
23
|
-
|
|
24
|
-
module Ronin
|
|
25
|
-
module Code
|
|
26
|
-
module SQL
|
|
27
|
-
class Asc < Modifier
|
|
28
|
-
|
|
29
|
-
def initialize(expr)
|
|
30
|
-
super(expr,'ASC')
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Ronin SQL - A Ronin library providing support for SQL related security
|
|
3
|
-
# tasks.
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
6
|
-
#
|
|
7
|
-
# This program is free software; you can redistribute it and/or modify
|
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
|
9
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
10
|
-
# (at your option) any later version.
|
|
11
|
-
#
|
|
12
|
-
# This program 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 General Public License for more details.
|
|
16
|
-
#
|
|
17
|
-
# You should have received a copy of the GNU General Public License
|
|
18
|
-
# along with this program; if not, write to the Free Software
|
|
19
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require 'ronin/code/sql/expr'
|
|
23
|
-
|
|
24
|
-
module Ronin
|
|
25
|
-
module Code
|
|
26
|
-
module SQL
|
|
27
|
-
class Between < Expr
|
|
28
|
-
|
|
29
|
-
# Expression
|
|
30
|
-
attr_reader :expr
|
|
31
|
-
|
|
32
|
-
# Lower bound
|
|
33
|
-
attr_reader :lower
|
|
34
|
-
|
|
35
|
-
# Higher bound
|
|
36
|
-
attr_reader :higher
|
|
37
|
-
|
|
38
|
-
def initialize(expr,lower,higher)
|
|
39
|
-
@expr = expr
|
|
40
|
-
@lower = lower
|
|
41
|
-
@higher = higher
|
|
42
|
-
@negated = false
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def not!
|
|
46
|
-
@negated = true
|
|
47
|
-
return self
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def emit
|
|
51
|
-
tokens = emit_value(@expr)
|
|
52
|
-
|
|
53
|
-
tokens += emit_token('NOT') if @negated
|
|
54
|
-
tokens += emit_token('BETWEEN')
|
|
55
|
-
|
|
56
|
-
tokens += emit_value(@lower)
|
|
57
|
-
tokens += emit_token('AND')
|
|
58
|
-
tokens += emit_value(@higher)
|
|
59
|
-
|
|
60
|
-
return tokens
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|