Example #1
0
def vmware_pre_run(_VirtualMachine):

   ########################################################
   # Mount the second partition of the Virtual Machine
   # Check the User Manual for a reference to VM partitions
   ########################################################

   vm_util.mount_vmdk(_VirtualMachine, 2, _VirtualMachine._m_mount_directory)

   ########################################################
   # sudo echo <url assigned to the current Virtual Machine> <path to the mounted directory> url.txt
   # The selenium script expects the file to be read to be "url.txt"
   ########################################################

   if os.environ.get('OS','') == 'Windows_NT':

      ############################################
      # Win32 Support
      ############################################

      _Command = "echo " + _VirtualMachine._m_url + " > " + "\"" + _VirtualMachine._m_mount_directory + "url.txt" + "\""

   else:

      _Command = "sudo echo " + _VirtualMachine._m_url + " > " + "\"" + _VirtualMachine._m_mount_directory + "url.txt" + "\""

   print _Command

   os.system(_Command)

   ########################################################
   # Unmount the partition and return to start running
   ########################################################

   vm_util.umount_vmdk(_VirtualMachine, _VirtualMachine._m_mount_directory)
Example #2
0
File: entry.py Project: jashook/ev6
def vmware_post_run(_VirtualMachine):

   if _VirtualMachine._m_startup_file != None:

      _Command = "sudo vmrun -T ws snapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapShot2"

      print "Creating Snapshot"

      os.system(_Command)

      time.sleep(15) # make sure the snapshot finishes before starting

      _Vmdk = vm_util.find_last_snapshot(_VirtualMachine)

      _Command = "sudo cp " + "\"" + _VirtualMachine._m_directory + _Vmdk + "\"" + " " + "\"" + _VirtualMachine._m_collection + "\""
      print _Command

      os.system(_Command)

      print "Deleting snapshot"

      _Command = "sudo vmrun -T ws deleteSnapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapshot2"

      os.system(_Command)

      time.sleep(20)

      vm_util.mount_vmdk(_VirtualMachine, 3, _VirtualMachine._m_mount_directory)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pictures" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/pictures" + "\""
      
      print _Command

      os.system(_Command)

      time.sleep(.1)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pcaps" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/pcaps" + "\""
      print _Command

      os.system(_Command)

      time.sleep(.1)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "cookies" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/cookies" + "\""
      print _Command

      os.system(_Command)

      time.sleep(.1)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "source" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/source" + "\""
      print _Command

      os.system(_Command)

      time.sleep(5)

      vm_util.umount_vmdk(_VirtualMachine, _VirtualMachine._m_mount_directory)
Example #3
0
File: entry.py Project: jashook/ev6
def vmware_pre_run(_VirtualMachine):

   if _VirtualMachine._m_startup_file != None:

      vm_util.mount_vmdk(_VirtualMachine, 3, _VirtualMachine._m_mount_directory)

      _Command = "sudo echo " + URLList[int(float(get_url_index()) % len(URLList))][:-1] + " > " + "\"" + _VirtualMachine._m_mount_directory + "url.txt" + "\""

      print _Command

      os.system(_Command)

      vm_util.umount_vmdk(_VirtualMachine)
Example #4
0
File: entry.py Project: jashook/ev6
def vmware_pre_run(_VirtualMachine):

   if _VirtualMachine._m_startup_file != None:

      vm_util.mount_vmdk(_VirtualMachine, 2, _VirtualMachine._m_mount_directory)

      _Command = "sudo echo " + _VirtualMachine._m_url + " > " + "\"" + _VirtualMachine._m_mount_directory + "url.txt" + "\""

      print _Command

      os.system(_Command)

      vm_util.umount_vmdk(_VirtualMachine, _VirtualMachine._m_mount_directory)
Example #5
0
File: entry.py Project: jashook/ev6
def vmware_post_run(_VirtualMachine):

   if _VirtualMachine._m_startup_file != None:

      vm_util.mount_vmdk(_VirtualMachine, 2, _VirtualMachine._m_mount_directory)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pictures" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/pictures" + "\""
      
      print _Command

      os.system(_Command)

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pcaps" "\"" + " "+ "\"" + _VirtualMachine._m_collection + "/pcaps" + "\""
      print _Command

      os.system(_Command)

      vm_util.umount_vmdk(_VirtualMachine)
