本文整理汇总了Python中core.data.db.history.HistoryItem.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Python HistoryItem.getTableName方法的具体用法?Python HistoryItem.getTableName怎么用?Python HistoryItem.getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.data.db.history.HistoryItem
的用法示例。
在下文中一共展示了HistoryItem.getTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from core.data.db.history import HistoryItem [as 别名]
# 或者: from core.data.db.history.HistoryItem import getTableName [as 别名]
def __init__(self):
baseOutputPlugin.__init__(self)
if not kb.kb.getData('gtkOutput', 'db') == []:
# Restore it from the kb
self._db = kb.kb.getData('gtkOutput', 'db')
self.queue = kb.kb.getData('gtkOutput', 'queue')
else:
self.queue = Queue.Queue()
kb.kb.save('gtkOutput', 'queue' , self.queue)
# Create DB and add tables
sessionName = cf.cf.getData('sessionName')
dbName = os.path.join(get_home_dir(), 'sessions', 'db_' + sessionName)
# Just in case the directory doesn't exist...
try:
os.mkdir(os.path.join(get_home_dir() , 'sessions'))
except OSError, oe:
# [Errno 17] File exists
if oe.errno != 17:
msg = 'Unable to write to the user home directory: ' + get_home_dir()
raise w3afException( msg )
self._db = DB()
# Check if the database already exists
if os.path.exists(dbName):
# Find one that doesn't exist
for i in xrange(100):
newDbName = dbName + '-' + str(i)
if not os.path.exists(newDbName):
dbName = newDbName
break
# Create DB!
self._db.open(dbName)
# Create table
historyItem = HistoryItem(self._db)
self._db.createTable(historyItem.getTableName(),
historyItem.getColumns(),
historyItem.getPrimaryKeyColumns())
kb.kb.save('gtkOutput', 'db', self._db)