commit e1b77cc642b79d4a1880aacb73d1e59070438d88
parent a1b0366996800cbc220824d20255d50f1221bcb8
Author: Administrator@GAMER.EPIC <Administrator@GAMER.EPIC>
Date: Fri, 5 Jun 2020 14:05:32 -0700
Changed how CYBER POLICE handle colour
Diffstat:
2 files changed, 131 insertions(+), 177 deletions(-)
diff --git a/CyberPolice.bat b/CyberPolice.bat
@@ -44,14 +44,33 @@ echo.
echo Checking if the CYBER POLICE have Administrative rights...
NET SESSION >nul 2>&1
if %errorlevel%==0 (
- call :colorEcho 0a "CYBER POLICE are enforcing as admin!"
+ cecho {0a}CYBER POLICE are enforcing as admin!{#}
echo.
) else (
echo.
- echo No admin
+ cecho {0c}No admin!{#}
+ echo.
echo Please INITIATE the CYBER POLICE taskforce as admin
+ echo There may be errors...
+ cecho {0e}Here are some solutions that may work:{#}
+ echo.
+ cecho 1. Making a shortcut to the CyberPolice batch file.
+ echo.
+ cecho - Then going to the shortcut's propetries and appending:
+ echo.
+ cecho - runas /user:{0b}YourAdminUsername{#} /savecred
+ echo.
+ cecho - infront of the loaction of the CyberPolice file
+ echo.
+ cecho - Note: This error may still come up but the commands will work.
+ echo.
+ cecho Sometimes though it still says you lack permission to do things.
+ echo.
+ cecho 2. Check your Local Security Policies and Group Policies to see if they are affecting the program [theres a lot]
+ echo.
+ echo Press any key to continue...
pause>nul
- exit
+ echo.
)
echo Checking for powershell...
@@ -59,9 +78,9 @@ FOR /F "tokens=3" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\PowerShell\1" /v I
IF NOT "%PowerShellInstalled%"=="0x1" (
echo Powershell installed: false > %output%\PowershellStatus.txt
- call :colorEcho 0c "POWERSHELL NOT INSTALLED!"
+ cecho {0c}POWERSHELL NOT INSTALLED!{#}
echo.
- call :colorEcho 0c "The CYBER POLICE can't enforce without it!"
+ cecho {0c}The CYBER POLICE can't enforce without it!{#}
echo.
pause>nul
exit
@@ -70,42 +89,40 @@ IF NOT "%PowerShellInstalled%"=="0x1" (
FOR /F "tokens=3" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine" /v PowerShellVersion ^| FIND "PowerShellVersion"') DO SET PowerShellVersion=%%A
echo Powershell installed: true Version: %PowerShellVersion% > %output%\PowershellStatus.txt
-call :colorEcho 0a "Powershell is installed!!"
+cecho {0a}Powershell is installed!!{#}
+echo.
echo.
for /f "delims=: tokens=2" %%a in ('systeminfo ^| find "OS Name"') do set os=%%a
for /f "tokens=* delims= " %%a in ("%os%") do set os=%%a
-call:colorEcho 0b "The CYBER POLICE have detected"
-call:colorEcho 0d " %os%"
-call:colorEcho 0b " as host's OS"
+cecho {0b}The CYBER POLICE have detected {0d}%os% {0b}as host's OS{#}
echo.
echo %os%>%output%\"OSVERSION.txt"
for /f %%a in ('set ^| find "PROCESSOR_ARCHITECTURE"') do set proArc=%%a
set proArc=%proArc:~23%
-call:colorEcho 0b "The CYBER POLICE have detected"
-call:colorEcho 0d " %proArc%"
-call:colorEcho 0b " as host's CPU architecture"
+cecho {0b}The CYBER POLICE have detected {0d}%proArc% {0b}as host's CPU architecture{#}
echo.
echo %proArc%>%output%\"CPUARCHITECTURE.txt"
-call:colorEcho 0b "Running as user"
-call:colorEcho 0a " %you%"
+cecho {0b}Running as user {0a}%you%{#}
+echo.
echo.
set dism=%toolsPath%\DISM%proArc%\DISM\dism.exe
%powershellPath% -ExecutionPolicy Bypass -File "%powershellScriptPath%/CreateRestorePoint.ps1"
+echo.
%powershellPath% -ExecutionPolicy Bypass -File "%powershellScriptPath%/UserList.ps1"
echo.
-call :colorEcho 0a "The CYBER POLICE have finished initializing!"
+cecho {0a}The CYBER POLICE have finished initializing!{#}
echo.
echo Press any key to begin CYBER POLICE OPS...
pause>nul
echo.
-call:colorEcho 0e "Do you want [A]uto or [M]anual (Default is [M]anual)"
+cecho {0e}Do you want [A]uto or [M]anual (Default is [M]anual){#}
echo.
set /p aus="[A/M]: "
if /i "%aus%" neq "A" goto:manual
@@ -113,7 +130,7 @@ goto:auto
:auto
for %%A in (%functions%) do call:autoCheck %%A
-call :colorEcho 0a "The CYBER POLICE have finished running auto"
+cecho {0a}The CYBER POLICE have finished running auto{#}
echo.
echo Press any key to switch to manual...
pause>nul
@@ -131,14 +148,7 @@ goto:EOF
:manual
echo.
-call :colorEcho 07 "Type"
-call:colorEcho 0b " exit"
-call :colorEcho 07 " to"
-call:colorEcho 0c " exit"
-call :colorEcho 07 " and"
-call:colorEcho 0b " help"
-call :colorEcho 07 " for"
-call :colorEcho 0a " help"
+cecho {07}Type {0b}exit {07}to {0c}exit {07}and {0b}help {07}for {0a}help{#}
echo.
set /p act="What should the CYBER POLICE do: "
@@ -146,7 +156,7 @@ if "%act%"=="exit" exit
if "%act%"=="help" (
echo CYBER POLICE available actions:
for %%F in (%functions%) do (
- call:colorEcho 0b "%%F"
+ cecho {0b}%%F{#}
echo.
)
pause>nul
@@ -154,20 +164,16 @@ if "%act%"=="help" (
)
for %%F in (%functions%) do (
if %%F==%act% (
- call:colorEcho 0a "CYBER POLICE are executing"
- call:colorEcho 0b " %act%"
+ cecho {0a}CYBER POLICE are executing {0b}%act%{#}
echo.
echo.
call:%act%
- call:colorEcho 0a "CYBER POLICE have finished executing"
- call:colorEcho 0b " %act%"
+ cecho {0a}CYBER POLICE have finished executing {0b}%act%{#}
echo.
goto:endOfManual
)
)
-call:colorEcho 0c "CYBER POLICE could not find"
-call:colorEcho 0b " %act%"
-call:colorEcho 0c " operation!"
+cecho {0c}CYBER POLICE could not find {0b}%act% {0c}operation!{#}
echo.
:endOfManual
pause>nul
@@ -193,22 +199,22 @@ goto:EOF
:servicesLoop
%~1 %path%\CyberPoliceOutput\Services\%~2
if %errorlevel%==1 (
- call :colorEcho 0e "%~2 failed to write!"
+ cecho {0e}%~2 failed to write!{#}
echo.
- call :colorEcho 0e "Creating file and trying again..."
+ cecho {0e}Creating file and trying again...{#}
echo.
call :createFile "%path%\CyberPoliceOutput\Services\%~2" %~2
if %errorlevel%==1 (
- call :colorEcho 0c "%~2 could not be written to!"
+ cecho {0c}%~2 could not be written to!{#}
echo.
)
else (
- call :colorEcho 0a "%~2 was successfully written to!"
+ cecho {0a}%~2 was successfully written to!{#}
echo.
goto:EOF
)
) else (
- call :colorEcho 0a "%~2 was successfully written to!"
+ cecho {0a}%~2 was successfully written to!{#}
echo.
)
goto:EOF
@@ -223,15 +229,13 @@ goto:EOF
:passwordpol
echo The CYBER POLICE are setting a password policy...
net accounts /lockoutthreshold:5 /MINPWLEN:8 /MAXPWAGE:30 /MINPWAGE:15 /UNIQUEPW:15
-call:colorEcho 0a "Password policy set!"
+cecho {0a}Password policy set!
echo.
-call:colorEcho 0e "(NOTICE) The CYBER POLICE cannot set the following functions through script..."
+cecho {0e}(NOTICE) The CYBER POLICE cannot set the following functions through script...
echo.
-call:colorEcho 07 "Password policy must meet complexity to"
-call:colorEcho 0b " enable"
+cecho {07}Password policy must meet complexity to {0b}enabled
echo.
-call:colorEcho 07 "Store passwords using reversible encryption to"
-call:colorEcho 0b " disabled"
+cecho {07}Store passwords using reversible encryption to {0b}disabled{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
@@ -242,7 +246,7 @@ echo.
net accounts /lockoutduration:30
net accounts /lockoutthreshold:5
net accounts /lockoutwindow:30
-call:colorEcho 0a "The CYBER POLICE have successfully set a lockout policy"
+cecho {0a}The CYBER POLICE have successfully set a lockout policy{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
@@ -251,57 +255,53 @@ goto:EOF
echo The CYBER POLICE are setting auditing success and failure for all categories...
auditpol /set /category:* /success:enable
auditpol /set /category:* /failure:enable
-call:colorEcho 0a "The CYBER POLICE have successfully set an audit policy"
+cecho {0a}The CYBER POLICE have successfully set an audit policy{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
:lsp
echo CYBER POLICE are starting Local Security Policy setup...
-call:colorEcho 0e "(NOTICE) this will make changes to Local Secuity Policy. Things you have set may be changed."
+cecho {0e}(NOTICE) this will make changes to Local Secuity Policy. Things you have set may be changed.{#}
echo.
call:backuplsp
goto:managelsp
:managelsp
echo.
-call:colorEcho 0b "You are running"
-call:colorEcho 0d " %os%"
+cecho {0b}You are running {0d}%os%{#}
echo.
echo CYBER POLICE found these OS' that have available LSP files:
set i=0
for /f %%G in ('dir %configPath%\lgpoTemplates /a:d /b') do (
set /a i+=1
set osChoices[!i!]=%%~G
- call:colorEcho 0b "%%G"
+ cecho {0b}%%G{#}
echo.
)
echo.
set osChoicesFiles=%i%
echo Select an os...
-call:colorEcho 0e "(NOTE) input is case sensitive."
-call:colorEcho 0c " (exit to exit)"
+cecho {0e}(NOTE) input is case sensitive. {0c}(exit to exit){#}
echo.
set /p selOs="OS: "
if "%selOs%"=="exit" (
- call:colorEcho 0c "Local Security Policy was not configured"
+ cecho {0c}Local Security Policy was not configured{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
)
for /L %%i in (1,1,%osChoicesFiles%) do (
if !osChoices[%%i]!==%selOs% (
- call:colorEcho 0a "Os set to configure Local Security Policy is"
- call:colorEcho 0b " !osChoices[%%i]!"
+ cecho {0a}Os set to configure Local Security Policy is {0b}!osChoices[%%i]!{#}
echo.
set lspEditOs=!osChoices[%%i]!
goto:pickLspType
goto:EOF
)
)
-call:colorEcho 0b "%selOs%"
-call:colorEcho 0c " is not a valid os"
+cecho {0b}%selOs% {0c}is not a valid os{#}
echo.
set /p aus="Continue? [Y/(N)]: "
if /i "%aus%" == "Y" goto:managelsp
@@ -309,47 +309,40 @@ echo.
goto:EOF
:pickLspType
-call:colorEcho 08 "CYBER POLICE found these LSP templates for"
-call:colorEcho 0b " %lspEditOs%"
+cecho {08}CYBER POLICE found these LSP templates for {0b}%lspEditOs%{#}
echo.
set i=0
for /f %%G in ('dir %configPath%\lgpoTemplates\%lspEditOs% /a:d /b') do (
set /a i+=1
set temChoices[!i!]=%%~G
- call:colorEcho 0b "%%G"
+ cecho {0b}%%G{#}
echo.
)
echo.
set temChoicesFiles=%i%
echo Select a LSP template...
-call:colorEcho 0e "(NOTE) input is case sensitive."
-call:colorEcho 0c " (exit to exit)"
+cecho {0e}(NOTE) input is case sensitive. {0c}(exit to exit){#}
echo.
set /p selTem="LSP Template: "
if "%selTem%"=="exit" (
- call:colorEcho 0c "Local Security Policy was not configured"
+ cecho {0c}Local Security Policy was not configured{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
)
for /L %%i in (1,1,%temChoicesFiles%) do (
if !temChoices[%%i]!==%selTem% (
- call:colorEcho 0a "Set to configure Local Security Policy"
- call:colorEcho 0b " !temChoices[%%i]!"
+ cecho {0a}Set to configure Local Security Policy {0b}!temChoices[%%i]!{#}
echo.
%lgpo% /g %configPath%\lgpoTemplates\%lspEditOs%\!temChoices[%%i]! /v
- call:colorEcho 0a "The CYBER POLICE have now set"
- call:colorEcho 0b " %lspEditOs%"
- call:colorEcho 0a " Local Security Policy to"
- call:colorEcho 0b " !temChoices[%%i]!"
+ cecho {0a}The CYBER POLICE have now set {0b}%lspEditOs% {0a}Local Security Policy to {0b}!temChoices[%%i]!{#}
echo.
call:manualVerify "secpol.msc"
goto:EOF
)
)
-call:colorEcho 0b "%selTem%"
-call:colorEcho 0c " is not a valid template"
+cecho {0b}%selTem% {0c}is not a valid template{#}
echo.
set /p aus="Continue? [Y/(N)]: "
if /i "%aus%" == "Y" goto:pickLspType
@@ -357,15 +350,16 @@ echo.
goto:EOF
:backuplsp
-call:colorEcho 0b "A back up of secpol.msc will be created..."
+cecho {0b}A back up of secpol.msc will be created...{#}
echo.
set /p aus="Make backup? [Y/N]: "
if /i "%aus%" == "Y" (
- %lgpo% /b "%output%/lgpoBackup"
- call:colorEcho 0a "Backup of LSP created"
+ if not exist "%output%\lgpoBackup" mkdir "%output%\lgpoBackup"
+ %lgpo% /b "%output%\lgpoBackup"
+ cecho {0a}Backup of LSP created{#}
echo.
) else (
- call:colorEcho 0c "Backup of LSP not created"
+ cecho {0c}Backup of LSP not created{#}
echo.
)
goto:EOF
@@ -374,7 +368,7 @@ goto:EOF
echo The CYBER POLICE will now try to enable the firewall...
netsh advfirewall set allprofiles state on
netsh advfirewall set publicprofile firewallpolicy blockinboundalways,allowoutbound
-call:colorEcho 0a "The CYBER POLICE have enabled the firewall"
+cecho {0a}The CYBER POLICE have enabled the firewall{#}
echo.
echo The CYBER POLICE will now do some basic firewall hardening...
for /f "tokens=*" %%A in (%configPath%\FirewallRulesOFF.txt) do (
@@ -383,7 +377,7 @@ for /f "tokens=*" %%A in (%configPath%\FirewallRulesOFF.txt) do (
netsh advfirewall firewall set rule name="%%A" new enable=no
)
)
-call:colorEcho 0a "The CYBER POLICE finished basic firewall hardening"
+cecho {0a}The CYBER POLICE finished basic firewall hardening{#}
echo.
call:manualVerify wf.msc
goto:EOF
@@ -401,14 +395,11 @@ for /f "tokens=*" %%A in (%configPath%\RegistyHardenData.txt) do (
set regVal=%%J
)
echo "Editing registry path !regPath!"
- call:colorEcho 07 "Editing key"
- call:colorEcho 0b " !regKey!"
+ cecho {07}Editing key {0b}!regKey!{#}
echo.
- call:colorEcho 07 "Editing variable type"
- call:colorEcho 0d " !regType!"
+ cecho {07}Editing variable type {0d}!regType!{#}
echo.
- call:colorEcho 07 "Applying value"
- call:colorEcho 0a " !regVal!"
+ cecho {07}Applying value {0a}!regVal!{#}
echo.
reg add "!regPath!" /v !regKey! /t !regType! /d !regVal! /f
)
@@ -430,9 +421,7 @@ for /f "tokens=*" %%A in (%output%\users.txt) do (
%wmicPath% UserAccount where Name='%%A' set PasswordChangeable=True
%wmicPath% UserAccount where Name='%%A' set PasswordRequired=True
%net% user %%A /logonpasswordchg:yes
- call:colorEcho 0a "Properties for"
- call:colorEcho 0b " %%A"
- call:colorEcho 0a " were changed"
+ cecho {0a}Properties for {0b}%%A {0a}were changed{#}
echo.
)
)
@@ -444,29 +433,24 @@ set wfOutput=%output%\WindowsFeatures
echo CYBER POLICE are making list of the status of current Windows features...
%dism% /online /Get-Features>%wfOutput%\StatusWFBefore.txt
echo.>%wfOutput%\DisabledWinFeatures.txt
-call:colorEcho 0a "List has been made"
+cecho {0a}List has been made!{#}
echo.
echo CYBER POLICE will now look at windows features...
for /f "tokens=*" %%A in (%configPath%\BadWinFeatures.txt) do (
- call:colorEcho 07 "CYBER POLICE are looking at feature"
- call:colorEcho 0b " %%A"
+ cecho {07}CYBER POLICE are looking at feature {0b}%%A{#}
echo.
for /f "tokens=2 delims=:" %%B in ('%dism% /online /get-featureinfo /featurename:%%A ^| Find "State"') do set wfStatus=%%B
for /f "tokens=* delims= " %%C in ("!wfStatus!") do set wfStatus=%%C
- call:colorEcho 0b "%%A"
- call:colorEcho 07 "'s current status is"
- call:colorEcho 0b " !wfStatus!"
+ cecho {0b}%%A{07}'s current status is {0b}!wfStatus!{#}
echo.
if "!wfStatus!" == "Disabled" (
- call:colorEcho 0e "No need to disable"
- call:colorEcho 0b " %%A"
+ cecho {0e}No need to disable {0b}%%A{#}
echo.
) else (
echo %%A>>%wfOutput%\DisabledWinFeatures.txt
%dism% /online /disable-feature /featurename:%%A
- call:colorEcho 0a "Disabled feature"
- call:colorEcho 0b " %%A"
+ cecho {0a}Disabled feature {0b}%%A{#}
echo.
)
)
@@ -477,7 +461,7 @@ net stop WinRM
%powershellPath% Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
%powershellPath% Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2
%powershellPath% Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root
-call:colorEcho 0a "CYBER POLICE are done finding bad Windows features"
+cecho {0a}CYBER POLICE are done finding bad Windows features{#}
echo.
goto:EOF
@@ -489,14 +473,10 @@ break>"!uOutDir!\enabledUsers.txt"
for /f "tokens=*" %%A in (%output%\users.txt) do (
for /f "tokens=3 delims= " %%B in ('%net% user "%%A" ^| Find "active"') do set userStatus=%%B
if "!userStatus!"=="No" (
- call:colorEcho 0b "%%A"
- call:colorEcho 07 " account is"
- call:colorEcho 0b " Disabled"
+ cecho {0b}%%A {07}account is {0b}Disabled{#}
echo.
) else (
- call:colorEcho 0b "%%A"
- call:colorEcho 07 " account is"
- call:colorEcho 0b " Enabled"
+ cecho {0b}%%A {07}account is {0b}Enabled{#}
echo.
echo %%A>>!uOutDir!\enabledUsers.txt
)
@@ -531,8 +511,7 @@ for /f "tokens=* delims=" %%B in (%uOutDir%\authAdmins.txt) do (
for /f "tokens=1 delims= " %%C in ("!line!") do (
endlocal & set "userChk=%%C"
if "%~1"=="!userChk!" (
- call:colorEcho 0b "%~1"
- call:colorEcho 0a " found"
+ cecho {0b}%~1 {0a}found!{#}
echo.
goto:EOF
)
@@ -541,18 +520,15 @@ for /f "tokens=* delims=" %%B in (%uOutDir%\authAdmins.txt) do (
for /f "tokens=* delims=" %%D in (%uOutDir%\authUsers.txt) do (
set userChk=%%D
if "%~1"=="!userChk!" (
- call:colorEcho 0b "%~1"
- call:colorEcho 0a " found"
+ cecho {0b}%~1 {0a}found{#}
echo.
goto:EOF
)
)
-call:colorEcho 0b "%~1"
-call:colorEcho 0c " not found"
+cecho {0b}%~1 {0c}not found{#}
echo.
-call:colorEcho 0e "Disabling"
-call:colorEcho 0b " %~1"
+cecho {0e}Disabling {0b}%~1{#}
echo.
net user %~1 /active:no
goto:EOF
@@ -562,41 +538,33 @@ endlocal & set "user=%~1"
endlocal & set "pass=%~2"
for /f "tokens=*" %%B in (!uOutDir!\enabledUsers.txt) do (
if "!user!"=="%%B" (
- call:colorEcho 0b "!user!"
- call:colorEcho 0a " admin found"
+ cecho {0b}!user! {0a}admin found{#}
+ echo.
+ cecho {07}Giving {0b}!user! {07}password{#}
echo.
- call:colorEcho 07 "Giving"
- call:colorEcho 0b " !user!"
- call:colorEcho 07 " password"
%powershellPath% Write-Host -Foregroundcolor Gray -NoNewLine ": "
%powershellPath% Write-Host -Foregroundcolor Cyan "!pass!"
net user !user! !pass!
if %ERRORLEVEL% neq 0 (
call:userError !user!
)
- call:colorEcho 07 "Managing"
- call:colorEcho 0b " !user!"
- call:colorEcho 07 " admin"
+ cecho {07}Managing {0b}!user! {07}admin{#}
echo.
%net% localgroup "Administrators" "!user!" /add
goto:EOF
)
)
-call:colorEcho 0b "!user!"
-call:colorEcho 0c " admin not found"
+cecho {0b}!user! {0c}admin not found{#}
+echo.
+cecho {07}Creating {0b}!user! {07}and giving password{#}
echo.
-call:colorEcho 07 "Creating"
-call:colorEcho 0b " !user!"
-call:colorEcho 07 " and giving password"
%powershellPath% Write-Host -Foregroundcolor Gray -NoNewLine ": "
%powershellPath% Write-Host -Foregroundcolor Cyan "!pass!"
%net% user "!user!" "!pass!" /add
if %ERRORLEVEL% neq 0 (
call:userError !user!
)
-call:colorEcho 07 "Managing"
-call:colorEcho 0b " !user!"
-call:colorEcho 07 " admin"
+cecho {07}Managing {0b}!user! {07}admin{#}
echo.
%net% localgroup "Administrators" "!user!" /add
goto:EOF
@@ -606,61 +574,51 @@ endlocal & set "user=%~1"
endlocal & set "pass=%~2"
for /f "tokens=*" %%B in (!uOutDir!\enabledUsers.txt) do (
if "!user!"=="%%B" (
- call:colorEcho 0b "!user!"
- call:colorEcho 0a " found"
+ cecho {0b}!user! {0a}found{#}
+ echo.
+ cecho {07}Giving {0b}!user! {07} password{#}
echo.
- call:colorEcho 07 "Giving"
- call:colorEcho 0b " !user!"
- call:colorEcho 07 " password"
%powershellPath% Write-Host -Foregroundcolor Gray -NoNewLine ": "
%powershellPath% Write-Host -Foregroundcolor Cyan "!pass!"
net user !user! !pass!
- call:colorEcho 07 "Managing"
- call:colorEcho 0b " !user!"
- call:colorEcho 07 " user"
+ cecho {07}Managing {0b}!user! {07}user{#}
echo.
%net% localgroup "Users" "!user!" /add
%net% localgroup "Administrators" "!user!" /delete
goto:EOF
)
)
-call:colorEcho 0b "!user!"
-call:colorEcho 0c " not found"
+cecho {0b}!user! {0c}not found{#}
+echo.
+cecho {07}Creating {0b}!user! {07}with password{#}
echo.
-call:colorEcho 07 "Creating"
-call:colorEcho 0b " !user!"
-call:colorEcho 07 " with password"
%powershellPath% Write-Host -Foregroundcolor Gray -NoNewLine ": "
%powershellPath% Write-Host -Foregroundcolor Cyan "!pass!"
echo.
%net% user "!user!" "!pass!" /add
-call:colorEcho 07 "Managing"
-call:colorEcho 0b " !user!"
-call:colorEcho 07 " user"
+cecho {07}Managing {0b}!user! {07}user{#}
echo.
%net% localgroup "Users" "!user!" /add
%net% localgroup "Administrators" "!user!" /delete
goto:EOF
:userError
-call:colorEcho 0c "Looks like there was an error configuring"
-call:colorEcho 0b " %~1"
+cecho {0c}Looks like there was an error configuring {0b}%~1{#}
echo.
-call:colorEcho 0e "it could be a password problem..."
+cecho {0e}It could be a password problem...{#}
echo.
-call:colorEcho 0e "Change thier password to a default password, user might not be created if No (Default is Yes)"
+cecho {0e}Change thier password to a default password, user might not be created if No (Default is Yes){#}
echo.
set /p aus="[Y/N]: "
if /i "%aus%" neq "N" (
- call:colorEcho 07 "Current default password"
+ cecho {07}Current default password{#}
%powershellPath% Write-Host -Foregroundcolor Gray -NoNewLine ": "
%powershellPath% Write-Host -Foregroundcolor Cyan "!password!"
echo.
%net% user "%~1" "!password!" /add
) else (
- call:colorEcho 0b "%~1"
- call:colorEcho 0c " was not created"
+ cecho {0b}%~1 {0c}was not created{#}
echo.
)
%net% user %~1 /active:yes
@@ -670,13 +628,13 @@ goto:EOF
echo The CYBER POLICE will display connected remote sessions
net session
net session > %output%/CurrentRemoteSessions.txt
-call:colorEcho 0a "Sessions are done showing"
+cecho {0a}Sessions are done showing{#}
echo.
goto:EOF
:rdp
echo The CYBER POLICE will manage Remote Desktop...
-call:colorEcho 0e "Enable remote desktop (Default will loop back)"
+cecho {0e}Enable remote desktop (Default will loop back){#}
echo.
set /p rdpChk="[Y/N]:"
if %rdpChk%==y (
@@ -686,12 +644,13 @@ if %rdpChk%==y (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="remote desktop" new enable=yes
- call:colorEcho 07 "The CYBER POLICE suggest you check"
- call:colorEcho 0b "Allow connections only from computers running Remote Desktop with Network Level Authentication"
+ cecho {07}The CYBER POLICE suggest you check{#}
+ echo.
+ cecho {0b}Allow connections only from computers running Remote Desktop with Network Level Authentication{#}
echo.
call:manualVerify SystemPropertiesRemote.exe
pause>nul
- call:colorEcho 0a "The CYBER POLICE enabled RDP"
+ cecho {0a}The CYBER POLICE enabled RDP{#}
echo.
goto:EOF
)
@@ -702,12 +661,11 @@ if %rdpChk%==n (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fAllowToGetHelp /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="remote desktop" new enable=no
- call:colorEcho 0a "The CYBER POLICE disabled RDP"
+ cecho {0a}The CYBER POLICE disabled RDP{#}
echo.
goto:EOF
)
-call:colorEcho 0c "Invalid input"
-call:colorEcho 0b " %rdpChk%"
+cecho {0c}Invalid input {0b}%rdpChk%{#}
echo.
goto rdp
@@ -719,7 +677,7 @@ echo the CYBER POLICE are setting power settings...
powercfg -SETDCVALUEINDEX SCHEME_BALANCED SUB_NONE CONSOLELOCK 1
powercfg -SETDCVALUEINDEX SCHEME_MIN SUB_NONE CONSOLELOCK 1
powercfg -SETDCVALUEINDEX SCHEME_MAX SUB_NONE CONSOLELOCK 1
-call:colorEcho 0a "The CYBER POLICE set power settings"
+cecho {0a}The CYBER POLICE set power settings!{#}
echo.
goto:EOF
@@ -727,7 +685,8 @@ goto:EOF
echo The CYBER POLICE are logging shares...
net share
net share > %output%\shares.txt
-call:colorEcho 0a "Shares have been logged"
+cecho {0a}Shares have been logged{#}
+echo.
echo.
call:manualVerify fsmgmt.msc
goto:EOF
@@ -735,37 +694,39 @@ goto:EOF
:uac
echo The CYBER POLICE are enabling UAC...
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
-call:colorEcho 0a "The CYBER POLICE have enabled UAC"
+cecho {0a}The CYBER POLICE have enabled UAC{#}
echo.
goto:EOF
:verifysys
echo "CYBER POLICE are verifying system files..."
-call:colorEcho 0e "This will take a while, get a snack..."
+cecho {0e}This will take a while, get a snack...{#}
+echo.
sfc /verifyonly
-call:colorEcho 0a "CYBER POLICE are finally done"
+cecho {0a}CYBER POLICE are finally done{#}
+echo.
goto:EOF
:checkdns
echo The CYBER POLICE will display current dns...
ipconfig /displaydns
ipconfig /displaydns > %output%/CurrentDNS.txt
-call:colorEcho 0d "Output ends here"
+cecho {0d}Output ends here{#}
echo.
echo The CYBER POLICE will display hosts file
type C:\Windows\System32\Drivers\etc\hosts
type C:\Windows\System32\Drivers\etc\hosts > %output%/CurrentHOSTS.txt
-call:colorEcho 0d "Output ends here"
+cecho {0d}Output ends here{#}
echo.
echo The CYBER POLICE will now flush dns...
ipconfig /flushdns
-call:colorEcho 0a "The CYBER POLICE have flushed dns"
+cecho {0a}The CYBER POLICE have flushed dns{#}
echo.
echo The CYBER POLICE will now clear C:\Windows\System32\drivers\etc\hosts...
attrib -r -s C:\WINDOWS\system32\drivers\etc\hosts
echo > C:\Windows\System32\drivers\etc\hosts
attrib +r +s C:\WINDOWS\system32\drivers\etc\hosts
-call:colorEcho 0a "The CYBER POLICE have cleared the HOSTS file"
+cecho {0a}The CYBER POLICE have cleared the HOSTS file{#}
echo.
goto:EOF
@@ -774,22 +735,15 @@ goto:EOF
goto:EOF
:manualVerify
-call:colorEcho 0b "Do you want to manually look at %~1 (Default is No)"
+cecho {0b}Do you want to manually look at %~1 (Default is No){#}
echo.
set /p aus="[Y/N]: "
if /i "%aus%" neq "Y" goto:EOF
-call:colorEcho 0b "Running %~1..."
+echo Running %~1...
echo.
start %~1 /wait
echo.
-call:colorEcho 0e "Press any key to let the CYBER POLICE continue..."
+cecho {0e}Press any key to let the CYBER POLICE continue...{#}
echo.
pause >nul
-goto:EOF
-
-:colorEcho
-echo off
-<nul set /p ".=%DEL%" > "%~2"
-findstr /v /a:%1 /R "^$" "%~2" nul
-del "%~2" > nul 2>&1i
goto:EOF
\ No newline at end of file
diff --git a/cecho.exe b/cecho.exe
Binary files differ.