2008-10-15 19:38:22 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
2008-10-15 19:56:32 +04:00
|
|
|
$Id$
|
2008-10-15 19:38:22 +04:00
|
|
|
|
2010-10-14 18:41:14 +04:00
|
|
|
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
2010-10-15 03:18:29 +04:00
|
|
|
See the file 'doc/COPYING' for copying permission
|
2008-10-15 19:38:22 +04:00
|
|
|
"""
|
|
|
|
|
2011-01-16 02:54:03 +03:00
|
|
|
from lib.core.common import readInput
|
2011-01-14 14:55:20 +03:00
|
|
|
from lib.core.data import kb
|
2011-01-16 02:54:03 +03:00
|
|
|
from lib.core.data import logger
|
2008-10-15 19:38:22 +04:00
|
|
|
from lib.core.exception import sqlmapUndefinedMethod
|
|
|
|
|
|
|
|
class Fingerprint:
|
|
|
|
"""
|
|
|
|
This class defines generic fingerprint functionalities for plugins.
|
|
|
|
"""
|
|
|
|
|
2011-01-14 14:55:20 +03:00
|
|
|
def __init__(self, dbms):
|
2011-01-18 00:13:59 +03:00
|
|
|
kb.misc.forcedDbms = dbms
|
2008-10-15 19:38:22 +04:00
|
|
|
|
|
|
|
def getFingerprint(self):
|
|
|
|
errMsg = "'getFingerprint' method must be defined "
|
|
|
|
errMsg += "into the specific DBMS plugin"
|
|
|
|
raise sqlmapUndefinedMethod, errMsg
|
|
|
|
|
|
|
|
def checkDbms(self):
|
|
|
|
errMsg = "'checkDbms' method must be defined "
|
|
|
|
errMsg += "into the specific DBMS plugin"
|
|
|
|
raise sqlmapUndefinedMethod, errMsg
|
2010-03-18 20:20:54 +03:00
|
|
|
|
2010-03-23 01:57:57 +03:00
|
|
|
def checkDbmsOs(self, detailed=False):
|
|
|
|
errMsg = "'checkDbmsOs' method must be defined "
|
|
|
|
errMsg += "into the specific DBMS plugin"
|
|
|
|
raise sqlmapUndefinedMethod, errMsg
|
|
|
|
|
2010-03-18 20:20:54 +03:00
|
|
|
def forceDbmsEnum(self):
|
|
|
|
pass
|
2011-01-16 02:54:03 +03:00
|
|
|
|
|
|
|
def userChooseDbmsOs(self):
|
|
|
|
warnMsg = "for some reason sqlmap was unable to fingerprint "
|
|
|
|
warnMsg += "the back-end DBMS operating system"
|
|
|
|
logger.warn(warnMsg)
|
|
|
|
|
|
|
|
msg = "do you want to provide the OS? [(W)indows/(l)inux]"
|
|
|
|
|
|
|
|
while True:
|
|
|
|
os = readInput(msg, default="W")
|
|
|
|
|
|
|
|
if os[0].lower() == "w":
|
|
|
|
kb.os = "Windows"
|
|
|
|
break
|
|
|
|
elif os[0].lower() == "l":
|
|
|
|
kb.os = "Linux"
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
warnMsg = "invalid value"
|
|
|
|
logger.warn(warnMsg)
|