def Overwrite_and_GetDefaultConfiguration(self, project_id='', assessment_id='', app_id='', continue_=False, delete=False, get_update_config=False): """ Objective : THis method is used with vulneribility scanning. This is the method which would take the data from the web service method and would invoke driver_meta.py with relevent switches in order to make driver_meta.py overwrite the configuration or scan results earlier placed for the project id supplied by the service and then would return the default configuration for project id that is passed to it. """ try: driverObj = driver.Driver() return_val = driverObj.main('gui', project_id, continue_, delete, get_update_config) return return_val except Exception, ee: return_val = {} return_val["status"] = "failure" return_val["value"] = "Exception : " + str(ee) print "Inside exception of get Default config !!" + str(ee) return 0
def __init__(self): """ Objective : This method would initialize the class variables.It is a constructor """ self.IP="" self.PORT=None self.SWITCH="" self.CURRENT_PROJECT_ID="" self.takescan="" self.N=4 self.Port_Divisior=7500 self.Pause_Flag=False self.Stop_Flag=False self.ipcount=0 self.IPtable=IPtable.IPtable() self.method_id="INIT" self.Thread_pool=[] self.retry_count=0 self.max_retries=3 self.simple_logger=Simple_Logger.SimpleLogger() self.lock=threading.Lock() self.folder_name=os.path.join("Results","Data_") self.concurrent=False self.driver=driver.Driver() self.thread_count=1
def getDefaultConfiguration(self, project_id='', assessment_id='', app_id='', proceed=False, concurrent=False, rec_list=[]): """ Objective : THis method is used with vulneribility scanning. This is the method which would take the data from the web service method and would invoke driver_meta.py with relevent switches in order to make driver_meta.py return the default configuration for project id that is passed to it. """ try: #print "\n\n Finally concurrent is :"+str(concurrent) driverObj = driver.Driver() if concurrent == False: if proceed == False: return_val = driverObj.main('gui', project_id, False, False) else: return_val = driverObj.main( 'gui', project_id, False, False, True) #third true means to get updated config #print "Ret val is : "+str(return_val) if return_val: return return_val else: return_set = {} return_set["status"] = "failure" return_set[ "value"] = "Some error occured and could not fetch the configuration.See Logs" return return_set else: #return_val=driverObj.main('gui',project_id,False,False,True,False,True,rec_list,True) #The above switch will return the configuration for the records passed in list only print "Here i am dudes" return_val = driverObj.main('gui', project_id, False, False, True, False, False, '', True) #This witch will return the configuration for all records for the current scan,which is better with respect to gui and polling if return_val: return return_val else: return_set = {} return_set["status"] = "failure" return_set[ "value"] = "Some error occured and could not fetch the configuration.See Logs" return return_set #return project_id except Exception, ee: return_val = {} return_val["status"] = "failure" return_val["value"] = "Exception : " + str(ee) print "Inside exception of get Default config !!" + str(ee) return 0
def Overwrite_and_GetDefaultConfiguration(self, project_id='', assessment_id='', app_id='', continue_=False, delete=False, get_update_config=False): try: driverObj = driver.Driver() return_val = driverObj.main('gui', project_id, continue_, delete, get_update_config) return return_val except Exception, ee: return_val = {} return_val["status"] = "failure" return_val["value"] = "Exception : " + str(ee) print "Inside exception of get Default config !!" + str(ee) return 0
def getDefaultConfiguration(self, project_id='', assessment_id='', app_id='', proceed=False): try: driverObj = driver.Driver() if proceed == False: return_val = driverObj.main('gui', project_id, False, False) else: return_val = driverObj.main('gui', project_id, False, False, True) #print "Ret val is : "+str(return_val) return return_val #return project_id except Exception, ee: return_val = {} return_val["status"] = "failure" return_val["value"] = "Exception : " + str(ee) print "Inside exception of get Default config !!" + str(ee) return 0
The purpose of this file /module /Class is to launch discovery process with gui mode . Invoker_ex.py is actually responsible for calling driver_meta.py along with project_id and relevent switches which shall make the code driver_meta.py to run in execute mode and it will start vul scan. A process will keep on running in the background which shall do the scanning and save the details in the database table. """ import driver_meta as driver_exploits import os import ConfigParser import time import psutil import subprocess import sys import threading DriverObj = driver_exploits.Driver() project_id = sys.argv[1] continue_ = sys.argv[2] delete = sys.argv[3] get_default_config = sys.argv[4] threading_ = sys.argv[5] print "Inside Invoker_ex.py \n\n" print "Recieved aurguments are :" print(project_id, continue_, delete, get_default_config) active_threads = threading.enumerate() counter = len(active_threads) print "Inside invoker_ex.The number of threads active are :" + str( active_threads) + "\n" if threading_ == "0":