MCPcopy Index your code
hub / github.com/secdev/scapy / __init__

Method __init__

scapy/layers/smbclient.py:1115–1244  ·  view source on GitHub ↗
(
        self,
        target: str,
        UPN: str = None,
        password: str = None,
        guest: bool = False,
        kerberos_required: bool = False,
        HashNt: bytes = None,
        HashAes256Sha96: bytes = None,
        HashAes128Sha96: bytes = None,
        port: int = 445,
        timeout: int = 5,
        debug: int = 0,
        ssp=None,
        ST=None,
        KEY=None,
        cli=True,
        # SMB arguments
        REQUIRE_ENCRYPTION=False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

1113 """
1114
1115 def __init__(
1116 self,
1117 target: str,
1118 UPN: str = None,
1119 password: str = None,
1120 guest: bool = False,
1121 kerberos_required: bool = False,
1122 HashNt: bytes = None,
1123 HashAes256Sha96: bytes = None,
1124 HashAes128Sha96: bytes = None,
1125 port: int = 445,
1126 timeout: int = 5,
1127 debug: int = 0,
1128 ssp=None,
1129 ST=None,
1130 KEY=None,
1131 cli=True,
1132 # SMB arguments
1133 REQUIRE_ENCRYPTION=False,
1134 **kwargs,
1135 ):
1136 if cli:
1137 self._depcheck()
1138 assert UPN or ssp or guest, "Either UPN, ssp or guest must be provided !"
1139 # Do we need to build a SSP?
1140 if ssp is None:
1141 # Create the SSP (only if not guest mode)
1142 if not guest:
1143 ssp = SPNEGOSSP.from_cli_arguments(
1144 UPN=UPN,
1145 target=target,
1146 password=password,
1147 HashNt=HashNt,
1148 HashAes256Sha96=HashAes256Sha96,
1149 HashAes128Sha96=HashAes128Sha96,
1150 ST=ST,
1151 KEY=KEY,
1152 kerberos_required=kerberos_required,
1153 )
1154 else:
1155 # Guest mode
1156 ssp = None
1157 # Check if target is IPv4 or IPv6
1158 if ":" in target:
1159 family = socket.AF_INET6
1160 else:
1161 family = socket.AF_INET
1162 # Open socket
1163 sock = socket.socket(family, socket.SOCK_STREAM)
1164 # Configure socket for SMB:
1165 # - TCP KEEPALIVE, TCP_KEEPIDLE and TCP_KEEPINTVL. Against a Windows server this
1166 # isn't necessary, but samba kills the socket VERY fast otherwise.
1167 # - set TCP_NODELAY to disable Nagle's algorithm (we're streaming data)
1168 sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
1169 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
1170 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 10)
1171 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 10)
1172 # Timeout & connect

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 12

Scapy_ExceptionClass · 0.90
SMB_SOCKETClass · 0.85
_depcheckMethod · 0.80
from_cli_argumentsMethod · 0.80
isrunningMethod · 0.80
from_smblinkMethod · 0.80
connectMethod · 0.45
from_tcpsockMethod · 0.45
getMethod · 0.45
closeMethod · 0.45
resolveMethod · 0.45
loopMethod · 0.45

Tested by

no test coverage detected