Skip to content

Commit 526538e

Browse files
committed
Added dbvis version find and print
1 parent 97dcc56 commit 526538e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

modules/post/multi/gather/dbvis_enum.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def run
7070

7171

7272
print_status("Reading: #{dbvis_file}")
73+
print_line()
7374
raw_xml = ""
7475
begin
7576
raw_xml = read_file(dbvis_file)
@@ -93,7 +94,7 @@ def run
9394
print_line("\n")
9495
print_line(db_table.to_s)
9596
print_good("Try to query listed databases with dbviscmd.sh (or .bat) -connection <alias> -sql <statements> and have fun !")
96-
print_good("")
97+
print_line()
9798
# store found databases
9899
p = store_loot(
99100
"dbvis.databases",
@@ -131,9 +132,14 @@ def pareseNewConfigFile(raw_xml)
131132
dbs = []
132133
db = {}
133134
dbfound = false
134-
135+
versionFound = false
135136
# fetch config file
136137
raw_xml.each_line do |line|
138+
139+
if versionFound == false
140+
vesrionFound = findVersion(line)
141+
end
142+
137143
if line =~ /<Database id=/
138144
dbfound = true
139145
elsif line =~ /<\/Database>/
@@ -217,9 +223,15 @@ def pareseOldConfigFile(raw_xml)
217223
dbs = []
218224
db = {}
219225
dbfound = false
226+
versionFound = false
220227

221228
# fetch config file
222229
raw_xml.each_line do |line|
230+
231+
if versionFound == false
232+
vesrionFound = findVersion(line)
233+
end
234+
223235
if line =~ /<Database id=/
224236
dbfound = true
225237
elsif line =~ /<\/Database>/
@@ -266,4 +278,13 @@ def pareseOldConfigFile(raw_xml)
266278
end
267279

268280

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
288+
end
289+
269290
end

0 commit comments

Comments
 (0)