コード例 #1
0
ファイル: test_smb.py プロジェクト: Liljhon241/MITMf
 def create_connection(self):
     if self.dialects == smb.SMB_DIALECT:
         # Only for SMB1 let's do manualNego
         s = SMBConnection('*SMBSERVER',
                           self.machine,
                           preferredDialect=self.dialects,
                           manualNegotiate=True)
         s.negotiateSession(self.dialects, flags2=self.flags2)
     else:
         s = SMBConnection('*SMBSERVER',
                           self.machine,
                           preferredDialect=self.dialects)
     return s
コード例 #2
0
 def setup_smb_connection(self):
     if not self.__smb_connection:
         if self.__remote_name == '':
             if self.get_dport() == nmb.NETBIOS_SESSION_PORT:
                 self.__smb_connection = SMBConnection(
                     '*SMBSERVER',
                     self.get_dip(),
                     sess_port=self.get_dport(),
                     preferredDialect=self.__prefDialect)
             else:
                 self.__smb_connection = SMBConnection(
                     self.get_dip(),
                     self.get_dip(),
                     sess_port=self.get_dport(),
                     preferredDialect=self.__prefDialect)
         else:
             self.__smb_connection = SMBConnection(
                 self.__remote_name,
                 self.get_dip(),
                 sess_port=self.get_dport(),
                 preferredDialect=self.__prefDialect)
コード例 #3
0
    def __init__(self, SMBObject, exeFile):
        self._rpctransport = 0
        self.__service_name = ''.join(
            [random.choice(string.letters) for i in range(4)])
        self.__binary_service_name = ''.join(
            [random.choice(string.letters) for i in range(8)]) + '.exe'
        self.__exeFile = exeFile

        # We might receive two different types of objects, always end up
        # with a SMBConnection one
        if isinstance(SMBObject, smb.SMB) or isinstance(SMBObject, smb3.SMB3):
            self.connection = SMBConnection(existingConnection=SMBObject)
        else:
            self.connection = SMBObject

        self.share = ''