Example #6
0
def vmware_post_run(_VirtualMachine):

   if _VirtualMachine._m_snap_shot:

      #####################################################
      # Logic:
      #
      # Create a new Snapshot
      # Copy it to the output destination
      # delete the Snapshot so it looks like it was never made.
      #####################################################

      if os.environ.get('OS','') == 'Windows_NT':

         ############################################
         # Win32 Support
         ############################################

         _Command = "vmrun -T ws snapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapShot2"

      else:

         _Command = "sudo vmrun -T ws snapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapShot2"

      print "Creating Snapshot"

      os.system(_Command)

      time.sleep(15) # make sure the snapshot finishes before starting

      _Vmdk = vm_util.find_last_snapshot(_VirtualMachine)

      if os.environ.get('OS','') == 'Windows_NT':

         ############################################
         # Win32 Support
         ############################################

         _Command = "copy " + "\"" + _VirtualMachine._m_directory + _Vmdk + "\"" + " " + "\"" + _VirtualMachine._m_collection + "\""

      else:

         _Command = "sudo cp " + "\"" + _VirtualMachine._m_directory + _Vmdk + "\"" + " " + "\"" + _VirtualMachine._m_collection + "\""

      print _Command

      os.system(_Command)

      print "Deleting snapshot"

      if os.environ.get('OS','') == 'Windows_NT':

         ############################################
         # Win32 Support
         ############################################

         _Command = "vmrun -T ws deleteSnapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapshot2"

      else:

         _Command = "sudo vmrun -T ws deleteSnapshot " + "\"" + _VirtualMachine._m_directory + _VirtualMachine._m_config_file + "\"" + " NewMachineSnapshot2"

      os.system(_Command)

      time.sleep(20) # make sure there is enough time for the snapshot to be deleted

   ########################################################
   # Mount the third partition, which contains output data
   # Check the User Manual for a reference to VM partitions
   ########################################################

   vm_util.mount_vmdk(_VirtualMachine, 3, _VirtualMachine._m_mount_directory)

   ########################################################
   # sudo cp -r <directory of mounted VM filesystem>/* <directory of output>
   ########################################################

   if os.environ.get('OS','') == 'Windows_NT':

      ############################################
      # Win32 Support
      ############################################

      _Command = "copy " + "\"" + _VirtualMachine._m_mount_directory + "pcaps" + "\"" + " " +"\"" + _VirtualMachine._m_collection + "/" + "\""

   else:

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pcaps" + "\"" + " " +"\"" + _VirtualMachine._m_collection + "/" + "\""
      
   print _Command

   os.system(_Command)

   if os.environ.get('OS','') == 'Windows_NT':

      ############################################
      # Win32 Support
      ############################################

      _Command = "copy " + "\"" + _VirtualMachine._m_mount_directory + "cookies" + "\"" + " " + "\"" + _VirtualMachine._m_collection + "/" + "\""

   else:

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "cookies" + "\"" + " " + "\"" + _VirtualMachine._m_collection + "/" + "\""
      
   print _Command

   os.system(_Command)

   
   if os.environ.get('OS','') == 'Windows_NT':

      ############################################
      # Win32 Support
      ############################################

      _Command = "copy " + "\"" + _VirtualMachine._m_mount_directory + "pictures" + "\"" + " " + "\"" + _VirtualMachine._m_collection + "/" + "\""

   else:

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "pictures" + "\"" + " " + "\"" + _VirtualMachine._m_collection + "/" + "\""
      
   print _Command

   os.system(_Command)

   if os.environ.get('OS','') == 'Windows_NT':

      ############################################
      # Win32 Support
      ############################################

      _Command = "copy " + "\"" + _VirtualMachine._m_mount_directory + "source" + "\"" + " " +"\"" + _VirtualMachine._m_collection + "/" + "\""

   else:

      _Command = "sudo cp -r " + "\"" + _VirtualMachine._m_mount_directory + "source" + "\"" + " " +"\"" + _VirtualMachine._m_collection + "/" + "\""
      
   print _Command

   os.system(_Command)

   time.sleep(5)

   ########################################################
   # Unmount the partition and return to continue execution
   ########################################################

   vm_util.umount_vmdk(_VirtualMachine, _VirtualMachine._m_mount_directory)