Skip to content

Commit 74dcca3

Browse files
authored
Add files via upload
1 parent 75129ca commit 74dcca3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Get-RBCD-Threaded/Program.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static void Main(string[] args)
5757
string password = null;
5858
string domain = null;
5959
string outputfile = null;
60+
bool ldapInSecure = false;
6061
bool help = false;
6162
bool searchForest = false;
6263

@@ -67,6 +68,7 @@ static void Main(string[] args)
6768
{"d|domain=", "Fully qualified domain name to authenticate to", v => domain = v},
6869
{"s|searchforest", "Enumerate all domains and forests", v => searchForest = true },
6970
{"o|outputfile=", "Output to a CSV file. Please provided full path to file and file name.", v => outputfile = v },
71+
{"i|insecure", "Force insecure LDAP connect if LDAPS is causing connection issues.", v => ldapInSecure = true },
7072
{ "h|?|help", "Show this help", v => help = true }
7173
};
7274

@@ -107,17 +109,28 @@ static void Main(string[] args)
107109
searchBase = "LDAP://DC=" + currentDomain.Replace(".", ",DC=");
108110
Console.WriteLine("The LDAP search base is " + searchBase);
109111

112+
string ldapConnect = null;
113+
if (ldapInSecure)
114+
{
115+
ldapConnect = "LDAP://" + currentDomain;
116+
}
117+
else
118+
{
119+
ldapConnect = "LDAP://" + currentDomain + ":636";
120+
Console.WriteLine(ldapConnect);
121+
}
122+
110123
// Authenticate the user
111124
if (username != null && password != null)
112125
{
113126
Console.WriteLine(format: "Credential information submitted. Attempting to authenticate to {0} as {1}", currentDomain, username);
114127
Test_Credentials(username, password, currentDomain);
115-
adEntry = new DirectoryEntry("LDAP://"+currentDomain, username, password);
128+
adEntry = new DirectoryEntry(ldapConnect, username, password);
116129
domainContext = new DirectoryContext(DirectoryContextType.Domain, currentDomain, username, password);
117130
}
118131
else
119132
{
120-
adEntry = new DirectoryEntry(searchBase);
133+
adEntry = new DirectoryEntry(ldapConnect);
121134
domainContext = new DirectoryContext(DirectoryContextType.Domain, currentDomain);
122135
}
123136

0 commit comments

Comments
 (0)