mirror of
https://github.com/peass-ng/PEASS-ng.git
synced 2025-12-12 23:59:53 -08:00
Handle path access denied
The program crashes when trying to access a path that is not allowed. An exampe of this can be found on the latest HackTheBox machine (TheFrizz) where the starting user can't access the path C:\Users
This commit is contained in:
@@ -183,11 +183,19 @@ namespace winPEAS.Helpers
|
||||
//////// MISC ////////
|
||||
//////////////////////
|
||||
public static List<string> ListFolder(String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string root = @Path.GetPathRoot(Environment.SystemDirectory) + path;
|
||||
var dirs = from dir in Directory.EnumerateDirectories(root) select dir;
|
||||
return dirs.ToList();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
//Path can't be accessed
|
||||
return new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
internal static byte[] CombineArrays(byte[] first, byte[] second)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user