From ef1180c3c24199d95caa162ca5fc57af44f0bcdf Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sat, 9 Jan 2010 21:39:10 +0000 Subject: [PATCH] Ask also which table(s) to enumerate from when --dump and -C are provided (but not -T) and minor layout adjustment --- plugins/generic/enumeration.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 06e5f88ee..18623a84c 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -1141,11 +1141,11 @@ class Enumeration: message = "do you want to dump entries? [Y/n] " output = readInput(message, default="Y") - if output not in ("y", "Y"): + if output and output[0] not in ("y", "Y"): return dumpFromDbs = [] - message = "which database?\n[a]ll (default)\n" + message = "which database(s)?\n[a]ll (default)\n" for db in dbs: message += "[%s]\n" % db @@ -1153,10 +1153,10 @@ class Enumeration: message += "[q]uit" test = readInput(message, default="a") - if not test or test[0] in ("a", "A"): + if not test or test in ("a", "A"): dumpFromDbs = dbs.keys() - elif test[0] in ("q", "Q"): + elif test in ("q", "Q"): return else: @@ -1167,8 +1167,33 @@ class Enumeration: continue conf.db = db + dumpFromTbls = [] + message = "which table(s) of database '%s'?\n" % db + message += "[a]ll (default)\n" + + for tbl in tblData: + message += "[%s]\n" % tbl + + message += "[s]kip\n" + message += "[q]uit" + test = readInput(message, default="a") + + if not test or test in ("a", "A"): + dumpFromTbls = tblData + + elif test in ("s", "S"): + continue + + elif test in ("q", "Q"): + return + + else: + dumpFromTbls = test.replace(" ", "").split(",") for table, columns in tblData.items(): + if table not in dumpFromTbls: + continue + conf.tbl = table conf.col = ",".join(column for column in columns) kb.data.cachedColumns = {}