def vm_start(): cmd="virsh snapshot-revert --domain "+str(VM_NAME)+" --current" subprocess.check_output(cmd,shell=True) message="Start VM NAME: "+str(VM_NAME) +" IP :"+str(VM_IP) log.log_yellow(message)
def vm_shutdown(): cmd="virsh destroy --domain "+str(VM_NAME) subprocess.check_output(cmd,shell=True) message="Shut Down VM NAME: "+str(VM_NAME) log.log_yellow(message)
import glob from ConfigParser import ConfigParser from util import log import subprocess _current_dir = os.path.abspath(os.path.dirname(__file__)) IYCFM_ROOT = os.path.normpath(os.path.join(_current_dir, ".")) config = ConfigParser() RootDir_conf = IYCFM_ROOT RootDir_conf += '/conf/cmc.conf' config.read(RootDir_conf) VM_IP=config.get("VM","ip") intro() log.log_yellow("CMIYC Server Start") while 1: up_check = glob.glob('malware/*') if len(up_check)>0: kvm.vm_start() break subprocess.check_output("rm malware/*",shell=True) HOST=VM_IP #localhost PORT=7474 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)