1.1 --- a/OpenSecurity/bin/cygwin.py Tue Apr 29 15:40:48 2014 +0100
1.2 +++ b/OpenSecurity/bin/cygwin.py Fri May 09 13:21:59 2014 +0100
1.3 @@ -43,7 +43,6 @@
1.4 from environment import Environment
1.5 from opensecurity_util import logger, setupLogger, OpenSecurityException
1.6 import time
1.7 -#import wmi
1.8 # ------------------------------------------------------------
1.9 # code
1.10
1.11 @@ -62,12 +61,14 @@
1.12 theClass.cygwin_bin = os.path.join(theClass.cygwin_root, 'bin') + os.path.sep
1.13 theClass.cygwin_bash = os.path.join(theClass.cygwin_bin, 'bash.exe')
1.14 theClass.cygwin_ssh = os.path.join(theClass.cygwin_bin, 'ssh.exe')
1.15 + theClass.cygwin_scp = os.path.join(theClass.cygwin_bin, 'scp.exe')
1.16 theClass.cygwin_x11 = os.path.join(theClass.cygwin_bin, 'XWin.exe')
1.17 theClass.win_cmd = os.environ.get("COMSPEC", "cmd.exe")
1.18 """get the path to the VirtualBox installation on this system"""
1.19 theClass.vbox_root = theClass.getRegEntry('SOFTWARE\Oracle\VirtualBox', 'InstallDir')[0]
1.20 theClass.vbox_man = os.path.join(theClass.vbox_root, 'VBoxManage.exe')
1.21 -
1.22 + #theClass.user_home = os.path.expanduser("~")
1.23 + theClass.user_home = os.environ['APPDATA']#os.path.expandvars("%APPDATA%")
1.24 return theClass
1.25
1.26 class XRunner(threading.Thread):
1.27 @@ -96,9 +97,11 @@
1.28 cygwin_bash = ''
1.29 cygwin_ssh = ''
1.30 cygwin_x11 = ''
1.31 + cygwin_scp = ''
1.32 vbox_root = ''
1.33 vbox_man = ''
1.34 win_cmd = ''
1.35 + user_home = ''
1.36 """Some nifty methods working with Cygwin"""
1.37
1.38 def __call__(self, command, arguments, wait_return=True, window = False):
1.39 @@ -131,6 +134,10 @@
1.40 @staticmethod
1.41 def ssh():
1.42 return Cygwin.cygwin_ssh
1.43 +
1.44 + @staticmethod
1.45 + def scp():
1.46 + return Cygwin.cygwin_scp
1.47
1.48 @staticmethod
1.49 def x11():
1.50 @@ -144,6 +151,10 @@
1.51 def cmd():
1.52 return Cygwin.win_cmd
1.53
1.54 + @staticmethod
1.55 + def home():
1.56 + return Cygwin.user_home
1.57 +
1.58 executeLock = threading.Lock()
1.59 #executes command on host system
1.60 @staticmethod
1.61 @@ -207,7 +218,7 @@
1.62 @staticmethod
1.63 def sshExecute(command, address, user_name, certificate, wait_return=True, window = False):
1.64 command = ' -v -o StrictHostKeyChecking=no -i "' + certificate + '" ' + user_name + '@' + address + ' ' + command
1.65 - return Cygwin.execute(Cygwin.cygwin_ssh, command, wait_return, window)
1.66 + return Cygwin.execute(Cygwin.cygwin_ssh, command, wait_return, window)
1.67
1.68 #machineFolder + '/' + vm_name + '/dvm_key
1.69 #address = self.getHostOnlyIP(vm_name)
1.70 @@ -245,19 +256,28 @@
1.71 return Cygwin.bashExecute(cmd)[1].rstrip('\n')
1.72
1.73 # start
1.74 +import os
1.75 +import win32api
1.76 +import win32con
1.77 +import win32security
1.78 +
1.79 if __name__ == "__main__":
1.80 logger = setupLogger('Cygwin')
1.81 c = Cygwin()
1.82 - logger.info(c.root())
1.83 - logger.info(c.bin())
1.84 - logger.info(c.bash())
1.85 - logger.info(c.ssh())
1.86 - logger.info(c.x11())
1.87 + #logger.info(c.root())
1.88 + #logger.info(c.bin())
1.89 + #logger.info(c.bash())
1.90 + #logger.info(c.ssh())
1.91 + #logger.info(c.x11())
1.92 + #logger.info(c.home())
1.93
1.94 - runner = XRunner()
1.95 - runner.start()
1.96 + #PSEXEC -i -s -d CMD
1.97 + #tasklist /v /fo list /fi "IMAGENAME eq explorer.exe"
1.98
1.99 - Cygwin.start_X11()
1.100 + #runner = XRunner()
1.101 + #runner.start()
1.102 +
1.103 + #Cygwin.start_X11()
1.104
1.105
1.106