From 32fe9add41a6dc5be3a3352fad84a70061a3f557 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 15 Feb 2013 16:57:30 +0100 Subject: [PATCH] plcapi-urls checks for required urls only (the ones ending in /) --- system/PlcapiUrlScanner.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/system/PlcapiUrlScanner.py b/system/PlcapiUrlScanner.py index 1ef2d80..119aea0 100755 --- a/system/PlcapiUrlScanner.py +++ b/system/PlcapiUrlScanner.py @@ -41,20 +41,22 @@ class PlcapiUrlScanner: if self.verbose: traceback.print_exc() return False - def try_url_expected (self, url, expected): - return self.try_url(url)==expected + def try_url_expected (self, url, required): + result=self.try_url(url)==expected + if required and not result: return False + else: return True def scan(self): overall=True for protocol in ['http','https']: - expected= protocol=='https' for dest in [ self.hostname, self.ip ]: for port in [ '',':80',':443']: for path in ['PLCAPI','PLCAPI/']: if protocol=='http' and port==':443': continue if protocol=='https' and port==':80': continue + required = (protocol=='https') and (path=='PLCAPI/') url="%s://%s%s/%s"%(protocol,dest,port,path) - if not self.try_url_expected (url,expected): overall=False + if not self.try_url_expected (url,required): overall=False return overall from optparse import OptionParser -- 2.43.0