mirror of https://github.com/n1nj4sec/pupy.git
check vm main module
This commit is contained in:
parent
8947850c31
commit
972274345d
|
@ -6,7 +6,7 @@ from modules.lib.windows.powershell_upload import execute_powershell_script
|
|||
__class_name__="CheckVM"
|
||||
ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
|
||||
|
||||
@config(compat="windows", category="gather")
|
||||
@config(compat=['linux', 'windows'], category="gather")
|
||||
class CheckVM(PupyModule):
|
||||
""" check if running on Virtual Machine """
|
||||
|
||||
|
@ -14,6 +14,7 @@ class CheckVM(PupyModule):
|
|||
self.arg_parser = PupyArgumentParser(prog="CheckVM", description=self.__doc__)
|
||||
|
||||
def run(self, args):
|
||||
if self.client.is_windows():
|
||||
content = open(os.path.join(ROOT, "external", "Nishang", "Check-VM.ps1"), 'r').read()
|
||||
function = 'Check-VM'
|
||||
output = execute_powershell_script(self, content, function)
|
||||
|
@ -21,3 +22,10 @@ class CheckVM(PupyModule):
|
|||
self.success("%s" % output)
|
||||
else:
|
||||
self.success("No virtual machine detected")
|
||||
elif self.client.is_linux():
|
||||
self.client.load_package("checkvm")
|
||||
vm = self.client.conn.modules["checkvm"].checkvm()
|
||||
if vm:
|
||||
self.success('This appears to be a %s virtual machine' % vm)
|
||||
else:
|
||||
self.success('This does not appear to be a virtual machine')
|
||||
|
|
Loading…
Reference in New Issue