Skip to content

Commit

Permalink
Merge pull request #52 from StopThatTalace/main
Browse files Browse the repository at this point in the history
  • Loading branch information
p0dalirius authored Jun 22, 2024
2 parents 17b49ec + 82c1a8d commit 2bd4e5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions smbclientng/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def parseArgs():
parser.add_argument("--debug", dest="debug", action="store_true", default=False, help="Debug mode.")
parser.add_argument("--no-colors", dest="no_colors", action="store_true", default=False, help="No colors mode.")
parser.add_argument("--target", action="store", metavar="ip address", required=True, type=str, help="IP Address of the SMB Server to connect to.")
parser.add_argument("--port", action="store", metavar="port of smb service", type=int, default='445', help="Port of the SMB Server to connect to.")


authconn = parser.add_argument_group("Authentication & connection")
authconn.add_argument("--kdcHost", dest="kdcHost", action="store", metavar="FQDN KDC", help="FQDN of KDC for Kerberos.")
Expand Down Expand Up @@ -97,6 +99,7 @@ def main():

smbSession = SMBSession(
address=options.target,
port=options.port,
domain=options.auth_domain,
username=options.auth_username,
password=options.auth_password,
Expand Down
6 changes: 4 additions & 2 deletions smbclientng/core/SMBSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ class SMBSession(object):
Initializes the SMB session by connecting to the server and authenticating using the specified method.
"""

def __init__(self, address, domain, username, password, lmhash, nthash, use_kerberos=False, kdcHost=None, config=None):
def __init__(self, address, port, domain, username, password, lmhash, nthash, use_kerberos=False, kdcHost=None, config=None):
super(SMBSession, self).__init__()
# Objects
self.config = config

# Target server
self.address = address
# Target port (by default on 445)
self.port = port

# Credentials
self.domain = domain
Expand Down Expand Up @@ -94,7 +96,7 @@ def init_smb_session(self):
self.smbClient = impacket.smbconnection.SMBConnection(
remoteName=self.address,
remoteHost=self.address,
sess_port=int(445)
sess_port=int(self.port)
)
except OSError as err:
print("[!] %s" % err)
Expand Down

0 comments on commit 2bd4e5b

Please sign in to comment.