2008-11-17 03:00:54 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
|
|
|
$Id$
|
|
|
|
|
2011-07-08 00:10:03 +04:00
|
|
|
Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
|
2010-10-15 03:18:29 +04:00
|
|
|
See the file 'doc/COPYING' for copying permission
|
2008-11-17 03:00:54 +03:00
|
|
|
"""
|
|
|
|
|
2009-12-18 01:04:01 +03:00
|
|
|
import os
|
|
|
|
|
2008-11-17 03:00:54 +03:00
|
|
|
from lib.core.common import checkFile
|
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
|
|
|
|
|
|
|
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
|
|
|
"""
|
|
|
|
|
2008-11-17 20:41:02 +03:00
|
|
|
topHeaders = {
|
2009-12-18 01:04:01 +03:00
|
|
|
"cookie": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "cookie.xml"),
|
|
|
|
"microsoftsharepointteamservices": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "sharepoint.xml"),
|
|
|
|
"server": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "server.xml"),
|
|
|
|
"servlet-engine": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "servlet.xml"),
|
|
|
|
"set-cookie": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "cookie.xml"),
|
|
|
|
"x-aspnet-version": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "x-aspnet-version.xml"),
|
|
|
|
"x-powered-by": os.path.join(paths.SQLMAP_XML_BANNER_PATH, "x-powered-by.xml")
|
2008-11-17 20:41:02 +03:00
|
|
|
}
|
2008-11-17 03:00:54 +03:00
|
|
|
|
|
|
|
for header in headers:
|
2011-11-16 20:06:21 +04:00
|
|
|
if header in topHeaders:
|
2011-04-30 17:20:05 +04:00
|
|
|
value = headers[header]
|
2008-11-17 20:41:02 +03:00
|
|
|
xmlfile = topHeaders[header]
|
2008-11-19 18:33:39 +03:00
|
|
|
|
2008-11-17 20:41:02 +03:00
|
|
|
checkFile(xmlfile)
|
2008-11-19 18:33:39 +03:00
|
|
|
|
2008-11-18 20:42:46 +03:00
|
|
|
handler = FingerprintHandler(value, kb.headersFp)
|
2008-11-19 18:33:39 +03:00
|
|
|
|
2010-04-16 23:57:00 +04:00
|
|
|
parseXmlFile(xmlfile, handler)
|
|
|
|
parseXmlFile(paths.GENERIC_XML, handler)
|