public override string[] Execute(ParsedArgs args) { LDAP domainQuery = new LDAP(); List <string> domainComputers = domainQuery.CaptureComputers(); return(domainComputers.ToArray()); }
public override string[] Execute(ParsedArgs args) { LDAP computerQuery = new LDAP(); List <string> domainSystems = computerQuery.CaptureComputers(); Amass shareMe = new Amass(); List <string> allShares = shareMe.GetShares(domainSystems); return(allShares.ToArray()); }
public override string[] Execute(ParsedArgs args) { try { List <string> domainComputers = new List <string>(); LDAP domainQuery = new LDAP(); if (string.IsNullOrEmpty(args.DomainName)) { domainComputers = domainQuery.CaptureComputers(); } else { domainComputers = domainQuery.CaptureComputers(args.DomainName); } return(domainComputers.ToArray()); } catch (Exception e) { return(new string[] { "[X] Failure to enumerate info - " + e }); } }
public override string[] Execute(ParsedArgs args) { if (string.IsNullOrEmpty(args.ProcessName)) { throw new EDDException("ProcessName cannot be empty"); } LDAP procQuery = new LDAP(); List <string> procComputers = procQuery.CaptureComputers(); WMI processSearcher = new WMI(); List <string> systemsWithProc = processSearcher.CheckProcesses(procComputers, args.ProcessName); return(systemsWithProc.ToArray()); }
public override string[] Execute(ParsedArgs args) { try { LDAP computerQuery = new LDAP(); List <string> domainSystems = computerQuery.CaptureComputers(); Amass shareMe = new Amass(); string[] allShares = shareMe.GetShares(domainSystems, args.Threads); return(allShares); } catch (Exception e) { return(new string[] { "[X] Failure to enumerate info - " + e }); } }
public override string[] Execute(ParsedArgs args) { try { if (!string.IsNullOrEmpty(args.GroupName) && !string.IsNullOrEmpty(args.UserName)) { throw new EDDException("Please use GroupName or UserName, not both"); } LDAP compQuery = new LDAP(); List <string> windowsComputers = compQuery.CaptureComputers(); if (windowsComputers.Count < 1) { throw new EDDException("No domain computers could be found"); } string[] results = new string[] { }; // if group and user is null, search for domain admins if (string.IsNullOrEmpty(args.GroupName) && string.IsNullOrEmpty(args.UserName)) { results = FindMembersOfGroup(windowsComputers, "Domain Admins"); } // if group is not null and user is null, search for group if (!string.IsNullOrEmpty(args.GroupName) && string.IsNullOrEmpty(args.UserName)) { results = FindMembersOfGroup(windowsComputers, args.GroupName); } // if group is null and user is not null, search for user if (string.IsNullOrEmpty(args.GroupName) && !string.IsNullOrEmpty(args.UserName)) { results = FindUser(windowsComputers, args.UserName); } return(results); } catch (Exception e) { return(new string[] { "[X] Failure to enumerate info - " + e }); } }
public override string[] Execute(ParsedArgs args) { List <string> readableShares = new List <string>(); try { LDAP computerQuery = new LDAP(); List <string> domainSystems = computerQuery.CaptureComputers(); Amass shareMe = new Amass(); string[] allShares = shareMe.GetShares(domainSystems, args.Threads); foreach (string shareDir in allShares) { try { string[] subdirectoryEntries = Directory.GetDirectories(shareDir); readableShares.Add(shareDir); } catch (UnauthorizedAccessException) { // do nothing } catch (IOException) { // do nothing either } } return(readableShares.ToArray()); } catch (Exception e) { foreach (string path in readableShares) { Console.WriteLine(path); } Console.WriteLine("[X] ERROR State Occurred - Paths above are current status prior to error!"); return(new string[] { "[X] Failure to enumerate info - " + e }); } }
public override string[] Execute(ParsedArgs args) { LDAP computerQuery = new LDAP(); List <string> interestingFiles = new List <string>(); List <Regex> regexList = new List <Regex>(); string[] allShares = new string[1]; if (string.IsNullOrEmpty(args.SharePath)) { List <string> domainSystems = computerQuery.CaptureComputers(); Amass shareMe = new Amass(); allShares = shareMe.GetShares(domainSystems, args.Threads); } else { allShares[0] = args.SharePath; } // We need to convert the given wildcard string to regex and account for multiple strings foreach (var term in args.SearchTerms) { if (term.Contains("*")) { string regexText = WildcardToRegex(term); Regex regex = new Regex(regexText, RegexOptions.IgnoreCase); regexList.Add(regex); } else { Regex regex = new Regex(term, RegexOptions.IgnoreCase); regexList.Add(regex); } } // Pipe multiple search strings together into one regex string var regexString = regexList.Count() > 1 ? string.Join("|", regexList) : regexList[0].ToString(); if (allShares != null) { foreach (var share in allShares) { try { Parallel.ForEach(GetFiles(share), file => { if (Regex.IsMatch(file, regexString, RegexOptions.IgnoreCase)) { interestingFiles.Add(file); } }); } catch (UnauthorizedAccessException) { //Do nothing } } } return(interestingFiles.ToArray()); }
public override string[] Execute(ParsedArgs args) { List <string> successfulShareWrites = new List <string>(); try { LDAP computerQuery = new LDAP(); List <string> domainSystems = computerQuery.CaptureComputers(); Amass shareMe = new Amass(); string[] allShares = shareMe.GetShares(domainSystems, args.Threads); foreach (string sharePath in allShares) { // Get current date to have something to write string time = DateTime.Now.ToString(); // try to write directly to the root of the share try { using (StreamWriter outputFile = new StreamWriter(Path.Combine(sharePath, "testwritefile.txt"))) { outputFile.WriteLine(time); successfulShareWrites.Add(sharePath); } File.Delete(Path.Combine(sharePath, "testwritefile.txt")); if (File.Exists(Path.Combine(sharePath, "testwritefile.txt"))) { Console.WriteLine("[-] ALERT: Successfully wrote file but could not delete it at this location: " + Path.Combine(sharePath, "testwritefile.txt")); } } catch (UnauthorizedAccessException) { // do nothing } catch (IOException) { // do nothing } try { // enumerate folders in the share string[] dirNames = Directory.GetDirectories(sharePath, "*", SearchOption.TopDirectoryOnly); // try to write to the 1st level of folders foreach (string subdirPath in dirNames) { try { using (StreamWriter outputFile = new StreamWriter(Path.Combine(subdirPath, "testwritefile.txt"))) { outputFile.WriteLine(time); successfulShareWrites.Add(subdirPath); } File.Delete(Path.Combine(subdirPath, "testwritefile.txt")); if (File.Exists(Path.Combine(subdirPath, "testwritefile.txt"))) { Console.WriteLine("[-] ALERT: Successfully wrote file but could not delete it at this location: " + Path.Combine(subdirPath, "testwritefile.txt")); } } catch (UnauthorizedAccessException) { // do nothing } catch (IOException) { // do nothing } } } catch (IOException) { // ignore } catch (UnauthorizedAccessException) { // ignore } } return(successfulShareWrites.ToArray()); } catch (Exception e) { foreach (string path in successfulShareWrites) { Console.WriteLine(path); } Console.WriteLine("[X] ERROR State Occurred - Paths above are current status prior to error!"); return(new string[] { "[X] Failure to enumerate info - " + e }); } }