Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to mask command #33

Merged
merged 1 commit into from
Jan 25, 2021
Merged

add option to mask command #33

merged 1 commit into from
Jan 25, 2021

Conversation

s0rthak
Copy link
Contributor

@s0rthak s0rthak commented Jan 25, 2021

Hi,

This pull request adds an option in the samba-client constructor to mask command by passing maskCmd: true.
This flag defaults to false in order to not disturb any existing functionality.

I've tested it with a few error cases. Differences are shown below:

OS: Debian GNU/Linux 9 (stretch)
smbclient: Version 4.5.16-Debian

(1): Incorrect Network name:
maskCmd: false

Error: Command failed: smbclient -U 'some-username' -c 'dir ' //10.10.0.2/bad-dir-path '<some_password>' --max-protocol SMB3↵Domain=[...] OS=[] Server=[]↵tree connect failed: NT_STATUS_BAD_NETWORK_NAME↵Domain=[...] OS=[] Server=[]↵

maskCmd: true

Error: tree connect failed: NT_STATUS_BAD_NETWORK_NAME↵Domain=[...] OS=[] Server=[]↵

(2): Incorrect credentials
maskCmd: false

Error: Command failed: smbclient -U 'some-username' -c 'dir ' //10.10.0.2/test '<some_password>' --max-protocol SMB3↵session setup failed: NT_STATUS_LOGON_FAILURE↵

maskCmd: true

Error: session setup failed: NT_STATUS_LOGON_FAILURE↵

(3): smbclient not installed
maskCmd: false

Error: Command failed: smbclient -U 'Guest' -N -c 'mkdir test-directory' 
/bin/sh: smbclient: command not found
/bin/sh: smbclient: command not found

maskCmd: true

Error: /bin/sh: smbclient: command not found

I eagerly await any feedback on this PR. Thanks in advance!

Closes #32

@jakesjews
Copy link
Member

thanks!

@jakesjews jakesjews merged commit ba22f5f into eflexsystems:master Jan 25, 2021
@s0rthak s0rthak deleted the mask-cmd branch January 25, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to mask command
2 participants