当前位置: 首页>>代码示例>>Python>>正文


Python Monitor.computePerimeter方法代码示例

本文整理汇总了Python中monitor.Monitor.computePerimeter方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.computePerimeter方法的具体用法?Python Monitor.computePerimeter怎么用?Python Monitor.computePerimeter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在monitor.Monitor的用法示例。


在下文中一共展示了Monitor.computePerimeter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Controller

# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import computePerimeter [as 别名]
class Controller(object):
    '''
    Controlleur principal du fuzzer Schnapi
    '''
    
    #Constructor
    def __init__(self,host,port,name,workspace,nb_request,nb_cores):
        #Attributes initialization
        self.host = host
        self.port = port
        self.name = name
        self.nb_request = nb_request
        self.workspace = workspace
        self.nb_cores = nb_cores
        #Monitor initialization
        self.monitor = Monitor(name,workspace,nb_cores,"valid_request_file","error_file","log_file")
        #networkAgent initialization
        self.networkAgent = networkAgent(host,port)
        
    #Add a valid request to the monitor
    def addValidRequestToMoniteur(self,request):
        self.monitor.addRequest("valid",request)
    
    #Add a fuzzing request to the monitor
    def addFuzzingRequestToMoniteur(self,request):
        self.monitor.addRequest("fuzz",request)
            
    #Add a response to the monitor
    def addResponseToMoniteur(self,response):
        self.monitor.addResponse(response)
        
    #Notifiy that the valid request are done so we can compute the central response
    def endOfValidRequest(self):
        self.monitor.computePerimeter()
        
    #Send a valid request to the http agent
    def sendValidRequest(self,request):
        #Send the request to the http socket
        if (self.networkAgent.sendRequest(request) == -1):
            print("Probleme d'envoi des requetes pendant la phase de requêtes valides")
            sys.exit(1)
        #Add the request to the log
        self.addValidRequestToMoniteur(request)
        
    #Send a fuzzing request to the http agent
    def sendFuzzingRequest(self,request):
        #Send the request to the http socket
        if (self.networkAgent.sendRequest(request) == -1):
            print("Probleme d'envoi des requetes pendant la phase de fuzzing")
            #Add to error file
            self.addFuzzingRequestToMoniteur(request)
            self.addResponseToMoniteur(self.networkAgent.getResponse())
            self.monitor.img.fin()
            sys.exit(1)
        else:
            #Add the request to the log
            self.addFuzzingRequestToMoniteur(request)
   
    #Get the response to a request
    def receiveResponse(self):
        #Get the response
        response = self.networkAgent.getResponse()
        #Add the response to the log and check if there is an error
        self.monitor.addResponse(str(response))
        
    #Launch a campaign
    def start(self):
        print("Lancement du Controlleur principal")
        #Create the campaign
        print("Création de la campagne de fuzzing")
        camp = Campaign(self.name, self, self.nb_request)
        #Start the campaign
        print("Lancement de la campagne de fuzzing")
        camp.startCampaign()
        #End of campaign: image
        print("Création image Latex et R")
        self.monitor.img.fin()
开发者ID:jueberschlag,项目名称:Schnapi,代码行数:79,代码来源:controller.py


注:本文中的monitor.Monitor.computePerimeter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。