Splunk XML API
This commit is contained in:
parent
dba69dc704
commit
049e741d2d
27
web_service_finder.py
Normal file → Executable file
27
web_service_finder.py
Normal file → Executable file
@ -8,7 +8,9 @@ import urllib.parse
|
|||||||
from hackingscripts import util
|
from hackingscripts import util
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
class WebServicecFinder:
|
requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
class WebServiceFinder:
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.parseUrl(args.url)
|
self.parseUrl(args.url)
|
||||||
@ -52,7 +54,7 @@ class WebServicecFinder:
|
|||||||
if self.verbose:
|
if self.verbose:
|
||||||
sys.stdout.write("GET %s: " % uri)
|
sys.stdout.write("GET %s: " % uri)
|
||||||
|
|
||||||
res = self.session.get(uri, headers=self.headers, cookies=self.cookies, **args)
|
res = self.session.get(uri, headers=self.headers, cookies=self.cookies, verify=False, **args)
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
sys.stdout.write("%d %s\n" % (res.status_code, res.reason))
|
sys.stdout.write("%d %s\n" % (res.status_code, res.reason))
|
||||||
|
|
||||||
@ -87,7 +89,11 @@ class WebServicecFinder:
|
|||||||
break
|
break
|
||||||
|
|
||||||
self.analyseHeaders(startPage)
|
self.analyseHeaders(startPage)
|
||||||
self.analyseHtml(startPage)
|
if "text/html" in startPage.headers["Content-Type"]:
|
||||||
|
self.analyseHtml(startPage)
|
||||||
|
elif "text/xml" in startPage.headers["Content-Type"]:
|
||||||
|
self.analyseXml(startPage)
|
||||||
|
|
||||||
self.analyseRobots()
|
self.analyseRobots()
|
||||||
self.analyseSitemap()
|
self.analyseSitemap()
|
||||||
self.analyseChangelog()
|
self.analyseChangelog()
|
||||||
@ -125,6 +131,19 @@ class WebServicecFinder:
|
|||||||
|
|
||||||
return "%s (%d)" % (versionStr, v)
|
return "%s (%d)" % (versionStr, v)
|
||||||
|
|
||||||
|
def analyseXml(self,res):
|
||||||
|
soup = BeautifulSoup(res.text, "lxml")
|
||||||
|
|
||||||
|
title = soup.find("title")
|
||||||
|
if title:
|
||||||
|
print("[+] Found XML title:", title.text.strip())
|
||||||
|
|
||||||
|
generator = soup.find("generator")
|
||||||
|
if generator:
|
||||||
|
if generator.has_attr("version"):
|
||||||
|
print("[+] Found XML Generator version:", generator["version"])
|
||||||
|
|
||||||
|
|
||||||
def analyseHtml(self, res):
|
def analyseHtml(self, res):
|
||||||
soup = BeautifulSoup(res.text, "html.parser")
|
soup = BeautifulSoup(res.text, "html.parser")
|
||||||
|
|
||||||
@ -208,5 +227,5 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
banner()
|
banner()
|
||||||
|
|
||||||
client = WebServicecFinder(args)
|
client = WebServiceFinder(args)
|
||||||
client.scan()
|
client.scan()
|
||||||
|
Loading…
Reference in New Issue
Block a user