Merge pull request #461 from Signum21/master

Handle path access denied
This commit is contained in:
SirBroccoli 2025-03-30 19:18:34 +02:00 committed by GitHub
commit e5239f8c58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -183,11 +183,19 @@ namespace winPEAS.Helpers
//////// MISC //////// //////// MISC ////////
////////////////////// //////////////////////
public static List<string> ListFolder(String path) public static List<string> ListFolder(String path)
{
try
{ {
string root = @Path.GetPathRoot(Environment.SystemDirectory) + path; string root = @Path.GetPathRoot(Environment.SystemDirectory) + path;
var dirs = from dir in Directory.EnumerateDirectories(root) select dir; var dirs = from dir in Directory.EnumerateDirectories(root) select dir;
return dirs.ToList(); return dirs.ToList();
} }
catch(Exception ex)
{
//Path can't be accessed
return new List<string>();
}
}
internal static byte[] CombineArrays(byte[] first, byte[] second) internal static byte[] CombineArrays(byte[] first, byte[] second)
{ {