@@ -29,7 +29,7 @@ def initialize(info={})
29
29
def run
30
30
31
31
32
- oldversion = false
32
+ oldversion = false
33
33
34
34
case session . platform
35
35
when /linux/
@@ -38,7 +38,7 @@ def run
38
38
if ( user =~ /root/ )
39
39
user_base = "/root/"
40
40
else
41
- user_base = "/home/#{ user } /"
41
+ user_base = "/home/#{ user } /"
42
42
end
43
43
dbvis_file = "#{ user_base } .dbvis/config70/dbvis.xml"
44
44
when /win/
@@ -52,25 +52,25 @@ def run
52
52
53
53
54
54
unless file? ( dbvis_file )
55
- #File not found, we next try with the old config path
55
+ # File not found, we next try with the old config path
56
56
print_status ( "File not found: #{ dbvis_file } " )
57
57
print_status ( "This could be an older version of dbvis, trying old path" )
58
58
case session . platform
59
59
when /linux/
60
- dbvis_file = "#{ user_base } .dbvis/config/dbvis.xml"
60
+ dbvis_file = "#{ user_base } .dbvis/config/dbvis.xml"
61
61
when /win/
62
- dbvis_file = user_profile + "\\ .dbvis\\ config\\ dbvis.xml"
62
+ dbvis_file = user_profile + "\\ .dbvis\\ config\\ dbvis.xml"
63
63
end
64
64
unless file? ( dbvis_file )
65
65
print_error ( "File not found: #{ dbvis_file } " )
66
66
return
67
67
end
68
- oldversion = true
68
+ oldversion = true
69
69
end
70
70
71
71
72
- print_status ( "Reading: #{ dbvis_file } " )
73
- print_line ( )
72
+ print_status ( "Reading: #{ dbvis_file } " )
73
+ print_line ( )
74
74
raw_xml = ""
75
75
begin
76
76
raw_xml = read_file ( dbvis_file )
@@ -79,13 +79,13 @@ def run
79
79
print_error ( "Nothing read from file: #{ dbvis_file } , file may be empty" )
80
80
return
81
81
end
82
-
82
+
83
83
if oldversion
84
84
# Parse old config file
85
- db_table = pareseOldConfigFile ( raw_xml )
85
+ db_table = pareseOldConfigFile ( raw_xml )
86
86
else
87
87
# Parse new config file
88
- db_table = pareseNewConfigFile ( raw_xml )
88
+ db_table = pareseNewConfigFile ( raw_xml )
89
89
end
90
90
91
91
if db_table . rows . empty?
@@ -128,7 +128,7 @@ def pareseNewConfigFile(raw_xml)
128
128
"Namespace" ,
129
129
"Userid" ,
130
130
] )
131
-
131
+
132
132
dbs = [ ]
133
133
db = { }
134
134
dbfound = false
@@ -143,7 +143,7 @@ def pareseNewConfigFile(raw_xml)
143
143
if line =~ /<Database id=/
144
144
dbfound = true
145
145
elsif line =~ /<\/ Database>/
146
- dbfound = false
146
+ dbfound = false
147
147
if db [ :Database ] . nil?
148
148
db [ :Database ] = "" ;
149
149
end
@@ -193,7 +193,7 @@ def pareseNewConfigFile(raw_xml)
193
193
end
194
194
end
195
195
196
- # FIll the tab and report eligible servers
196
+ # Fill the tab and report eligible servers
197
197
dbs . each do |db |
198
198
if ::Rex ::Socket . is_ipv4? ( db [ :Server ] . to_s )
199
199
print_good ( "Reporting #{ db [ :Server ] } " )
@@ -219,7 +219,7 @@ def pareseOldConfigFile(raw_xml)
219
219
"Url" ,
220
220
"Userid" ,
221
221
] )
222
-
222
+
223
223
dbs = [ ]
224
224
db = { }
225
225
dbfound = false
@@ -235,7 +235,7 @@ def pareseOldConfigFile(raw_xml)
235
235
if line =~ /<Database id=/
236
236
dbfound = true
237
237
elsif line =~ /<\/ Database>/
238
- dbfound = false
238
+ dbfound = false
239
239
# save
240
240
dbs << db if ( db [ :Alias ] and db [ :Url ] )
241
241
db = { }
@@ -268,9 +268,9 @@ def pareseOldConfigFile(raw_xml)
268
268
dbs . each do |db |
269
269
if ( db [ :Url ] =~ /[\S +\s +]+[\/ ]+([\S +\s +]+):[\S +]+/i )
270
270
if ::Rex ::Socket . is_ipv4? ( $1. to_s )
271
- print_good ( "Reporting #{ $1} " )
272
- report_host ( :host => $1. to_s ) ;
273
- end
271
+ print_good ( "Reporting #{ $1} " )
272
+ report_host ( :host => $1. to_s )
273
+ end
274
274
end
275
275
db_table << [ db [ :Alias ] , db [ :Type ] , db [ :Url ] , db [ :Userid ] ]
276
276
end
@@ -279,12 +279,12 @@ def pareseOldConfigFile(raw_xml)
279
279
280
280
281
281
def findVersion ( tag )
282
- found = false
283
- if ( tag =~ /<Version>([\S +\s +]+)<\/ Version>/i )
284
- print_good ( "DbVisualizer version : #{ $1} " )
285
- found = true
286
- end
287
- return found
282
+ found = false
283
+ if ( tag =~ /<Version>([\S +\s +]+)<\/ Version>/i )
284
+ print_good ( "DbVisualizer version : #{ $1} " )
285
+ found = true
286
+ end
287
+ return found
288
288
end
289
289
290
290
end
0 commit comments