From 14359b98556a5c1d7a358156d8ccc6992fea062a Mon Sep 17 00:00:00 2001 From: Styris Date: Tue, 25 Jul 2023 21:47:14 -0700 Subject: [PATCH] C# Update --- .gitignore | 559 +++ README.md | 104 +- amecs.cmd | 3948 ----------------- screenshot.png | Bin 30742 -> 34419 bytes src/7z.dll | Bin 0 -> 1814016 bytes src/Actions/.NET.cs | 214 + src/Actions/AutoLogon.cs | 313 ++ src/Actions/Elevation.cs | 21 + src/Actions/Languages.cs | 1089 +++++ src/Actions/Lockscreen.cs | 113 + src/Actions/Profile.cs | 124 + src/Actions/UserPass.cs | 220 + src/Actions/UsernameRequirement.cs | 19 + src/Actions/Users.cs | 288 ++ .../ConsoleTUI/ConsoleTUI.cs | 201 + .../ConsoleTUI/Frame.cs | 198 + .../ConsoleTUI/FrameWriteMethods.cs | 396 ++ .../ConsoleTUI/Menu.cs | 433 ++ .../ConsoleTUI/MouseInterface.cs | 196 + .../ConsoleTUI/Prompt.cs | 604 +++ src/Ameliorated.ConsoleUtils/ConsoleUtils.cs | 250 ++ src/Ameliorated.ConsoleUtils/Extensions.cs | 88 + src/Ameliorated.ConsoleUtils/ParentProcess.cs | 74 + src/Ameliorated.ConsoleUtils/Payload.cs | 6 + src/Extra/Extra.cs | 342 ++ src/Extra/NVCP.cs | 281 ++ src/Extra/WSH.cs | 40 + src/FodyWeavers.xml | 3 + src/Globals.cs | 41 + src/NSudo.cs | 512 +++ src/Program.cs | 168 + src/Properties/AssemblyInfo.cs | 35 + src/Registry.cs | 375 ++ src/amecs.cs | 263 ++ src/amecs.csproj | 251 ++ src/amecs.ico | Bin 0 -> 105758 bytes src/amecs.png | Bin 0 -> 431334 bytes src/amecs.sln | 16 + src/amecs_old.ico | Bin 0 -> 43006 bytes src/app.manifest | 10 + src/packages.config | 62 + 41 files changed, 7824 insertions(+), 4033 deletions(-) create mode 100644 .gitignore delete mode 100644 amecs.cmd create mode 100644 src/7z.dll create mode 100644 src/Actions/.NET.cs create mode 100644 src/Actions/AutoLogon.cs create mode 100644 src/Actions/Elevation.cs create mode 100644 src/Actions/Languages.cs create mode 100644 src/Actions/Lockscreen.cs create mode 100644 src/Actions/Profile.cs create mode 100644 src/Actions/UserPass.cs create mode 100644 src/Actions/UsernameRequirement.cs create mode 100644 src/Actions/Users.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/ConsoleTUI.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/Frame.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/FrameWriteMethods.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/Menu.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/MouseInterface.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleTUI/Prompt.cs create mode 100644 src/Ameliorated.ConsoleUtils/ConsoleUtils.cs create mode 100644 src/Ameliorated.ConsoleUtils/Extensions.cs create mode 100644 src/Ameliorated.ConsoleUtils/ParentProcess.cs create mode 100644 src/Ameliorated.ConsoleUtils/Payload.cs create mode 100644 src/Extra/Extra.cs create mode 100644 src/Extra/NVCP.cs create mode 100644 src/Extra/WSH.cs create mode 100644 src/FodyWeavers.xml create mode 100644 src/Globals.cs create mode 100644 src/NSudo.cs create mode 100644 src/Program.cs create mode 100644 src/Properties/AssemblyInfo.cs create mode 100644 src/Registry.cs create mode 100644 src/amecs.cs create mode 100644 src/amecs.csproj create mode 100644 src/amecs.ico create mode 100644 src/amecs.png create mode 100644 src/amecs.sln create mode 100644 src/amecs_old.ico create mode 100644 src/app.manifest create mode 100644 src/packages.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3beab99 --- /dev/null +++ b/.gitignore @@ -0,0 +1,559 @@ +!*.gitkeep + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +.idea/ +*.sln.iml + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### vs ### + +# User-specific files + +# User-specific files (MonoDevelop/Xamarin Studio) + +# Mono auto generated files + +# Build results + +# Visual Studio 2015/2017 cache/options directory +# Uncomment if you have tasks that create the project's static files in wwwroot + +# Visual Studio 2017 auto generated files + +# MSTest test Results + +# NUnit + +# Build Results of an ATL Project + +# Benchmark Results + +# .NET Core + +# StyleCop + +# Files built by Visual Studio + +# Chutzpah Test files + +# Visual C++ cache files + +# Visual Studio profiler + +# Visual Studio Trace Files + +# TFS 2012 Local Workspace + +# Guidance Automation Toolkit + +# ReSharper is a .NET coding add-in + +# TeamCity is a build add-in + +# DotCover is a Code Coverage Tool + +# AxoCover is a Code Coverage Tool + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*[.json, .xml, .info] + +# Visual Studio code coverage results + +# NCrunch + +# MightyMoose + +# Web workbench (sass) + +# Installshield output folder + +# DocProject is a documentation generator add-in + +# Click-Once directory + +# Publish Web Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted + +# NuGet Packages +# NuGet Symbol Packages +# The packages folder can be ignored because of Package Restore +# except build/, which is used as an MSBuild target. +# Uncomment if necessary however generally it will be regenerated when needed +# NuGet v3's project.json files produces more ignorable files + +# Microsoft Azure Build Output + +# Microsoft Azure Emulator + +# Windows Store app package directories and files + +# Visual Studio cache files +# files ending in .cache can be ignored +# but keep track of directories ending in .cache + +# Others + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) + +# RIA/Silverlight projects + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) + +# SQL Server files + +# Business Intelligence projects + +# Microsoft Fakes + +# GhostDoc plugin setting file + +# Node.js Tools for Visual Studio + +# Visual Studio 6 build log + +# Visual Studio 6 workspace options file + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) + +# Visual Studio LightSwitch build output + +# Paket dependency manager + +# FAKE - F# Make + +# CodeRush personal settings + +# Python Tools for Visual Studio (PTVS) + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio + +# Telerik's JustMock configuration file + +# BizTalk build output + +# OpenCover UI analysis results + +# Azure Stream Analytics local run output + +# MSBuild Binary and Structured Log + +# NVidia Nsight GPU debugger configuration file + +# MFractors (Xamarin productivity tool) working folder + +# Local History for Visual Studio + +# BeatPulse healthcheck temp database + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 + +# Ionide (cross platform F# VS Code tools) working folder \ No newline at end of file diff --git a/README.md b/README.md index c40138e..251b1ef 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,7 @@ Script for automating a large assortment of AME related actions. ## Usage -You can download the script by going to the [latest release](https://git.ameliorated.info/Styris/amecs/releases/latest) and selecting `amecs.zip` from the **Downloads** section. Once downloaded, simply extract `amecs.zip` and run `amecs.cmd`. - -Alternatively, you could clone the repository: - - git clone https://git.ameliorated.info/Styris/amecs.git - -Once cloned, simply run `amecs.cmd`. +You can download the script by going to the [latest release](https://git.ameliorated.info/Styris/amecs/releases/latest) and selecting `amecs.exe` from the **Downloads** section. Once downloaded, simply run `amecs.cmd`. ## Summary @@ -22,17 +16,17 @@ If you prefer manually executing commands for some of these tasks without a scri ## Primary Functions -There are a variety of tasks you can easily perform with amecs. Below, we provide an explanation for each of them, as well as the commands underlying the features. +There are many actions in AME that require commands or are otherwise unavailable. The following functions work as replacements for those actions. #### Username/Password This function allows for changing the user's username or password. -At its core, the following command is used for changing the username: +The following command can also be used for changing a username: wmic useraccount where "name=''" rename '' -Similarly, the following command is used for changing the password: +Similarly, the following command can be for changing the password: net user "" "" @@ -42,21 +36,17 @@ This function allows for changing the lockscreen image. It works by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user. -This is a modified version of [LoganDark's lockscreen-img script](https://git.ameliorated.info/LoganDark/lockscreen-img). - #### Profile Image This function allows for changing the user's profile image (PFP). It does this by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user. Several necessary registry changes are made as well. -This is a modified version of [LoganDark's profile-img script](https://git.ameliorated.info/LoganDark/profile-img). - #### User Elevation This function allows for elevating or de-elevating the user to or from administrator. Elevating the user disables the password requirement when trying to run an executable as administrator. However, this has large security implications, thus why it is not the default setting. -At its core, it uses the following command: +The following command can also be used for this purpose: net localgroup administrators "" /add @@ -64,26 +54,6 @@ Or the following for de-elevating the user: net localgroup administrators "" /delete -#### Display Language - -This function allows for changing the user's display language. - -Firstly, it prompts the user to download a portion of a \~5.5GB language pack ISO file. Unfortunately, Microsoft no longer publicly distributes individual language pack files, so this is necessary. - -Once the ISO is downloaded, it extracts the ISO file, and installs the language pack for the selected display language using the following commands: - - 7z e -y -o"