2013-02-14 15:32:17 +04:00
|
|
|
#!/usr/bin/env python
|
2008-11-17 03:00:54 +03:00
|
|
|
|
|
|
|
"""
|
2017-01-02 16:19:18 +03:00
|
|
|
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
|
2017-10-11 15:50:46 +03:00
|
|
|
See the file 'LICENSE' for copying permission
|
2008-11-17 03:00:54 +03:00
|
|
|
"""
|
|
|
|
|
2011-12-22 02:09:21 +04:00
|
|
|
import itertools
|
2009-12-18 01:04:01 +03:00
|
|
|
import os
|
|
|
|
|
2010-04-16 23:57:00 +04:00
|
|
|
from lib.core.common import parseXmlFile
|
2008-11-17 03:00:54 +03:00
|
|
|
from lib.core.data import kb
|
|
|
|
from lib.core.data import paths
|
2008-11-18 20:42:46 +03:00
|
|
|
from lib.parse.handler import FingerprintHandler
|
2008-11-17 03:00:54 +03:00
|
|
|
|
2011-12-22 02:09:21 +04:00
|
|
|
|
2008-11-17 03:00:54 +03:00
|
|
|
def headersParser(headers):
|
|
|
|
"""
|
|
|
|
This function calls a class that parses the input HTTP headers to
|
|
|
|
fingerprint the back-end database management system operating system
|
2008-11-17 03:13:49 +03:00
|
|
|
and the web application technology
|
2008-11-17 03:00:54 +03:00
|
|
|
"""
|
|
|
|
|
2011-12-22 02:09:21 +04:00
|
|
|
if not kb.headerPaths:
|
|
|
|
kb.headerPaths = {
|
|
|
|
"microsoftsharepointteamservices": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "sharepoint.xml"),
|
|
|
|
"server": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "server.xml"),
|
2017-09-20 16:49:18 +03:00
|
|
|
"servlet-engine": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "servlet-engine.xml"),
|
|
|
|
"set-cookie": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "set-cookie.xml"),
|
2011-12-22 02:09:21 +04:00
|
|
|
"x-aspnet-version": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "x-aspnet-version.xml"),
|
2013-01-10 18:02:28 +04:00
|
|
|
"x-powered-by": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "x-powered-by.xml"),
|
2011-12-22 02:09:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
for header in itertools.ifilter(lambda x: x in kb.headerPaths, headers):
|
|
|
|
value = headers[header]
|
|
|
|
xmlfile = kb.headerPaths[header]
|
|
|
|
|
|
|
|
handler = FingerprintHandler(value, kb.headersFp)
|
|
|
|
|
|
|
|
parseXmlFile(xmlfile, handler)
|
|
|
|
parseXmlFile(paths.GENERIC_XML, handler)
|