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 (Windows): Default path only scans the system partition. #54

Open
sibalzer opened this issue Dec 20, 2021 · 4 comments
Open

Bug (Windows): Default path only scans the system partition. #54

sibalzer opened this issue Dec 20, 2021 · 4 comments

Comments

@sibalzer
Copy link

sibalzer commented Dec 20, 2021

By default, the scanner uses "/" as the starting point. Under Windows, os.scandir assumes "/" as the root of the system partition, i.e. other partitions are not scanned by default.

@yunzheng
Copy link
Member

Hi, we have a note about this in the README.md for windows that it only scans the root drive c:\

Thanks for your patch, do you think it's possible to check fi the drive is a logical drive and not a mapped network share?
I'm concerned that people deploy this in their networks and causes every host to scan the same share :D

Or maybe this is a non issue as you mention you can exclude drives using the --exclude flag. Happy to hear your thoughts.

@hvdort
Copy link

hvdort commented Dec 20, 2021

I have added some code to do it automatic:

  1. add reference on top:
    import wmi

  2. add line 301 - 306:
    parser.add_argument(
    "-a",
    "--all-drives",
    action="store_true",
    help="all local drives (windows)"
    )

  3. add this snippet after "print (FIGLET)":

    if args.all_drives:
    args.path.remove('/')
    for d in wmi.WMI().Win32_LogicalDisk():
    if d.DriveType == 3:
    args.path.append(d.Name+'\')

I'm not a programmer. Anybody else the possibility to make a pull request with this code?

If you compile the code at yourself run once: pip install wmi

@sibalzer
Copy link
Author

@yunzheng I didn't see this as a problem at first because under Linux all connected network drives are scanned as well. As proposed by @hvdort we can use the win32 api to get the logical drives. However i suggest to use it via ctypes to not create additional dependency. Working on it rn.

@sibalzer
Copy link
Author

bc1be64 adds a check for local drives.

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

No branches or pull requests

3 participants