Compare commits
13 Commits
9fec5e39b4
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 29ee569bfe | |||
| 3425139b1f | |||
| ee6a75de9a | |||
| b58c78a3fe | |||
| 79ad72ff11 | |||
| e6cbe71c5b | |||
| 9e86c1a1cf | |||
| 60a2343bc8 | |||
| f67fbef18e | |||
| e909a9ba94 | |||
| b522288c96 | |||
| cde93f511a | |||
| 8aaef29ad4 |
@@ -2,3 +2,4 @@
|
||||
*/tag.txt
|
||||
*.tmp
|
||||
*.csv
|
||||
*.sha256
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
default_files_name="`printf '%s\n' \"${PWD##*/}\"`_checksums_`date +%Y-%m-%d-%H%M-%Z`.sha256" # add da timedate stamp to it
|
||||
|
||||
echo $default_files_name
|
||||
|
||||
exit 0
|
||||
find $PWD -type f -exec sha256sum {} | tee -a files.sha256
|
||||
File diff suppressed because one or more lines are too long
@@ -58,4 +58,4 @@ Start-Sleep -Seconds $WaitSeconds
|
||||
|
||||
# x Force reboot with no warning
|
||||
# Disabled -Force to let apps close gracefully
|
||||
Restart-Computer # -Force
|
||||
Stop-Computer # -Force
|
||||
@@ -0,0 +1,42 @@
|
||||
# Usage: alert <message="Alert"> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))
|
||||
|
||||
# HELP HANDLE
|
||||
if($args[0] -eq 'h' -or $args[0] -eq '-h' -or $args[0] -eq 'H' -or $args[0] -eq '-H' -or $args[0] -eq 'help' -or $args[0] -eq 'Help' -or $args[0] -eq 'HELP') {
|
||||
Write-Host "Usage: alert <message=Alert> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))`nalert h/-h/help/etc: Display this help message"
|
||||
exit
|
||||
}
|
||||
|
||||
# MESSAGE HANDLE DEFAULT
|
||||
if([string]::IsNullOrEmpty($args[0])) {
|
||||
$Message = "Alert"
|
||||
} else {
|
||||
$Message = $args[0]
|
||||
}
|
||||
|
||||
# TYPE HANDLE DEFAULT
|
||||
if([string]::IsNullOrEmpty($args[1])) {
|
||||
$Type = "Information"
|
||||
} else {
|
||||
$Type = $args[1]
|
||||
}
|
||||
|
||||
# BUTTONS HANDLE DEFAULT
|
||||
if([string]::IsNullOrEmpty($args[2])) {
|
||||
$Buttons = "OK"
|
||||
} else {
|
||||
$Buttons = $args[2]
|
||||
}
|
||||
|
||||
# doin inide start-job method so alert box doesnt block
|
||||
Start-Job -ScriptBlock {
|
||||
# get back my fuckin vars inside this script block
|
||||
$Message = $using:Message
|
||||
$Buttons = $using:Buttons
|
||||
$Type = $using:Type
|
||||
|
||||
# Add the PresentationFramework
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Send the alert
|
||||
[System.Windows.MessageBox]::Show($Message, $Message, $Buttons, $Type)
|
||||
};
|
||||
@@ -0,0 +1,277 @@
|
||||
[CmdletBinding(DefaultParameterSetName='Generate')]
|
||||
param(
|
||||
# File(s) or wildcard pattern to compute checksum for
|
||||
[Parameter(Position = 0, ParameterSetName = 'Generate', ValueFromPipeline = $true)]
|
||||
[Parameter(Position = 0, ParameterSetName = 'Match', ValueFromPipeline = $true)]
|
||||
[string[]]$FilePath,
|
||||
|
||||
# Output file to save generated checksums (-o mode)
|
||||
[Parameter(Mandatory = $false, ParameterSetName = 'Generate')]
|
||||
[Alias('o')]
|
||||
[string]$OutFile,
|
||||
|
||||
# File containing checksums to verify (-c mode)
|
||||
[Parameter(Mandatory = $false, ParameterSetName = 'Verify')]
|
||||
[Alias('c')]
|
||||
[string]$Check,
|
||||
|
||||
# Direct checksum hash string to match against (-m mode)
|
||||
[Parameter(Mandatory = $true, ParameterSetName = 'Match')]
|
||||
[Alias('m')]
|
||||
[string]$Match,
|
||||
|
||||
# Hashing algorithm to use (Defaults to SHA256)
|
||||
[Parameter(Mandatory = $false)]
|
||||
[Alias('a')]
|
||||
[ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5')]
|
||||
[string]$Algorithm,
|
||||
|
||||
# Help flag (-h, -Help)
|
||||
[Parameter(Mandatory = $false)]
|
||||
[Alias('h')]
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
begin {
|
||||
function Show-Help {
|
||||
@'
|
||||
NAME
|
||||
checksum - Compute and verify message digests / file checksums
|
||||
|
||||
SYNOPSIS
|
||||
.\checksum.ps1 [-FilePath] <string[]> [-OutFile <string>] [-Algorithm <string>]
|
||||
.\checksum.ps1 [-FilePath] <string[]> -Match <string> [-Algorithm <string>]
|
||||
.\checksum.ps1 -Check <string> [-Algorithm <string>]
|
||||
.\checksum.ps1 -Help
|
||||
|
||||
DESCRIPTION
|
||||
Computes or verifies checksums using various cryptographic algorithms.
|
||||
Outputs hash values in standard Linux utility format (<hash> <filename>).
|
||||
|
||||
PARAMETERS
|
||||
-FilePath <string[]>
|
||||
Specifies the path to one or more files to hash. Accepts wildcards (*).
|
||||
|
||||
-o, -OutFile <string>
|
||||
Specifies an output file to save the checksum results to, while still
|
||||
displaying the output on screen.
|
||||
|
||||
-c, -Check <string>
|
||||
Read checksums from the specified file and verify them against files on disk.
|
||||
|
||||
-m, -Match <string>
|
||||
Compare the computed hash of the target file(s) against a specific hash string.
|
||||
|
||||
-a, -Algorithm <string>
|
||||
Specifies the cryptographic hash algorithm to use.
|
||||
Supported values: SHA1, SHA256 (default), SHA384, SHA512, MD5.
|
||||
If omitted in -c or -m mode, the algorithm is auto-detected by hash length.
|
||||
|
||||
-h, -Help
|
||||
Display this help message.
|
||||
|
||||
EXAMPLES
|
||||
1. Compute SHA256 checksum for a single file:
|
||||
.\checksum.ps1 myfile.iso
|
||||
|
||||
2. Compute checksums for all files and write to a file while showing output:
|
||||
.\checksum.ps1 * -o checksums.sha256
|
||||
|
||||
3. Verify a file against a explicit hash string:
|
||||
.\checksum.ps1 myfile.iso -m "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
4. Verify checksums from a verification file (auto-detects algorithm):
|
||||
.\checksum.ps1 -c checksums.sha256
|
||||
'@
|
||||
}
|
||||
|
||||
# Helper function to auto-detect hash algorithm based on string character length
|
||||
function Get-AlgorithmFromHashLength {
|
||||
param([string]$HashString)
|
||||
|
||||
switch ($HashString.Trim().Length) {
|
||||
32 { return 'MD5' }
|
||||
40 { return 'SHA1' }
|
||||
64 { return 'SHA256' }
|
||||
96 { return 'SHA384' }
|
||||
128 { return 'SHA512' }
|
||||
default {
|
||||
Write-Error "checksum: Could not auto-detect algorithm for hash length $($HashString.Length). Please specify -Algorithm."
|
||||
return $null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
# Match help arguments passed either as switch (-h, -Help) or positional string ('help', 'h', '--help', etc.)
|
||||
$isHelpRequested = $Help.IsPresent -or (
|
||||
$FilePath -and $FilePath.Count -eq 1 -and (
|
||||
$FilePath[0] -match '^(?i)[-/]{0,2}(h|help)$'
|
||||
)
|
||||
)
|
||||
|
||||
if ($isHelpRequested) {
|
||||
Show-Help
|
||||
return
|
||||
}
|
||||
|
||||
# Normalize explicit algorithm input if provided
|
||||
if (-not [string]::IsNullOrWhiteSpace($Algorithm)) {
|
||||
$Algorithm = $Algorithm.ToUpper()
|
||||
}
|
||||
|
||||
# --- DIRECT MATCH MODE (-m / -Match) ---
|
||||
if ($PSCmdlet.ParameterSetName -eq 'Match') {
|
||||
if (-not $FilePath -or $FilePath.Count -eq 0) {
|
||||
Write-Error "checksum: Missing file path parameter for matching. Use -Help for usage."
|
||||
return
|
||||
}
|
||||
|
||||
# Auto-detect algorithm from provided -Match hash string if not explicitly given
|
||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
||||
$Algorithm = Get-AlgorithmFromHashLength -HashString $Match
|
||||
if (-not $Algorithm) { return }
|
||||
Write-Verbose "Auto-detected algorithm: $Algorithm"
|
||||
}
|
||||
|
||||
$expectedHash = $Match.Trim().ToLower()
|
||||
|
||||
foreach ($pathEntry in $FilePath) {
|
||||
$resolvedItems = Get-Item -Path $pathEntry -ErrorAction SilentlyContinue
|
||||
|
||||
if (-not $resolvedItems) {
|
||||
Write-Error "checksum: $pathEntry`: No such file or directory"
|
||||
continue
|
||||
}
|
||||
|
||||
foreach ($item in $resolvedItems) {
|
||||
if ($item.PSIsContainer) {
|
||||
Write-Error "checksum: $($item.Name)`: Is a directory"
|
||||
} else {
|
||||
$actualHash = (Get-FileHash -Path $item.FullName -Algorithm $Algorithm).Hash.ToLower()
|
||||
$targetFile = Resolve-Path -Path $item.FullName -Relative
|
||||
if ($targetFile.StartsWith(".\")) { $targetFile = $targetFile.Substring(2) }
|
||||
|
||||
if ($actualHash -eq $expectedHash) {
|
||||
Write-Host "${targetFile}: " -NoNewline
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "${targetFile}: " -NoNewline
|
||||
Write-Host "FAILED" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# --- VERIFICATION MODE (-c / -Check) ---
|
||||
elseif ($PSCmdlet.ParameterSetName -eq 'Verify') {
|
||||
if (-not (Test-Path -Path $Check -PathType Leaf)) {
|
||||
Write-Error "checksum: $Check`: No such file or directory"
|
||||
return
|
||||
}
|
||||
|
||||
$lines = Get-Content -Path $Check
|
||||
|
||||
# Auto-detect algorithm based on hash length if not explicitly provided
|
||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
||||
foreach ($line in $lines) {
|
||||
if ([string]::IsNullOrWhiteSpace($line) -or $line.StartsWith("#")) { continue }
|
||||
if ($line -match '^([a-fA-F0-9]+)\s+') {
|
||||
$Algorithm = Get-AlgorithmFromHashLength -HashString $Matches[1]
|
||||
if (-not $Algorithm) { return }
|
||||
Write-Verbose "Auto-detected algorithm: $Algorithm"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback if file contained no parsable hashes
|
||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
||||
$Algorithm = 'SHA256'
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($line in $lines) {
|
||||
# Skip empty lines or comments
|
||||
if ([string]::IsNullOrWhiteSpace($line) -or $line.StartsWith("#")) { continue }
|
||||
|
||||
# Match standard checksum output format: "<hash> [* ]<filename>"
|
||||
if ($line -match '^([a-fA-F0-9]+)\s+[* ]?(.*)$') {
|
||||
$expectedHash = $Matches[1].ToLower()
|
||||
# Strip leading whitespace and any leftover leading asterisk
|
||||
$targetFile = $Matches[2].Trim().TrimStart('*')
|
||||
|
||||
if (Test-Path -Path $targetFile -PathType Leaf) {
|
||||
$actualHash = (Get-FileHash -Path $targetFile -Algorithm $Algorithm).Hash.ToLower()
|
||||
|
||||
if ($actualHash -eq $expectedHash) {
|
||||
Write-Host "${targetFile}: " -NoNewline
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "${targetFile}: " -NoNewline
|
||||
Write-Host "FAILED" -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
Write-Host "${targetFile}: " -NoNewline
|
||||
Write-Host "FAILED open or read" -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
Write-Warning "checksum: improperly formatted line: $line"
|
||||
}
|
||||
}
|
||||
}
|
||||
# --- GENERATION MODE ---
|
||||
else {
|
||||
# Default to SHA256 if no algorithm was specified in generation mode
|
||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
||||
$Algorithm = 'SHA256'
|
||||
}
|
||||
|
||||
if (-not $FilePath -or $FilePath.Count -eq 0) {
|
||||
Write-Error "checksum: Missing file path parameter. Use -Help for usage."
|
||||
return
|
||||
}
|
||||
|
||||
# Clear/initialize output file if specified before writing hashes
|
||||
if (-not [string]::IsNullOrWhiteSpace($OutFile)) {
|
||||
$null = New-Item -Path $OutFile -ItemType File -Force
|
||||
}
|
||||
|
||||
foreach ($pathEntry in $FilePath) {
|
||||
# Resolve wildcards and single file inputs
|
||||
$resolvedItems = Get-Item -Path $pathEntry -ErrorAction SilentlyContinue
|
||||
|
||||
if (-not $resolvedItems) {
|
||||
Write-Error "checksum: $pathEntry`: No such file or directory"
|
||||
continue
|
||||
}
|
||||
|
||||
foreach ($item in $resolvedItems) {
|
||||
# Handle directories like Linux sha256sum does
|
||||
if ($item.PSIsContainer) {
|
||||
Write-Error "checksum: $($item.Name)`: Is a directory"
|
||||
} else {
|
||||
$hash = (Get-FileHash -Path $item.FullName -Algorithm $Algorithm).Hash.ToLower()
|
||||
|
||||
# Format standard relative path (stripping leading '.\')
|
||||
$relativePath = Resolve-Path -Path $item.FullName -Relative
|
||||
if ($relativePath.StartsWith(".\")) {
|
||||
$relativePath = $relativePath.Substring(2)
|
||||
}
|
||||
|
||||
$outputLine = "$hash $relativePath"
|
||||
|
||||
# If -OutFile is provided, write line to file
|
||||
if (-not [string]::IsNullOrWhiteSpace($OutFile)) {
|
||||
Add-Content -Path $OutFile -Value $outputLine
|
||||
}
|
||||
|
||||
# Output to stdout
|
||||
Write-Output $outputLine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {}
|
||||
@@ -0,0 +1,99 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
# First string to compare
|
||||
[Parameter(Position = 0)]
|
||||
[string]$String1,
|
||||
|
||||
# Second string to compare
|
||||
[Parameter(Position = 1)]
|
||||
[string]$String2,
|
||||
|
||||
# Optional switch to enable case-sensitive comparison
|
||||
[switch]$CaseSensitive,
|
||||
|
||||
# Help flag (-h, -Help)
|
||||
[Alias('h')]
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
begin {
|
||||
function Show-Help {
|
||||
@'
|
||||
NAME
|
||||
match - Compare two strings and output visual match status
|
||||
|
||||
SYNOPSIS
|
||||
match <String1> <String2> [-CaseSensitive]
|
||||
match -Help
|
||||
|
||||
DESCRIPTION
|
||||
Compares two string arguments.
|
||||
Outputs "Match OK" in GREEN if they match.
|
||||
Outputs "FAIL: NO MATCH" in RED if they differ.
|
||||
|
||||
PARAMETERS
|
||||
String1
|
||||
The first string to compare.
|
||||
|
||||
String2
|
||||
The second string to compare.
|
||||
|
||||
-CaseSensitive
|
||||
Perform a case-sensitive comparison (default is case-insensitive).
|
||||
|
||||
-h, -Help, h, help (case insensitive)
|
||||
Display this help message.
|
||||
|
||||
EXAMPLES
|
||||
1. Compare two strings (case-insensitive default):
|
||||
match "hello" "Hello"
|
||||
Output: Match OK (in green)
|
||||
|
||||
2. Compare two strings with case sensitivity:
|
||||
match "hello" "Hello" -CaseSensitive
|
||||
Output: FAIL: NO MATCH (in red)
|
||||
|
||||
3. Compare hashes or checksum outputs:
|
||||
match "e3b0c442" "e3b0c442"
|
||||
Output: Match OK (in green)
|
||||
'@
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
# Check if help was explicitly requested via flag or positional parameter
|
||||
$isHelpRequested = $Help.IsPresent -or (
|
||||
$PSBoundParameters.Count -gt 0 -and (
|
||||
($String1 -and $String1 -match '^(?i)[-/]{0,2}(h|help)$') -or
|
||||
($String2 -and $String2 -match '^(?i)[-/]{0,2}(h|help)$')
|
||||
)
|
||||
)
|
||||
|
||||
if ($isHelpRequested) {
|
||||
Show-Help
|
||||
return
|
||||
}
|
||||
|
||||
# Trigger help usage if either string parameter is missing or whitespace
|
||||
if ([string]::IsNullOrWhiteSpace($String1) -or [string]::IsNullOrWhiteSpace($String2)) {
|
||||
Write-Host "Error: Missing required arguments." -ForegroundColor Yellow
|
||||
Write-Host "Usage: match <String1> <String2> [-CaseSensitive]" -ForegroundColor Cyan
|
||||
Write-Host "Run 'match -Help' for detailed documentation.`n"
|
||||
return
|
||||
}
|
||||
|
||||
# Compare strings based on case-sensitivity choice
|
||||
$isMatch = if ($CaseSensitive) {
|
||||
$String1 -ceq $String2
|
||||
} else {
|
||||
$String1 -eq $String2
|
||||
}
|
||||
|
||||
if ($isMatch) {
|
||||
Write-Host "`n`nSUCCESS: MATCH OK!`n`n" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "`n`nFAIL: NO MATCH!`n`n" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
end {}
|
||||
@@ -1,6 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$infile
|
||||
)
|
||||
|
||||
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile MD5"
|
||||
@@ -1,6 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$infile
|
||||
)
|
||||
|
||||
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA1"
|
||||
@@ -1,6 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$infile
|
||||
)
|
||||
|
||||
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA256"
|
||||
@@ -1,6 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$infile
|
||||
)
|
||||
|
||||
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA384"
|
||||
@@ -1,6 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$infile
|
||||
)
|
||||
|
||||
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA512"
|
||||
@@ -1,143 +0,0 @@
|
||||
# Usage:
|
||||
# Open PowerShell as Administrator
|
||||
# win+x
|
||||
# alt+a
|
||||
# alt+y
|
||||
# Run:
|
||||
# In admin powershell Terminal:
|
||||
# iwr -UseBasicParsing -Uri "https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1?nocache=$(Get-Random)" -OutFile "$env:TEMP\windows-repair-temp.ps1"; powershell -ExecutionPolicy Bypass -File "$env:TEMP\windows-repair-temp.ps1"
|
||||
# or maybe
|
||||
# iwr https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1 | iex
|
||||
|
||||
# check if hasadmin rights, if notm run script in new terminal, clopsing old
|
||||
## if not, carry on
|
||||
if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S-1-5-32-544')) {
|
||||
# launch tghis script int new window after promopting for admin
|
||||
Start-Process -FilePath 'powershell' -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File $PSCommandPath"
|
||||
|
||||
# CLOSE previous terminal
|
||||
exit 0
|
||||
} else {
|
||||
clear # clear window
|
||||
|
||||
Write-Host -ForegroundColor Magenta @'
|
||||
.. .....
|
||||
....------..
|
||||
..:--------.. .......
|
||||
..----------.. ....---..
|
||||
...---------=------::....:----:..
|
||||
..-----=+**************=-----:...
|
||||
.----+****************=-----...
|
||||
.--=****************=-----=**+:::--:....
|
||||
.-=#*********##**++=---====++**+-----:.
|
||||
..:==********#=.+@%-==++===++===++*=----...
|
||||
.:=::******%%+-::=++====+==++====+**=--...
|
||||
.:+..+*****--@===-:-%--====-=+====+*#=:..
|
||||
.-=.-****#=.#+===--=+===----======+*+..
|
||||
.:=:+****#@#+=====-**-----*+====++**:.
|
||||
.. .=****=--======-..%-----%+==++***+-..
|
||||
..=++***+-.----======..*-----#+==+***#%#+..
|
||||
.. .:-..---=====--------=-+==+**-@*. ............::::::....
|
||||
..=:..--===+-:-------*%+==*+#%**=. .....:-------------------------:.
|
||||
..............-:..--===+-..:-------+==+==.:... ...:----------------------------::.
|
||||
......:----------::=:...--==+--:.:-------+==+=:.... ....--------------------------:.....
|
||||
..:::----------------=-::.:--===---:.:------=--:.... ...:---------------------------...
|
||||
..:------------------=--:..:--=+=--------::.:+-..... ...------------------------------..
|
||||
...:-----------------:....----==-------:...=%*.......:::--------------------------------:..
|
||||
...--------------:+......---------------:+%%#.----------------------------:.......-----:..
|
||||
.:----===-------:-.. .:--------------*%%%%=--------------========------:.......-------:...
|
||||
..-:.:------------....-.=---------=#%%%%##%------------=-----------------------------------..
|
||||
.:--:....:--------:##*=:.-------=#%%%%%%#%+-----------=-------------------------------------:
|
||||
..:-----------------::*%%#-------=###%%%%##=--------------------------------------:............
|
||||
..:-------------------:.-#%%##+==+%%%%%%#%+------------------------...:::--------------::::::..
|
||||
...:----------------------..-#%#%%%%%%%%*+#%=-------------------------=-:....:----------------:...
|
||||
--------------------------:.-#%%%%%%%%+#@%%%--------------------------=++=-::---------------:...
|
||||
---------------------------...+%%%%%%%#%%%%#---------------------------------------------:....
|
||||
............------.....----:....-#%%%%%%%*=------------------------------::+=---------.......
|
||||
..:-... ....-----.. ....-=-------------------------------------.=*+=.......
|
||||
..---:....:-----:.......:--------------------------:-------------==+=-......
|
||||
.:-------------..........:---------------------------..:-------------==..........
|
||||
..-------------:... ...--------:...----------------....:-----------==-...........
|
||||
..:----==------:..-.... ..--------:...:---------------.....:----------=+-.....
|
||||
..------==+=++==-..+--:. .:--------.....-----------=*%=.. ..----------=+=......
|
||||
....------------........:... ..:--------.....-------+#%%#@%.. ...----------=+=......
|
||||
....---------===:............... .:----=+*#=. ..--+#**+%@@@#%+. ..:-:..=----=*=:.....
|
||||
:............:=::+=:--:=.=-.::=... ..*@*-+%@@@:.....-@@#%@*#@@@#%:.. ..-:..---:-#**+-.........
|
||||
.. ...::::....::-.:.::-.. ..*%:..*@@@*.. ..-%#%@@+%@@@@=.. ...::.=#=..-%*++=:... ...
|
||||
...... .......... ..**...*#=*%:. .-*#@%+#%@@@@+... ..*%@%+...+%+=*+=-...
|
||||
..*#:.-#+..+-. ..-*#**%%*%@@%=.. ..-%@@*:..+@%=:+**+=:..
|
||||
..*@#*%%=..==. .-*%@#%@##@@@#-. ...#@@%*-=%@@#:..-=++=-
|
||||
.:#@*-:++..==. .=#%@%*@@*%*=+*:....:.+@*::+%@@@%=......-*
|
||||
.-%+...=%##%-. .+@*@%*%@##*-:*+..:-==*@=..:#@+:=*:.......
|
||||
.:*#:..:*@@@%:. .-%@*%@#*%*#=..-%-....:+#=-.:#%-.:+-.......
|
||||
.+@#=.-*@@@@*.. ....-%@@@@@@=..+%*.. .-%--=+#%-.:*-. ....
|
||||
.-=++++++++=... .:***+++==::::... .-%#=-*#%#**#-.
|
||||
..............
|
||||
'@
|
||||
|
||||
Write-Host "`nFIXING WINDOWS FULL PRINCESS PI STYLE (THIS WILL TAKE MANY HOURS AND REBOOT MORE THAN ONCE, SLOWLY)`n" -ForegroundColor Magenta
|
||||
|
||||
Write-Host "ABORTING ANY SCHEDULED SHUTDOWN 1/17"
|
||||
shutdown.exe /a > $null 2> $null # cmd abort scheduled shutdowns
|
||||
|
||||
Write-Host "GENERATING AND DISPLAYING COMPREHENSIVE STABILITY REPORT 2/17"
|
||||
Start-Process "perfmon.exe" -ArgumentList "/report" -Wait
|
||||
|
||||
Write-Host "GENERATING AND DISPLAYING STABILITY HISTORY REPORT 3/17"
|
||||
Start-Process "perfmon.exe" -ArgumentList "/rel" -Wait
|
||||
|
||||
Write-Host "CLEARING DNS 4/17"
|
||||
ipconfig.exe /flushsdns > $null
|
||||
|
||||
Write-Host "CLEARING ARP CACHE 5/17"
|
||||
Remove-NetNeighbor -Confirm:$false > $null 2> $null
|
||||
|
||||
Write-Host "CLEARING ALL SAMBA CREDENTIALS 6/17"
|
||||
net.exe use * /delete /y > $null 2> $null # nuke all samba creds
|
||||
|
||||
Write-Host "RELEASING AND RENEWING DHCP 7/17"
|
||||
# release and renew dhcp
|
||||
ipconfig.exe /release > $null
|
||||
ipconfig.exe /renew > $null
|
||||
|
||||
Write-Host "GETTING CONTROL OF WINDOWS UPDATE"
|
||||
Install-Module -Name PSWindowsUpdate -Force > $null 2> $null
|
||||
|
||||
|
||||
Import-Module PSWindowsUpdate
|
||||
|
||||
Write-Host "UPDATING MALWARE SIGNATURES 8/17"
|
||||
Update-MpSignature # update windows defender malware siggs
|
||||
|
||||
Write-Host "RUNNING WINDOWS MALICIOUS SOFTWARE REMOVAL TOOL (MRT, MAY TAKE A LONG TIME, WONT SHOW STATUS) 9/17"
|
||||
Start-Process -FilePath "MRT.exe" -ArgumentList "/F:Y /Q" -Wait # do full microsoft malicious software removal scan in background automatically removing anything found, wait to proceed
|
||||
|
||||
Write-Host "UPDATING MALWARE SIGNATURES (AGAIN) 10/17"
|
||||
Update-MpSignature # update windows defender malware siggs
|
||||
|
||||
Write-Host "RUNNING FULL WINDOWS DEFENDER SCAN 11/17"
|
||||
Start-MpScan -ScanType FullScan # full windows defender scan
|
||||
|
||||
Write-Host "RUNNING DISM ONLINE IMAGE CLEANUP 12/17"
|
||||
DISM.exe /Online /Cleanup-Image /RestoreHealth # online check for bad files
|
||||
|
||||
Write-Host "RUNNING SYSTEM FILE CHECKER (SFC) 13/17"
|
||||
SFC.exe /scannow # older check for bad files
|
||||
|
||||
Write-Host "SCHEDULING ESSENTIAL FILE CHECK ON NEXT BOOT 14/17"
|
||||
SFC.exe /scanonce # check essential files on next boot
|
||||
|
||||
Write-Host "SCHEDULING OFFLINE CHECK DISK AND REPAIR OF C: (CHKDSK) 15/17"
|
||||
echo y | chkdsk.exe /f /r C: # cmd checks C drive after reboot to waste time and fix errors (noninteractive via y ffuckery)
|
||||
|
||||
Write-Host "SCHEDULINMG OFFLINE MEMTEST 16/17"
|
||||
mdsched.exe /s # schedule offline memtest (noninteractive)
|
||||
|
||||
Write-Host "SCHEDULING WINDOWS DEFENDER OFFLINE SCAN MAY REBOOT UNEXPECTEDLY 17/17"
|
||||
Start-MpWDOScan # powershell starts Windows Defender Offline Scan after reboot
|
||||
|
||||
Write-Host "`nREBOOTING IN 5 MINUTES MAX PROVBABLY SOONER`n"
|
||||
shutdown.exe /r /t (60*5) # shutdown in 5 minutes as failsafe
|
||||
|
||||
Write-Host "`nDONEsiez :3~`n"
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
# Usage:
|
||||
## .\winhash.ps1 <FILE> <ALGO>
|
||||
## Algos Supported:
|
||||
### MD5
|
||||
### SHA1
|
||||
### SHA256
|
||||
### SHA384
|
||||
### SHA512
|
||||
## Example:
|
||||
### .\winhash.ps1 sillyfilly.bin SHA256
|
||||
## Outputs to terminal and to a text file
|
||||
### Text file name format <input filepath>.<unix epoch microseconds>.<hashing algorithm>.txt
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory=$true)] # prompt for input if not specified via cli
|
||||
[string]$infile,
|
||||
|
||||
[Parameter(Mandatory=$true)] # this 1 2 :pope:
|
||||
[string]$algo
|
||||
)
|
||||
|
||||
function Get-UnixMicroseconds {
|
||||
$unixEpoch = [DateTimeOffset]'1970-01-01T00:00:00Z' # unix epoch constant
|
||||
$currentTime = [DateTimeOffset]::UtcNow # current utc time
|
||||
$timeDifferenceTicks = $currentTime.Ticks - $unixEpoch.Ticks # subtract current time from unix epoch constant in ticks
|
||||
$microseconds = [Int64]($timeDifferenceTicks / 10) # use 64bit int, divide ticks by 10 to give microseconds
|
||||
|
||||
# I am literally using Unix microseconds because they are more fun than Unix seconds :pinkie:
|
||||
return $microseconds
|
||||
}
|
||||
|
||||
# jesus fuckin analbeads the selection of hash algos in powershell is weird and limited
|
||||
# probably because Bill Gates and Satya Nadella get together with the other C-suite executives
|
||||
# and hypergoon to leagelese in clickwrap agreements that absolves them of liability and
|
||||
# lets them sell our private data and other assorted dickpics or sumtin idk man lmao
|
||||
$hash = $(Get-FileHash -Path $infile -Algorithm $algo | Format-List) # do da fookin hashin right dafucc here
|
||||
echo $hash # show user
|
||||
echo $hash > "$infile.$(Get-UnixMicroseconds).$algo.txt" # make the txt file
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# set -euo pipefail # we tolerate no failure :pensive: 😔
|
||||
|
||||
# nullglobyyyy so da FUCKIN wildcard STOPS BEING A FUCK
|
||||
shopt -s nullglob
|
||||
|
||||
# add da current dir name, and timedate stamp to it plus sum middleshit idk
|
||||
default_file_name="$(date +%Y-%m-%d-%H%M-%Z)_$(printf '%s\n' ${PWD##*/})_ChecksumsSHA256.sha256"
|
||||
|
||||
existing_sha256_files=(*.sha256)
|
||||
|
||||
# just for spooky :3
|
||||
## sumtin spookie :3
|
||||
|
||||
# if sha256 files exist, handle
|
||||
if [ ${#existing_sha256_files[@]} -gt 0 ]; then
|
||||
# existing sha256 files fond
|
||||
echo "Existing *.sha256 files found in $PWD, Checking the Latest $default_file_name"
|
||||
|
||||
for file in *.sha256; do
|
||||
# on fnding sha256 files in pwd, generate shas56 checks of each one, notify OK! on success, delete the offending sha256 file if fail
|
||||
[ -f "$file" ] && sha256sum -c $file && echo -e "$file Check: \033[0;32mOK!\033[0m\n" || (echo -e "\n$file NO MATCH! Deleting Bad File \033[31mFAIL\033[0m\n\n"; rm -f $file) # 2>/dev/null)
|
||||
done
|
||||
# validate the found checksums
|
||||
sha256sum -c *.sha256 | tee -a "$default_file_name" && echo -e "\nAll Checksums: \033[0;32mOK!\033[0m\n" || echo -e "\nOne or More Checksums Failed to Match: \033[33mWARN ($?)\033[0m\n"
|
||||
else
|
||||
# no sha256 files, run generate
|
||||
echo "NO Existing *.sha256 files found! Generating sha256 checksums recursively"
|
||||
|
||||
# recursive search in current working dir,
|
||||
find "$PWD" -type f -exec bash -c "sha256sum {} | tee -a \"$PWD/$default_file_name\"" \; && echo -e "\nAll Checksums Created: \033[0;32mOK!\033[0m\n\tLog File: $default_file_name\n" || echo -e "\nOne or More Cecksums Failed to Run: \033[31mWARN ($?)\033[0m\n"
|
||||
fi
|
||||
|
||||
@@ -12,7 +12,6 @@ tmpDir='/tmp/generalssss'
|
||||
tmp_customscripts_dir="$tmpDir/customscripts"
|
||||
finalDir='/usr/share/customscripts'
|
||||
packages="7zip apache2 argon2 avahi-daemon btop build-essential byobu cargo cifs-utils clamav cmake cowsay cracklib-runtime detox docker.io exiftool fdupes ffuf gcc-arm-none-eabi grc gzip iotop iptraf-ng jq kpartx libnss-mdns libnewlib-arm-none-eabi librust-git2+openssl-probe-dev libstdc++-arm-none-eabi-newlib locales lynx net-tools nginx openssl php polygen polygen-data procps python3 python3-scapy resolvconf restic ripgrep samba screen seclists snapd thefuck unzip wget xrdp xxd xz-utils zip kali-linux-default"
|
||||
# packages="grc kpartx openssl cracklib-runtime argon2 jq polygen polygen-data apache2 seclists cmake locales python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib librust-git2+openssl-probe-dev cargo nginx build-essential cowsay iotop iptraf-ng btop screen byobu thefuck wget lynx zip unzip 7zip xz-utils gzip net-tools clamav php restic cifs-utils detox fdupes ripgrep avahi-daemon libnss-mdns xxd xrdp libimage-exiftool-perl kali-tools-hardware kali-tools-crypto-stego kali-tools-fuzzing kali-tools-bluetooth kali-tools-rfid kali-tools-sdr kali-tools-voip kali-tools-802-11 kali-tools-forensics samba procps snapd"
|
||||
|
||||
echo -e "\nSTARTING!\n\tUsing Shell $SHELL\n"
|
||||
|
||||
@@ -73,49 +72,48 @@ if [ ! -z "$1" ]; then
|
||||
# echo -e "\nhaveibeenpwned-downloader installed, skipping install\n"
|
||||
# fi
|
||||
# homebrew
|
||||
# if [ ! $(which brew) ]; then
|
||||
# ## install homebrew
|
||||
# echo -e "\nlinuxbrew not found, installing\n"
|
||||
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
# ### add to rcfile
|
||||
# if ! grep -q 'linuxbrew' $rcfile; then
|
||||
# # echo "adding linuxbrew to $rcfile"
|
||||
# # echo "# linuxbrew (homebrew/brew)" >> $rcfile
|
||||
# # echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $rcfile
|
||||
# else
|
||||
# echo "linuxbrew already in $rcfile skipping"
|
||||
# fi
|
||||
#
|
||||
# # source $rcfile
|
||||
# else
|
||||
# echo -e "\nlinuxbrew installed, skipping install\n"
|
||||
# # source $rcfile
|
||||
# fi
|
||||
# ### install ponysay
|
||||
# if [ ! $(which ponysay) ]; then
|
||||
# echo -e "\nponysay not fonud, installiing\n"
|
||||
# brew install ponysay
|
||||
# if ! grep 'ponysay fix' $rcfile; then
|
||||
# # echo "adding ponysay fix to $rcfile"
|
||||
# # echo -e "# ponysay fix\nexport PYTHONWARNINGS=ignore::SyntaxWarning" >> $rcfile
|
||||
# # source $rcfile
|
||||
# else
|
||||
# # echo "ponysay fix already in $rcfile skipping"
|
||||
# # source $rcfile
|
||||
# fi
|
||||
# else
|
||||
# echo -e "\nponysay already installed, skipping\n"
|
||||
# fi
|
||||
if [ ! $(which brew) ]; then
|
||||
## install homebrew
|
||||
echo -e "\nlinuxbrew not found, installing\n"
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
### add to rcfile
|
||||
if ! grep -q 'linuxbrew' $rcfile; then
|
||||
echo "adding linuxbrew to $rcfile"
|
||||
echo "# linuxbrew (homebrew/brew)" >> $rcfile
|
||||
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $rcfile
|
||||
else
|
||||
echo "linuxbrew already in $rcfile skipping"
|
||||
fi
|
||||
|
||||
else
|
||||
echo -e "\nlinuxbrew installed, skipping install\n"
|
||||
fi
|
||||
### install ponysay
|
||||
if [ ! $(which ponysay) ]; then
|
||||
echo -e "\nponysay not fonud, installiing\n"
|
||||
brew install ponysay
|
||||
if ! grep 'ponysay fix' $rcfile; then
|
||||
echo "adding ponysay fix to $rcfile"
|
||||
echo -e "# ponysay fix\nexport PYTHONWARNINGS=ignore::SyntaxWarning" >> $rcfile
|
||||
source $rcfile
|
||||
else
|
||||
echo "ponysay fix already in $rcfile skipping"
|
||||
source $rcfile
|
||||
fi
|
||||
else
|
||||
echo -e "\nponysay already installed, skipping\n"
|
||||
fi
|
||||
# cargo
|
||||
|
||||
## oniux
|
||||
echo -e "\nINSTALLIN TOR ONIUX\n"
|
||||
if [ -f /usr/local/bin/oniux ]; then
|
||||
echo -e "\nexisting oniux found, skipping\n"
|
||||
else
|
||||
echo -e "\nexisting oniux not found, installing\n"
|
||||
cargo install --git https://gitlab.torproject.org/tpo/core/oniux --tag v0.6.1 oniux
|
||||
cd /tmp && cargo install --git https://gitlab.torproject.org/tpo/core/oniux && cd - && echo -e '## Oniux/Cargo Shit\nPATH=$PATH:$HOME/.cargo/bin' >> ~/.bashrc && source ~/.bashrc && oniux curl https://canhazip.com
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -160,7 +158,7 @@ git clone $gitRepo $tmpDir --single-branch --depth 1
|
||||
|
||||
# donut
|
||||
echo -e "\nCompiling donut\n"
|
||||
gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm # 2>/dev/null
|
||||
gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm 2>/dev/null
|
||||
|
||||
# put the customscripts dir into place
|
||||
echo -e "\nPlacing in $finalDir\n"
|
||||
@@ -181,10 +179,10 @@ pathgrep=$?
|
||||
if [ $pathgrep -eq 0 ]; then
|
||||
echo -e "\n$finalDir Already in \$PATH Skipping Append\n"
|
||||
fi
|
||||
# else
|
||||
else
|
||||
# echo -e "\nAdding $finalDir to $username's \$PATH by Appending to $rcfile\n"
|
||||
# echo -e "\n\n# automatically added by customscripts installer\nexport PATH=\"\$PATH:$finalDir\"" >> "$rcfile"
|
||||
# fi
|
||||
fi
|
||||
|
||||
# install pishrink if not there
|
||||
if [ ! -f /usr/local/bin/pishrink ]; then
|
||||
@@ -204,15 +202,11 @@ if [ ! -d $userhome/.local/share/blesh ]; then
|
||||
cd /tmp
|
||||
git clone --recursive --depth 1 --shallow-submodules --single-branch -b master https://github.com/akinomyoga/ble.sh.git
|
||||
make -C ble.sh install PREFIX=~/.local
|
||||
# echo '# ble.sh' >> $rcfile
|
||||
# echo "source -- ~/.local/share/blesh/ble.sh" >> $rcfile
|
||||
# source $rcfile
|
||||
# exec "$SHELL"
|
||||
echo '# ble.sh' >> $rcfile
|
||||
echo "source -- ~/.local/share/blesh/ble.sh" >> $rcfile
|
||||
else
|
||||
echo -e "\nble.sh already installed, skippping\n"
|
||||
fi
|
||||
# else
|
||||
# echo -e "\nble.sh already installed, skippping\n"
|
||||
# source $rcfile
|
||||
# fi
|
||||
|
||||
$SHELL -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> "$rcfile"
|
||||
|
||||
Reference in New Issue
Block a user