mirror of https://github.com/n1nj4sec/pupy.git
list drives
This commit is contained in:
parent
5d717cefe6
commit
1b5a1af7aa
|
@ -1,26 +1,22 @@
|
||||||
# -*- coding: UTF8 -*-
|
# -*- coding: UTF8 -*-
|
||||||
from pupylib.PupyModule import *
|
from pupylib.PupyModule import *
|
||||||
import ctypes
|
# import ctypes
|
||||||
|
from pupylib.utils.rpyc_utils import redirected_stdio
|
||||||
|
|
||||||
__class_name__="Drives"
|
__class_name__="Drives"
|
||||||
|
|
||||||
@config(compat="windows", category="admin")
|
@config(compat="windows", category="admin")
|
||||||
class Drives(PupyModule):
|
class Drives(PupyModule):
|
||||||
""" List valid drives in the system """
|
""" List valid drives in the system """
|
||||||
|
|
||||||
def init_argparse(self):
|
dependencies=["win32api","win32com","pythoncom","winerror"]
|
||||||
self.arg_parser = PupyArgumentParser(prog="drives", description=self.__doc__)
|
|
||||||
|
|
||||||
def run(self, args):
|
def init_argparse(self):
|
||||||
blen = self.client.conn.modules['ctypes'].c_uint(128)
|
self.arg_parser = PupyArgumentParser(prog="drives", description=self.__doc__)
|
||||||
rv = self.client.conn.modules['ctypes'].c_uint()
|
|
||||||
bufs = self.client.conn.modules['ctypes'].create_string_buffer(128)
|
def run(self, args):
|
||||||
rv = self.client.conn.modules['ctypes'].windll.kernel32.GetLogicalDriveStringsA(blen, bufs)
|
self.client.load_package("wmi")
|
||||||
if rv == 0:
|
self.client.load_package("pupwinutils.drives")
|
||||||
self.log('Error retrieving logical drives')
|
|
||||||
drives = bufs.raw.split('\0')
|
with redirected_stdio(self.client.conn):
|
||||||
for drive in drives:
|
self.client.conn.modules['pupwinutils.drives'].list_drives()
|
||||||
if drive:
|
|
||||||
self.log('- %s' % drive)
|
|
||||||
else:
|
|
||||||
break
|
|
Loading…
Reference in New Issue