def runsample(sample): print("Sending sample to VM to run...") #Get running VMs if subprocess.check_output(["vboxmanage", "list", "runningvms"]): running = True else: running = False #If VM running if running: #Start INETSIM proc = subprocess.Popen(['sudo', 'inetsim', '--report-dir', '/home/stuart/Desktop/honours/inetsim/']) #Get INetSim PID that will be used to shutdown process sample.inetsimpid = proc.pid + 1 #Send sample to VM sockets.send(sample.name) try: #Try and get PESieve results sample.pesieve = json.loads(sockets.receive()) except: pass #Sleep to allow for sample to run time.sleep(20) #Run Dynamic Analysis dynamicanalysis(sample) #Kill INetSim Process os.system("sudo pkill inetsim") #Wait for INetSim to finish time.sleep(2)