mirror of
https://github.com/p0dalirius/smbclient-ng
synced 2026-08-09 13:02:38 +00:00
Release 2.1.6, Fixed #84
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "smbclientng"
|
||||
version = "2.1.5"
|
||||
version = "2.1.6"
|
||||
description = "smbclient-ng, a fast and user friendly way to interact with SMB shares."
|
||||
authors = ["p0dalirius"]
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import setuptools
|
||||
|
||||
|
||||
VERSION = "2.1.5"
|
||||
VERSION = "2.1.6"
|
||||
|
||||
|
||||
long_description = """
|
||||
|
||||
@@ -13,7 +13,7 @@ from smbclientng.core.Logger import Logger
|
||||
from smbclientng.core.SessionsManager import SessionsManager
|
||||
|
||||
|
||||
VERSION = "2.1.5"
|
||||
VERSION = "2.1.6"
|
||||
|
||||
|
||||
def parseArgs():
|
||||
@@ -32,6 +32,7 @@ def parseArgs():
|
||||
parser.add_argument("-N", "--not-interactive", dest="not_interactive", required=False, action="store_true", default=False, help="Non interactive mode.")
|
||||
parser.add_argument("-L", "--logfile", dest="logfile", metavar="LOGFILE", required=False, default=None, type=str, help="File to write logs to.")
|
||||
parser.add_argument("--timeout", dest="timeout", metavar="TIMEOUT", required=False, type=float, default=3, help="Timeout in seconds for SMB connections (default: 3)")
|
||||
parser.add_argument("--advertised-name", dest="advertisedName", metavar="ADVERTISED_NAME", required=False, type=str, help="Advertised name of your machine to the SMB client.")
|
||||
|
||||
group_target = parser.add_argument_group("Target")
|
||||
group_target.add_argument("--host", action="store", metavar="HOST", required=True, type=str, help="IP address or hostname of the SMB Server to connect to.")
|
||||
@@ -128,6 +129,7 @@ def main():
|
||||
host=options.host,
|
||||
port=options.port,
|
||||
timeout=options.timeout,
|
||||
advertisedName=options.advertisedName
|
||||
)
|
||||
|
||||
# Start the main interactive command line
|
||||
|
||||
@@ -53,7 +53,7 @@ class SMBSession(object):
|
||||
test_rights(sharename): Tests read and write access rights on a share.
|
||||
"""
|
||||
|
||||
def __init__(self, host, port, timeout, credentials, config=None, logger=None):
|
||||
def __init__(self, host, port, timeout, credentials, advertisedName=None, config=None, logger=None):
|
||||
super(SMBSession, self).__init__()
|
||||
# Objects
|
||||
self.config = config
|
||||
@@ -65,6 +65,7 @@ class SMBSession(object):
|
||||
self.port = port
|
||||
# Timeout (default 3 seconds)
|
||||
self.timeout = timeout
|
||||
self.advertisedName = advertisedName
|
||||
|
||||
# Credentials
|
||||
self.credentials = credentials
|
||||
@@ -125,6 +126,7 @@ class SMBSession(object):
|
||||
self.smbClient = impacket.smbconnection.SMBConnection(
|
||||
remoteName=self.host,
|
||||
remoteHost=self.host,
|
||||
myName=self.advertisedName,
|
||||
sess_port=int(self.port),
|
||||
timeout=self.timeout,
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ class SessionsManager(object):
|
||||
self.config = config
|
||||
self.logger = logger
|
||||
|
||||
def create_new_session(self, credentials, host, timeout, port=445):
|
||||
def create_new_session(self, credentials, host, timeout, port=445, advertisedName=None):
|
||||
"""
|
||||
Creates a new session with the given session information.
|
||||
|
||||
@@ -54,6 +54,7 @@ class SessionsManager(object):
|
||||
port=port,
|
||||
timeout=timeout,
|
||||
credentials=credentials,
|
||||
advertisedName=advertisedName,
|
||||
config=self.config,
|
||||
logger=self.logger
|
||||
)
|
||||
@@ -127,6 +128,7 @@ class SessionsManager(object):
|
||||
|
||||
# Create
|
||||
mode_create = ModuleArgumentParser(add_help=False, description="Create a new session.")
|
||||
mode_create.add_argument("--advertised-name", dest="advertisedName", metavar="ADVERTISED_NAME", required=False, type=str, help="Advertised name of your machine to the SMB client.")
|
||||
group_target = mode_create.add_argument_group("Target")
|
||||
group_target.add_argument("--host", action="store", metavar="HOST", required=True, type=str, help="IP address or hostname of the SMB Server to connect to.")
|
||||
group_target.add_argument("--port", action="store", metavar="PORT", type=int, default=445, help="Port of the SMB Server to connect to. (default: 445)")
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
python3 main.py -d 'LAB' -u 'Administrator' -p 'Admin123!' --host '192.168.56.106' ${@}
|
||||
python3 main.py -d 'LAB' -u 'Administrator' -p 'Admin123!' --host '10.0.0.201' ${@}
|
||||
|
||||
Reference in New Issue
Block a user