X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FPlcapiUrlScanner.py;h=119aea0c530eb6e44ed18793a37093bcd83af6e6;hb=32fe9add41a6dc5be3a3352fad84a70061a3f557;hp=1ef2d8085aefc872aae0c33fe1958e020997d115;hpb=8d5d4177734f5df33469782ff5ad4ea8ffd0e46e;p=tests.git 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