Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander authored and Alexander committed Apr 30, 2019
1 parent 3606ef7 commit d0a2189
Show file tree
Hide file tree
Showing 72 changed files with 11,073 additions and 0 deletions.
25 changes: 25 additions & 0 deletions DAFT.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.438
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAFT", "DAFT\DAFT.csproj", "{2AE11D8F-27EF-436F-B960-073BC07FC864}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2AE11D8F-27EF-436F-B960-073BC07FC864}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AE11D8F-27EF-436F-B960-073BC07FC864}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AE11D8F-27EF-436F-B960-073BC07FC864}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AE11D8F-27EF-436F-B960-073BC07FC864}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0018AF8-3853-435E-BF53-E1D41BE0DB89}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions DAFT/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
68 changes: 68 additions & 0 deletions DAFT/CSVSerializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace DAFT
{
class CSVSerializer
{
private FileStream fs;

internal CSVSerializer(FileStream fs)
{
this.fs = fs;
}

internal void WriteObject<T>(List<T> o)
{
List<string> names = new List<string>();
StringBuilder line = new StringBuilder();
FieldInfo[] fields = o.First().GetType().GetFields();
foreach (var field in fields)
{
line.AppendFormat("\"{0}\",", field.Name);
names.Add(field.Name);
}
line.Append("\n");

foreach (var m in o)
{
foreach (string item in names)
{
line.AppendFormat("\"{0}\",", typeof(T).GetField(item).GetValue(m));
}
line.Append("\n");
}
_WriteObject(line.ToString());
}

internal void WriteObject<T>(T o)
{
List<string> names = new List<string>();
StringBuilder line = new StringBuilder();

FieldInfo[] fields = o.GetType().GetFields();
foreach (var field in fields)
{
line.AppendFormat("\"{0}\",", field.Name);
names.Add(field.Name);
}
line.Append("\n");

foreach (string item in names)
{
line.AppendFormat("\"{0}\",", typeof(T).GetField(item).GetValue(o));
}
line.Append("\n");
_WriteObject(line.ToString());
}

private void _WriteObject(string output)
{
byte[] info = new UTF8Encoding(true).GetBytes(output);
fs.Write(info, 0, info.Length);
}
}
}
38 changes: 38 additions & 0 deletions DAFT/Credentials.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Net;
using System.Security;

namespace DAFT
{
sealed class Credentials
{
private readonly string username;
private readonly SecureString password;
private readonly bool sqlCredential;

internal Credentials(string username, string password)
{
this.username = username;
sqlCredential = !username.Contains("\\");
this.password = new NetworkCredential("", password).SecurePassword;
this.password.MakeReadOnly();
password = string.Empty;
GC.Collect();
}

internal string GetUsername()
{
return username;
}

internal string GetPassword()
{
return new NetworkCredential("", password).Password;
}

internal bool IsSqlAccount()
{
return sqlCredential;
}
}
}
125 changes: 125 additions & 0 deletions DAFT/DAFT.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2AE11D8F-27EF-436F-B960-073BC07FC864}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DAFT</RootNamespace>
<AssemblyName>DAFT</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Credentials.cs" />
<Compile Include="CSVSerializer.cs" />
<Compile Include="Misc.cs" />
<Compile Include="Modules\Audit\SQLAuditServerSpec.cs" />
<Compile Include="Modules\Module.cs" />
<Compile Include="Modules\Audit\SQLAuditDatabaseSpec.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivAutoExecSp.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivImpersonateLogin.cs" />
<Compile Include="Modules\Audit\SQLAuditRole.cs" />
<Compile Include="Modules\nEW\SQLAuditPrivCreateProcedure.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivDbChaining.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivTrustworthy.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivServerLink.cs" />
<Compile Include="Modules\Audit\SQLAuditPrivXp.cs" />
<Compile Include="Modules\Audit\SQLAuditSQLiSpSigned.cs" />
<Compile Include="Modules\Audit\SQLAuditSQLiSpExecuteAs.cs" />
<Compile Include="Modules\SQLUncPathInjection.cs" />
<Compile Include="Modules\SQLServerPasswordHash.cs" />
<Compile Include="Modules\Link\SQLServerLinkCrawl.cs" />
<Compile Include="Modules\SQLServerLoginDefaultPw.cs" />
<Compile Include="Modules\Fuzz\SQLFuzzDomainAccount.cs" />
<Compile Include="Modules\Fuzz\SQLFuzzServerLogin.cs" />
<Compile Include="Modules\Fuzz\SQLFuzzDatabaseName.cs" />
<Compile Include="Modules\Fuzz\SQLFuzzObjectName.cs" />
<Compile Include="Modules\nEW\SQLAssemblyFile.cs" />
<Compile Include="Modules\StoredProcedure\SQLStoredProcedure.cs" />
<Compile Include="Modules\StoredProcedure\SQLStoredProcedureAutoExec.cs" />
<Compile Include="Modules\StoredProcedure\SQLStoredProcedureSQLi.cs" />
<Compile Include="Modules\StoredProcedure\SQLStoredProcedureXP.cs" />
<Compile Include="Modules\StoredProcedure\SQLStoredProcedureCLR.cs" />
<Compile Include="Modules\Trigger\SQLTriggerDml.cs" />
<Compile Include="Modules\Trigger\SQLTriggerDdl.cs" />
<Compile Include="Modules\ServerInfo\SQLServerPriv.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabasePriv.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabaseUser.cs" />
<Compile Include="Modules\ServerInfo\SQLServerRole.cs" />
<Compile Include="Modules\ServerInfo\SQLServerRoleMember.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabaseRole.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabaseRoleMember.cs" />
<Compile Include="Modules\Column\SQLColumnSampleData.cs" />
<Compile Include="Modules\Column\SQLColumn.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabase.cs" />
<Compile Include="Modules\SQLAgentJob.cs" />
<Compile Include="Modules\SQLServiceAccount.cs" />
<Compile Include="Modules\ServerInfo\SQLServerLogin.cs" />
<Compile Include="Modules\Command\SQLOSCmdAgentJob.cs" />
<Compile Include="Modules\Command\SQLOSCmdOle.cs" />
<Compile Include="Modules\Command\SQLOSCmdPython.cs" />
<Compile Include="Modules\Command\SQLOSCmdR.cs" />
<Compile Include="Modules\SQLOleDbProvider.cs" />
<Compile Include="Modules\ServerInfo\SQLServerCredential.cs" />
<Compile Include="Modules\Link\SQLServerLink.cs" />
<Compile Include="Modules\ServerInfo\SQLServerConfiguration.cs" />
<Compile Include="Modules\SQLView.cs" />
<Compile Include="Modules\DatabaseInfo\SQLDatabaseSchema.cs" />
<Compile Include="Modules\Command\SQLOSCmd.cs" />
<Compile Include="Modules\SQLQuery.cs" />
<Compile Include="Modules\ServerInfo\SQLServerInfo.cs" />
<Compile Include="Modules\SQLSession.cs" />
<Compile Include="Modules\SQLSysadminCheck.cs" />
<Compile Include="Modules\SQLTables.cs" />
<Compile Include="Options.cs" />
<Compile Include="Progam.Modules.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SQLConnection.cs" />
<Compile Include="SQLConnectionTest.cs" />
<Compile Include="SQLServers.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="DefaultCredentials.xml" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit d0a2189

Please sign in to comment.