コード例 #1
0
def get_smb_platform_data(platform: str, timestamp: float):
    """
    Gets platform-dependent data for SMB 2 packets

    :param platform: the platform for which to get SMB 2 packet data
    :param timestamp: a timestamp for calculating the boot-time
    :return: server_guid, security_blob, capabilities, data_size and server_start_time of the given platform
    """
    Util.check_platform(platform)
    if platform == "linux":
        server_guid = "ubuntu"
        security_blob = security_blob_ubuntu
        capabilities = 0x5
        data_size = 0x800000
        server_start_time = 0
    elif platform == "macos":
        server_guid = binascii.b2a_hex(os.urandom(15)).decode()
        security_blob = security_blob_macos
        capabilities = 0x6
        data_size = 0x400000
        server_start_time = 0
    else:
        server_guid = binascii.b2a_hex(os.urandom(15)).decode()
        security_blob = security_blob_windows
        capabilities = 0x7
        data_size = 0x100000
        server_start_time = Util.get_filetime_format(
            Util.get_rnd_boot_time(timestamp))
    return server_guid, security_blob, capabilities, data_size, server_start_time
コード例 #2
0
def get_smb_version(platform: str):
    """
    Returns SMB version based on given platform

    :param platform: the platform as string
    :return: SMB version as string
    """
    Util.check_platform(platform)
    if platform is "linux":
        return rnd.choice(list(smb_versions_per_samba.values()))
    elif platform is "macos":
        return "2.1"
    else:
        return smb_versions_per_win[platform]
コード例 #3
0
ファイル: test_Utility.py プロジェクト: hawk90/ID2T
 def test_check_platform_invalid(self):
     with self.assertRaises(ValueError):
         Utility.check_platform("abc")
コード例 #4
0
ファイル: test_Utility.py プロジェクト: hawk90/ID2T
 def test_check_platform_valid(self):
     Utility.check_platform("linux")