├── images
├── sqlrecon-40.png
└── sqlrecon-original.png
├── SQLRecon
├── SQLRecon
│ ├── App.config
│ ├── utilities
│ │ ├── DomainSearcher.cs
│ │ ├── Random.cs
│ │ ├── Ldap.cs
│ │ ├── Impersonate.cs
│ │ ├── SQLAuthentication.cs
│ │ ├── FormatQuery.cs
│ │ ├── SetAuthenticationType.cs
│ │ ├── Help.cs
│ │ └── Print.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── app.manifest
│ ├── Program.cs
│ ├── modules
│ │ ├── ExecuteQuery.cs
│ │ ├── GetDomainSPNs.cs
│ │ ├── XPCmdShell.cs
│ │ ├── OleAutomation.cs
│ │ ├── Info.cs
│ │ ├── Roles.cs
│ │ └── ConfigureOptions.cs
│ ├── tests
│ │ ├── SQLRecon-SCCM-Modules-Test.ps1
│ │ ├── SQLRecon-Linked-Chain-Modules-Test.ps1
│ │ ├── SQLRecon-Linked-Modules-Test.ps1
│ │ ├── SQLRecon-Impersonation-Modules-Test.ps1
│ │ └── SQLRecon-Standard-Modules-Test.ps1
│ ├── commands
│ │ ├── EnumerationModules.cs
│ │ ├── GlobalVariables.cs
│ │ └── Queries.cs
│ └── SQLRecon.csproj
└── SQLRecon.sln
├── LICENSE
└── .gitignore
/images/sqlrecon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xforcered/SQLRecon/HEAD/images/sqlrecon-40.png
--------------------------------------------------------------------------------
/images/sqlrecon-original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xforcered/SQLRecon/HEAD/images/sqlrecon-original.png
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon/utilities/DomainSearcher.cs:
--------------------------------------------------------------------------------
1 | using System.DirectoryServices;
2 |
3 | namespace SQLRecon.Utilities
4 | {
5 | internal sealed class DomainSearcher
6 | {
7 | internal DirectoryEntry Directory { get; }
8 |
9 | internal DomainSearcher()
10 | {
11 | Directory = new DirectoryEntry();
12 | }
13 |
14 | internal DomainSearcher(string path)
15 | {
16 | Directory = new DirectoryEntry(path);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon/utilities/Random.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace SQLRecon.Utilities
5 | {
6 | internal abstract class RandomStr
7 | {
8 | private static readonly Random _rand = new();
9 |
10 | ///
11 | /// The Generate method will generate a random string.
12 | ///
13 | ///
14 | ///
15 | internal static string Generate(int length)
16 | {
17 | const string characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
18 |
19 | StringBuilder sb = new StringBuilder();
20 |
21 | for (int i = 0; i < length; i++)
22 | {
23 | sb.Append(characters[_rand.Next(0, characters.Length)]);
24 | }
25 |
26 | return sb.ToString();
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("SQLRecon")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("SQLRecon")]
12 | [assembly: AssemblyCopyright("Copyright © 2025")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("612c7c82-d501-417a-b8db-73204fdfda06")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("3.9.0")]
35 | [assembly: AssemblyFileVersion("3.9.0")]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2023, Sanjiv Kawa
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30907.101
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLRecon", "SQLRecon\SQLRecon.csproj", "{612C7C82-D501-417A-B8DB-73204FDFDA06}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Release|Any CPU = Release|Any CPU
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Debug|x64.ActiveCfg = Release|x64
17 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Debug|x64.Build.0 = Release|x64
18 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Release|x64.ActiveCfg = Release|x64
21 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Release|x64.Build.0 = Release|x64
22 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {612C7C82-D501-417A-B8DB-73204FDFDA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {1ADC0E55-2130-44AA-818E-BC8942683771}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SQLRecon/SQLRecon/utilities/Ldap.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.DirectoryServices;
4 |
5 | namespace SQLRecon.Utilities
6 | {
7 | internal sealed class Ldap
8 | {
9 | private readonly DomainSearcher _searcher;
10 |
11 | internal Ldap(DomainSearcher searcher)
12 | {
13 | _searcher = searcher;
14 | }
15 |
16 | ///
17 | /// The ExecuteLdapQuery method allows LDAP queries to be executed
18 | /// against a domain controller.
19 | ///
20 | ///
21 | ///
22 | ///
23 | internal Dictionary> ExecuteLdapQuery(string filter, string[] properties = null)
24 | {
25 | DirectorySearcher searcher = new DirectorySearcher(_searcher.Directory)
26 | {
27 | Filter = filter,
28 | };
29 |
30 | if (properties is not null)
31 | {
32 | searcher.PropertiesToLoad.AddRange(properties);
33 | }
34 |
35 | SearchResultCollection searchResultCollection = searcher.FindAll();
36 |
37 | Dictionary> resultDictionary = new Dictionary>();
38 |
39 | foreach (SearchResult searchResult in searchResultCollection)
40 | {
41 | resultDictionary.Add(searchResult.Path, null);
42 |
43 | Dictionary dictionary = new Dictionary();
44 |
45 | foreach (DictionaryEntry entry in searchResult.Properties)
46 | {
47 | List