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

[Bug] ListDirectory appears to fail when current working directory is drive root #156

Open
rasta-mouse opened this issue Mar 14, 2020 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@rasta-mouse
Copy link
Contributor

Feature Request or Bug
Bug

Describe the feature request or bug
ls seems to fail when the current working directory is set to the drive root.

To Reproduce
Steps to reproduce the behavior:

  1. cd C:\
  2. ls

Expected behavior
Get directory output.

(rasta) > pwd

C:\

(rasta) > ls

System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path2
   at System.IO.Path.InternalCombine(String path1, String path2)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path)
   at SharpSploit.Enumeration.Host.GetDirectoryListing(String Path)
   at Task.Execute(String Path)

(rasta) > ls C:\

Name                               Length       CreationTimeUtc      LastAccessTimeUtc    LastWriteTimeUtc
----                               ------       ---------------      -----------------    ----------------
C:\$GetCurrent                     0            17/06/2019 18:17:32  18/06/2019 18:52:36  18/06/2019 18:52:36
C:\$Recycle.Bin                    0            11/04/2018 23:38:20  09/05/2019 17:53:44  09/05/2019 17:53:44
@cobbr
Copy link
Owner

cobbr commented Jun 13, 2020

@rasta-mouse I can't seem to reproduce this. I'm not sure what the issue was or how it was fixed, but are you able to verify this is working for you now?

@cobbr cobbr added the question Further information is requested label Jun 19, 2020
@rasta-mouse
Copy link
Contributor Author

rasta-mouse commented Jun 19, 2020

@cobbr still appears to be the case for me.

[19/06/2020 19:53:27 UTC] ChangeDirectory completed

(rasta) > cd C:\

C:\

[19/06/2020 19:53:47 UTC] GetCurrentDirectory completed

(rasta) > pwd

C:\

[19/06/2020 19:54:05 UTC] ListDirectory completed

(rasta) > ls

System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path2
   at System.IO.Path.InternalCombine(String path1, String path2)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path)
   at SharpSploit.Enumeration.Host.GetDirectoryListing(String Path)
   at Task.Execute(String Path)

I get the same on my D: drive as well

[19/06/2020 19:57:52 UTC] ChangeDirectory completed

(rasta) > cd D:\

D:\

[19/06/2020 19:57:59 UTC] GetCurrentDirectory completed

(rasta) > pwd

D:\

[19/06/2020 19:58:03 UTC] ListDirectory completed

(rasta) > ls

System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path2
   at System.IO.Path.InternalCombine(String path1, String path2)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path)
   at SharpSploit.Enumeration.Host.GetDirectoryListing(String Path)
   at Task.Execute(String Path)

@cobbr
Copy link
Owner

cobbr commented Jun 19, 2020

@rasta-mouse What's the OS Version of the target system?

@cobbr
Copy link
Owner

cobbr commented Feb 13, 2021

Ping @rasta-mouse

@rasta-mouse
Copy link
Contributor Author

Sorry @cobbr. My test system is Windows 10 Enterprise LTSC (1809).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants