Skip to content

Commit ce17130

Browse files
addit commit
1 parent 846500d commit ce17130

16 files changed

Lines changed: 1020 additions & 0 deletions

AutoLoginBuilder.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26403.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoLoginBuilder", "AutoLoginBuilder\AutoLoginBuilder.csproj", "{7009D077-EC1B-4CCC-A999-A1AEC496638E}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Debug|x86 = Debug|x86
12+
Release|Any CPU = Release|Any CPU
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Debug|x86.ActiveCfg = Debug|x86
19+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Debug|x86.Build.0 = Debug|x86
20+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Release|x86.ActiveCfg = Release|x86
23+
{7009D077-EC1B-4CCC-A999-A1AEC496638E}.Release|x86.Build.0 = Release|x86
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{7009D077-EC1B-4CCC-A999-A1AEC496638E}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>AutoLoginBuilder</RootNamespace>
10+
<AssemblyName>AutoLoginBuilder</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<TargetFrameworkProfile />
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>x64</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<Prefer32Bit>false</Prefer32Bit>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<Prefer32Bit>false</Prefer32Bit>
35+
</PropertyGroup>
36+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
37+
<PlatformTarget>x86</PlatformTarget>
38+
<OutputPath>bin\x86\Debug\</OutputPath>
39+
<WarningLevel>0</WarningLevel>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
42+
<PlatformTarget>x86</PlatformTarget>
43+
<OutputPath>bin\x86\Release\</OutputPath>
44+
</PropertyGroup>
45+
<PropertyGroup>
46+
<ApplicationManifest>app.manifest</ApplicationManifest>
47+
</PropertyGroup>
48+
<PropertyGroup>
49+
<ApplicationIcon>chevron.ico</ApplicationIcon>
50+
</PropertyGroup>
51+
<ItemGroup>
52+
<Reference Include="System" />
53+
<Reference Include="System.Core" />
54+
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55+
<SpecificVersion>False</SpecificVersion>
56+
<HintPath>..\..\..\..\..\..\..\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</HintPath>
57+
</Reference>
58+
<Reference Include="System.Xml.Linq" />
59+
<Reference Include="System.Data.DataSetExtensions" />
60+
<Reference Include="System.Data" />
61+
<Reference Include="System.Deployment" />
62+
<Reference Include="System.Drawing" />
63+
<Reference Include="System.Windows.Forms" />
64+
<Reference Include="System.Xml" />
65+
</ItemGroup>
66+
<ItemGroup>
67+
<Compile Include="CMDCli.cs" />
68+
<Compile Include="Form1.cs">
69+
<SubType>Form</SubType>
70+
</Compile>
71+
<Compile Include="Form1.Designer.cs">
72+
<DependentUpon>Form1.cs</DependentUpon>
73+
</Compile>
74+
<Compile Include="Program.cs" />
75+
<Compile Include="Properties\AssemblyInfo.cs" />
76+
<Compile Include="Worker.cs" />
77+
<EmbeddedResource Include="Form1.resx">
78+
<DependentUpon>Form1.cs</DependentUpon>
79+
</EmbeddedResource>
80+
<EmbeddedResource Include="Properties\Resources.resx">
81+
<Generator>ResXFileCodeGenerator</Generator>
82+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
83+
<SubType>Designer</SubType>
84+
</EmbeddedResource>
85+
<Compile Include="Properties\Resources.Designer.cs">
86+
<AutoGen>True</AutoGen>
87+
<DependentUpon>Resources.resx</DependentUpon>
88+
<DesignTime>True</DesignTime>
89+
</Compile>
90+
<None Include="app.config" />
91+
<None Include="app.manifest">
92+
<SubType>Designer</SubType>
93+
</None>
94+
<None Include="Properties\Settings.settings">
95+
<Generator>SettingsSingleFileGenerator</Generator>
96+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
97+
</None>
98+
<Compile Include="Properties\Settings.Designer.cs">
99+
<AutoGen>True</AutoGen>
100+
<DependentUpon>Settings.settings</DependentUpon>
101+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
102+
</Compile>
103+
</ItemGroup>
104+
<ItemGroup>
105+
<Content Include="chevron.ico" />
106+
</ItemGroup>
107+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
108+
</Project>

AutoLoginBuilder/CMDCli.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace AutoLoginBuilder
8+
{
9+
class CMDCli
10+
{
11+
char p = '"';
12+
Worker wkr = new Worker();
13+
public void arguments(string[] args)
14+
{
15+
if (args[0] == "remove")
16+
{
17+
remover();
18+
}
19+
else if(args.Length == 3)
20+
{
21+
adder(args[0], args[1], args[2]);
22+
}
23+
else
24+
{
25+
throw new ArgumentOutOfRangeException("num2 > double.MaxValue - num1.");
26+
}
27+
}
28+
private void adder(string domain,string username,string password)
29+
{
30+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v AutoAdminLogon /t REG_SZ /d 1 /f /reg:64");
31+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultUserName /t REG_SZ /d " + username + " /f /reg:64");
32+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultDomainName /t REG_SZ /d " + domain + " /f /reg:64");
33+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultPassword /t REG_SZ /d " + password + " /f /reg:64");
34+
}
35+
private void remover()
36+
{
37+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v AutoAdminLogon /t REG_SZ /d 0 /f /reg:64");
38+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultUserName /t REG_SZ /d " + p + p + " /f /reg:64");
39+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultDomainName /t REG_SZ /d " + p + p + " /f /reg:64");
40+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultPassword /t REG_SZ /d " + p + p + " /f /reg:64");
41+
}
42+
}
43+
}

AutoLoginBuilder/Form1.Designer.cs

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AutoLoginBuilder/Form1.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace AutoLoginBuilder
5+
{
6+
public partial class Form1 : Form
7+
{
8+
string[] args = Environment.GetCommandLineArgs();
9+
Worker wkr = new Worker();
10+
char p = '"';
11+
public Form1()
12+
{
13+
InitializeComponent();
14+
}
15+
16+
private void RemoveButton_Click(object sender, EventArgs e)
17+
{
18+
wkr.ExecuteCommand("REG ADD "+p+"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"+p+" /v AutoAdminLogon /t REG_SZ /d 0 /f /reg:64");
19+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultUserName /t REG_SZ /d "+p+p+" /f /reg:64");
20+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultDomainName /t REG_SZ /d " + p + p + " /f /reg:64");
21+
wkr.ExecuteCommand("REG ADD "+p+"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"+p+" /v DefaultPassword /t REG_SZ /d "+p+p+" /f /reg:64");
22+
}
23+
24+
private void BuilderButtonClick_Click(object sender, EventArgs e)
25+
{
26+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v AutoAdminLogon /t REG_SZ /d 1 /f /reg:64");
27+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultUserName /t REG_SZ /d " + UsernameTextBox.Text + " /f /reg:64");
28+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultDomainName /t REG_SZ /d " + DomainTextBox.Text + " /f /reg:64");
29+
wkr.ExecuteCommand("REG ADD " + p + "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" + p + " /v DefaultPassword /t REG_SZ /d " + PasswordTextBox.Text + " /f /reg:64");
30+
}
31+
32+
33+
private void Form1_Load(object sender, EventArgs e)
34+
{
35+
36+
PasswordTextBox.PasswordChar = '*';
37+
string[] strArr = wkr.defaultDomain(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
38+
UsernameTextBox.Text = strArr[1];
39+
DomainTextBox.Text = strArr[0];
40+
}
41+
42+
}
43+
}

0 commit comments

Comments
 (0)