NetExec icon indicating copy to clipboard operation
NetExec copied to clipboard

Unable to enumerate null sessions using nxc.exe

Open J005 opened this issue 1 year ago • 3 comments

Attempting to enumerate null sessions (https://www.netexec.wiki/smb-protocol/enumeration/enumerate-null-sessions) results in the following error message:

nxc.exe smb: error: argument -u: expected at least one argument

Reproduction Command: netexec smb -u '' -p '' <host> Resulted in:

usage: nxc.exe smb [-h] [-id CRED_ID [CRED_ID ...]] [-u USERNAME [USERNAME ...]] [-p PASSWORD [PASSWORD ...]] [--ignore-pw-decoding] [-k] [--no-bruteforce]
                   [--continue-on-success] [--use-kcache] [--log LOG] [--aesKey AESKEY [AESKEY ...]] [--kdcHost KDCHOST]
                   [--gfail-limit LIMIT | --ufail-limit LIMIT | --fail-limit LIMIT] [-M MODULE] [-o MODULE_OPTION [MODULE_OPTION ...]] [-L] [--options] [--server {https,http}]
                   [--server-host HOST] [--server-port PORT] [--connectback-host CHOST] [-H HASH [HASH ...]] [--delegate DELEGATE] [--self] [-d DOMAIN | --local-auth]
                   [--port {139,445}] [--share SHARE] [--smb-server-port SMB_SERVER_PORT] [--gen-relay-list OUTPUT_FILE] [--smb-timeout SMB_TIMEOUT] [--laps [LAPS]] [--sam]
                   [--lsa] [--ntds [{drsuapi,vss}]] [--dpapi [{nosystem,cookies} ...]] [--mkfile MKFILE] [--pvk PVK] [--enabled] [--user USERNTDS] [--shares]
                   [--no-write-check] [--filter-shares FILTER_SHARES [FILTER_SHARES ...]] [--sessions] [--disks] [--loggedon-users-filter LOGGEDON_USERS_FILTER]
                   [--loggedon-users] [--users [USER]] [--groups [GROUP]] [--computers [COMPUTER]] [--local-groups [GROUP]] [--pass-pol] [--rid-brute [MAX_RID]] [--wmi QUERY]
                   [--wmi-namespace NAMESPACE] [--spider SHARE] [--spider-folder FOLDER] [--content] [--exclude-dirs DIR_LIST] [--pattern PATTERN [PATTERN ...] | --regex REGEX
                   [REGEX ...]] [--depth DEPTH] [--only-files] [--put-file FILE FILE] [--get-file FILE FILE] [--append-host] [--exec-method {wmiexec,mmcexec,smbexec,atexec}]
                   [--dcom-timeout DCOM_TIMEOUT] [--get-output-tries GET_OUTPUT_TRIES] [--codec CODEC] [--force-ps32] [--no-output] [-x COMMAND | -X PS_COMMAND] [--obfs]
                   [--amsi-bypass FILE] [--clear-obfscripts]
                   target [target ...]
nxc.exe smb: error: argument -u: expected at least one argument

NetExec info nxc.exe on Windows 2022 Server (https://github.com/Pennyw0rth/NetExec/releases/download/v1.1.0/nxc.exe)

J005 avatar Apr 26 '24 01:04 J005

Target should go after the protocol, but I actually ran into this today on Windows too, using both poetry and pipx installations. I believe it's some weird parsing issue with quotes.

Marshall-Hallenbeck avatar Apr 26 '24 01:04 Marshall-Hallenbeck

Can you two try -u=''? @Marshall-Hallenbeck you are also on windows? I think there is a bug on windows argparse in python

NeffIsBack avatar Apr 26 '24 10:04 NeffIsBack

Yeah it was only on Windows I was having this issue.

Marshall-Hallenbeck avatar Apr 26 '24 19:04 Marshall-Hallenbeck

It is an issue with the windows command line: image

Closing as -u= solves the problem

NeffIsBack avatar May 27 '24 08:05 NeffIsBack