Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sasprosko590 authored Nov 12, 2023
1 parent 11a889e commit f68227d
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 378 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# AUTHORS

Sasprosko/Umut
Wosy
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGELOG

Version V1.0.1 = Statistics updated. `start.bat` updated. Added `SASPClean.ps1` and added icon for it. Added `SASPClean.ps1` and added icon for it. AUTHORS.md updated.

Version V1.0.0 = Added colored text (I don't know how to add it for cmd). Edited file deletion. Hacker control was added to index.test.js because it was forgotten to be added.

Version V0.0.9 = Edited "winget upgrade --all" because it was misspelled and changed to "winget upgrade --all"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This script was created to restore the computer to the fast, pure and tidy perfo

### Notes

- The translations may not be correct because I translated them with a translation program. I apologize in advance.
- I don't have any bad intentions, there is no bad software in the code, and there is no such thing as taking the user's name in the code.
- Update your drivers.
- Close unnecessary startup programs in the task manager.
Expand Down
198 changes: 198 additions & 0 deletions SASPClean.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$scriptPath = $MyInvocation.MyCommand.Path
$scriptDirectory = Split-Path $scriptPath -Parent

$packageJsonPath = Join-Path $scriptDirectory "package.json"
$packageJsonExists = Test-Path $packageJsonPath

$iconFileName = "icon\SASPClean.png"
$iconPath = Join-Path $scriptDirectory $iconFileName

$loadingForm = New-Object System.Windows.Forms.Form
$loadingForm.Text = "SASPClean Loading Screen"
$loadingForm.Size = New-Object System.Drawing.Size(400, 150)
$loadingForm.StartPosition = "CenterScreen"
$loadingForm.BackColor = [System.Drawing.Color]::FromArgb(255, 245, 245, 245)

$loadingLabelPackageJson = New-Object System.Windows.Forms.Label
$loadingLabelPackageJson.Text = "Checking for updates..."
$loadingLabelPackageJson.Font = New-Object System.Drawing.Font("Arial", 12, [System.Drawing.FontStyle]::Bold)
$loadingLabelPackageJson.AutoSize = $true
$loadingLabelPackageJson.Location = New-Object System.Drawing.Point(20, 45)
$loadingForm.Controls.Add($loadingLabelPackageJson)

$loadingForm.add_Shown({
$iconFolder = Join-Path $scriptDirectory "icon"
if (-not (Test-Path $iconFolder -PathType Container)) {
[System.Windows.Forms.MessageBox]::Show("Error: 'icon' folder not found.", "Folder Not Found", "OK", "Error")
}

$iconPath = Join-Path $scriptDirectory "icon\SASPClean.png"
if (-not (Test-Path $iconPath -PathType Leaf)) {
[System.Windows.Forms.MessageBox]::Show("Error: 'icon\SASPClean.png' not found.", "File Not Found", "OK", "Error")
}

$packageJsonPath = Join-Path $scriptDirectory "package.json"
$packageJsonExists = Test-Path $packageJsonPath
if (-not $packageJsonExists) {
[System.Windows.Forms.MessageBox]::Show("Error: 'package.json' not found.", "File Not Found", "OK", "Error")
}

$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/sasprosko590/SASPClean/releases/latest"
if ($packageJsonExists) {
$packageJson = Get-Content -Path $packageJsonPath | ConvertFrom-Json
$currentVersion = $packageJson.version

if ($latestRelease.tag_name -ne $currentVersion) {
$updateMessage = "A new version is available! Do you want to view the release?"
$userChoice = [System.Windows.Forms.MessageBox]::Show($updateMessage, "Update Available", "YesNo", "Information")

if ($userChoice -eq "Yes") {
Start-Process $latestRelease.html_url
}
}
}
$loadingForm.Close()
})

$form = New-Object System.Windows.Forms.Form
$form.Text = "SASPClean"
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDirectory = Split-Path $scriptPath -Parent
$image = [System.Drawing.Image]::FromFile($iconPath)
$icon = [System.Drawing.Icon]::FromHandle((New-Object System.Drawing.Bitmap($image)).GetHicon())
$form.Icon = $icon
$form.Size = New-Object System.Drawing.Size(1225, 600)
$form.StartPosition = "CenterScreen"
$form.AutoScroll = $true

$backgroundColor = [System.Drawing.Color]::FromArgb(255, 245, 245, 245)
$buttonColor = [System.Drawing.Color]::FromArgb(255, 0, 102, 204)
$buttonForeColor = [System.Drawing.Color]::White
$form.BackColor = $backgroundColor

$checkboxes = @{}
$checkboxOptions = @(
"Clear Windows Update - This command is designed to remove unnecessary files and optimize the Windows component store, helping to free up storage space on your system.",
"Check Disk - Basic (chkdsk /f) - This command examines the disk for errors and automatically addresses and repairs any issues it discovers.",
"Check Disk - Repair (chkdsk /r) - This command thoroughly checks the disk for errors, actively fixes identified issues, and recovers readable information to maintain disk health.",
"Check Disk External Drive Dismounted (chkdsk /x) - This command dismounts external drives and performs a disk check, identifying and addressing errors to ensure the health of the external storage.",
"DISM Add Packages - Adds Windows packages from a specified path to enhance system functionality.",
"DISM Check Health - Evaluates the health of the Windows image, ensuring the stability of system components.",
"DISM Get Packages - Lists all installed packages on the Windows image, providing an overview of system components.",
"DISM Repair - Repairs the Windows image using a specified source, fixing potential issues in the system.",
"DISM Repair 2 - Repairs the Windows image using an alternative specified source, ensuring system stability.",
"DISM Restore Health - Restores the health of the Windows image, addressing any detected inconsistencies.",
"Disk Cleaner - Opens the built-in Disk Cleanup utility, allowing removal of unnecessary files to free up disk space.",
"Disk Cleaner Sagerun - Executes the Disk Cleanup utility with predefined cleanup options, streamlining the removal of temporary files.",
"MDT (Windows Memory Diagnostic Tool) - Opens the Windows Memory Diagnostic Tool, allowing you to assess and diagnose potential issues related to your system's memory (RAM).",
"MRT (Windows Malicious Software Removal Tool) - Opens the Windows Malicious Software Removal Tool, scanning and removing specific types of malware to enhance system security.",
"File System Integrity Check - This command runs the System File Checker, ensuring the integrity of system files by scanning and repairing any detected problems.",
"Windows Experience Index Formal Assessment - Initiates a detailed evaluation of your system's performance through the Windows Experience Index. It provides valuable insights into the capabilities of both your hardware and software.",
"Upgrade winget - Utilizes the Windows Package Manager (Winget) to upgrade all installed applications, ensuring you have the latest versions with improved features and security updates.",
"Check Win Update - Looks for the latest Windows updates right away, ensuring your system is current with essential patches and improvements.",
"See if you have been hacked - Verifies possible security breaches on your system.",
"Initiate file cleanup - Deletes specific files, including those in the Prefetch, Temp, and %temp% directories, freeing up disk space and removing temporary files that are no longer needed."
)

$yPosition = 20
foreach ($option in $checkboxOptions) {
$checkbox = New-Object System.Windows.Forms.CheckBox
$checkbox.Text = $option
$checkbox.Location = New-Object System.Drawing.Point(20, $yPosition)
$checkbox.AutoSize = $true
$checkbox.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
$checkbox.ForeColor = [System.Drawing.Color]::FromArgb(255, 33, 33, 33)
$form.Controls.Add($checkbox)
$checkboxes[$option] = $checkbox
$yPosition += 25
}

$runButton = New-Object System.Windows.Forms.Button
$runButton.Text = "Run"
$runButton.Location = New-Object System.Drawing.Point(20, $yPosition)
$runButton.BackColor = $buttonColor
$runButton.ForeColor = $buttonForeColor
$runButton.Width = 100
$runButton.Add_Click({
foreach ($option in $checkboxOptions) {
if ($checkboxes[$option].Checked) {
Write-Host "Running $option"
switch -wildcard ($option) {
"Check Disk - Basic*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "chkdsk /f" -Wait
}
"Check Disk External Drive Dismounted*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "chkdsk /x" -Wait
}
"Check Disk - Repair*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "chkdsk /r" -Wait
}
"Check Win Update*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "wuauclt.exe /detectnow" -Wait
}
"Clear Windows Update*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /cleanup-image /startcomponentcleanup" -Wait
}
"Disk Cleaner*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "cleanmgr.exe" -Wait
}
"Disk Cleaner Sagerun*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "cleanmgr /sagerun:1" -Wait
}
"DISM Add Packages*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /add-package /packagepath:C:\path\to\update.cab" -Wait
}
"DISM Check Health*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /cleanup-image /checkhealth" -Wait
}
"DISM Get Packages*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/k", "dism /online /get-packages" -Wait
}
"DISM Repair*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /cleanup-image /restorehealth /source:C:\path\to\source /limitaccess" -Wait
}
"DISM Repair 2*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /cleanup-image /restorehealth /source:C:\path\to\repairsource\install.wim" -Wait
}
"DISM Restore Health*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "dism /online /cleanup-image /restorehealth" -Wait
}
"MDT (Windows Memory Diagnostic Tool)*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "mdsched.exe" -Wait
}
"MRT (Windows Malicious Software Removal Tool)*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/k", "mrt.exe" -Wait
}
"File System Integrity Check*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "sfc /scannow" -Wait
}
"See if you have been hacked*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/k", "quser" -Wait
}
"Upgrade winget*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/k", "winget upgrade --all" -Wait
}
"Windows Experience Index Formal Assessment*" {
Start-Process 'cmd.exe' -Verb RunAs -ArgumentList "/c", "winsat formal" -Wait
}
"Initiate file cleanup*" {
Start-Process 'cmd.exe' -ArgumentList "/c", "npm install" -Wait
Start-Process 'cmd.exe' -ArgumentList "/k node test\index.test.js & pause"
}
}
}
}
})
$form.Controls.Add($runButton)

$Form.add_closing{
if (-not $RanScript -and [Windows.Forms.MessageBox]::Show('Are you sure you want to exit?', 'Exit', 'YesNo', 'Question') -eq 'No') {
$_.Cancel = $true
}
}

$loadingForm.ShowDialog()
$form.ShowDialog()
2 changes: 1 addition & 1 deletion SECURITY.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Our project currently supports the following version:

| Version | Supported |
| ------- | ------------------- |
| 1.0.0 | :white_check_mark: |
| 1.0.1 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "saspclean",
"version": "1.0.0",
"version": "1.0.1",
"description": "This script was created to restore the computer to the fast, pure and regular performance as it was when it was first purchased.",
"main": "index.js",
"scripts": {
Expand Down
Loading

0 comments on commit f68227d

Please sign in to comment.