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

Update mssqlclient.py #1381

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Update mssqlclient.py #1381

wants to merge 4 commits into from

Conversation

kiriknik
Copy link

Add functionality to upload files

Add functionality to upload files
@0xdeaddood 0xdeaddood added the on hold Awaiting an action or decision to move forward label Mar 16, 2023
@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Sep 26, 2024
@gabrielg5
Copy link
Collaborator

Hey @kiriknik, sorry coming so late to this one

Thanks for this PR!

This branch should be rebased with latest changes as we've modified this example to make it callable from ntlmrelayx as an interactive shell; so some classes have been moved to other files (now it is in impacket/examples/mssqlshell.py)

Despite that, I've been checking it and have a few comments:

  • Some error handling should be added to the command. I run it here and faced these, for example: file not found, remote file exists, permission denied... ie
  • It should be checked if xp_cmdshell is enabled. If not, we will need to fail and ask the user to do so (I wouldn't enable it automatically, just in case...)
  • tqdm should be added in the requirements and setup.py files - or removed and show progress in a different way -
  • Instead than windows and linux in this log line "[+] MD5 hashes match\n[*] In windows: {} in linux: {}".format(md5sum,md5sum_uploaded), I would say something like local / remote or even something more verbose Impacket Host / SQL Server host
  • A super tiny detail, alignment of commands description in the help output 🤓; and also the description of the new upload one can be changed to something that explains what the command does besides specifying what's required in those parameters
    image

Thank you!

@gabrielg5 gabrielg5 added waiting for response Further information is needed from people who opened the issue or pull request and removed on hold Awaiting an action or decision to move forward labels Oct 23, 2024
@gabrielg5
Copy link
Collaborator

Implemented requested changes.

  • Validating if xp_cmdshell is enabled - returning if not
  • Parsing command parameters with shlex
  • Uploading file and validating its there with xp_fileexist

Removed addition of tqdm dependency. It is a nice UX but rather more related to the examples than to the library itself.
Linking with #1810 to take into account when working on splitting examples from library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review This issue or pull request is being analyzed waiting for response Further information is needed from people who opened the issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants