2013-02-14 15:32:17 +04:00
|
|
|
#!/usr/bin/env python
|
2008-10-15 19:38:22 +04:00
|
|
|
|
|
|
|
"""
|
2016-01-06 02:06:12 +03:00
|
|
|
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
|
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-28 19:36:09 +03:00
|
|
|
from lib.core.common import Backend
|
2011-01-16 02:54:03 +03:00
|
|
|
from lib.core.common import readInput
|
|
|
|
from lib.core.data import logger
|
2011-04-23 20:25:09 +04:00
|
|
|
from lib.core.enums import OS
|
2012-12-06 17:14:19 +04:00
|
|
|
from lib.core.exception import SqlmapUndefinedMethod
|
2008-10-15 19:38:22 +04:00
|
|
|
|
|
|
|
class Fingerprint:
|
|
|
|
"""
|
|
|
|
This class defines generic fingerprint functionalities for plugins.
|
|
|
|
"""
|
|
|
|
|
2011-01-14 14:55:20 +03:00
|
|
|
def __init__(self, dbms):
|
2011-01-28 19:36:09 +03:00
|
|
|
Backend.forceDbms(dbms)
|
2008-10-15 19:38:22 +04:00
|
|
|
|
|
|
|
def getFingerprint(self):
|
2011-04-30 17:20:05 +04:00
|
|
|
errMsg = "'getFingerprint' method must be defined "
|
2008-10-15 19:38:22 +04:00
|
|
|
errMsg += "into the specific DBMS plugin"
|
2013-01-04 02:20:55 +04:00
|
|
|
raise SqlmapUndefinedMethod(errMsg)
|
2008-10-15 19:38:22 +04:00
|
|
|
|
|
|
|
def checkDbms(self):
|
2011-04-30 17:20:05 +04:00
|
|
|
errMsg = "'checkDbms' method must be defined "
|
2008-10-15 19:38:22 +04:00
|
|
|
errMsg += "into the specific DBMS plugin"
|
2013-01-04 02:20:55 +04:00
|
|
|
raise SqlmapUndefinedMethod(errMsg)
|
2010-03-18 20:20:54 +03:00
|
|
|
|
2010-03-23 01:57:57 +03:00
|
|
|
def checkDbmsOs(self, detailed=False):
|
2011-04-30 17:20:05 +04:00
|
|
|
errMsg = "'checkDbmsOs' method must be defined "
|
2010-03-23 01:57:57 +03:00
|
|
|
errMsg += "into the specific DBMS plugin"
|
2013-01-04 02:20:55 +04:00
|
|
|
raise SqlmapUndefinedMethod(errMsg)
|
2010-03-23 01:57:57 +03:00
|
|
|
|
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":
|
2011-04-23 20:25:09 +04:00
|
|
|
Backend.setOs(OS.WINDOWS)
|
2011-01-16 02:54:03 +03:00
|
|
|
break
|
|
|
|
elif os[0].lower() == "l":
|
2011-04-23 20:25:09 +04:00
|
|
|
Backend.setOs(OS.LINUX)
|
2011-01-16 02:54:03 +03:00
|
|
|
break
|
|
|
|
else:
|
|
|
|
warnMsg = "invalid value"
|
|
|
|
logger.warn(warnMsg)
|