smbclientng.core.Module

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# File name          : InteractiveShell.py
 4# Author             : Podalirius (@podalirius_)
 5# Date created       : 23 may 2024
 6
 7
 8import shlex
 9
10
11class Module(object):
12    """
13    A parent class for all modules in the smbclient-ng tool.
14
15    This class provides common attributes and methods that are shared among different modules.
16    """
17
18    name = ""
19    description = ""
20    smbSession = None
21    options = None
22
23    def __init__(self, smbSession, config):
24        self.smbSession = smbSession
25        self.config = config
26
27    def parseArgs(self):
28        raise NotImplementedError("Subclasses must implement this method")
29
30    def run(self):
31        """
32        Placeholder method for running the module.
33
34        This method should be implemented by subclasses to define the specific behavior of the module.
35        """
36        raise NotImplementedError("Subclasses must implement this method")
37
38    def processArguments(self, parser, arguments):
39        if type(arguments) == list:
40            arguments = ' '.join(arguments)
41        
42        __iterableArguments = shlex.split(arguments)
43
44        self.options = parser.parse_args(__iterableArguments)
45
46        return self.options
47        
class Module:
12class Module(object):
13    """
14    A parent class for all modules in the smbclient-ng tool.
15
16    This class provides common attributes and methods that are shared among different modules.
17    """
18
19    name = ""
20    description = ""
21    smbSession = None
22    options = None
23
24    def __init__(self, smbSession, config):
25        self.smbSession = smbSession
26        self.config = config
27
28    def parseArgs(self):
29        raise NotImplementedError("Subclasses must implement this method")
30
31    def run(self):
32        """
33        Placeholder method for running the module.
34
35        This method should be implemented by subclasses to define the specific behavior of the module.
36        """
37        raise NotImplementedError("Subclasses must implement this method")
38
39    def processArguments(self, parser, arguments):
40        if type(arguments) == list:
41            arguments = ' '.join(arguments)
42        
43        __iterableArguments = shlex.split(arguments)
44
45        self.options = parser.parse_args(__iterableArguments)
46
47        return self.options

A parent class for all modules in the smbclient-ng tool.

This class provides common attributes and methods that are shared among different modules.

Module(smbSession, config)
24    def __init__(self, smbSession, config):
25        self.smbSession = smbSession
26        self.config = config
name = ''
description = ''
smbSession = None
options = None
config
def parseArgs(self):
28    def parseArgs(self):
29        raise NotImplementedError("Subclasses must implement this method")
def run(self):
31    def run(self):
32        """
33        Placeholder method for running the module.
34
35        This method should be implemented by subclasses to define the specific behavior of the module.
36        """
37        raise NotImplementedError("Subclasses must implement this method")

Placeholder method for running the module.

This method should be implemented by subclasses to define the specific behavior of the module.

def processArguments(self, parser, arguments):
39    def processArguments(self, parser, arguments):
40        if type(arguments) == list:
41            arguments = ' '.join(arguments)
42        
43        __iterableArguments = shlex.split(arguments)
44
45        self.options = parser.parse_args(__iterableArguments)
46
47        return self.options