Simple keystroke to prevent sleep

Standard
A simple script to double-tap on the numb lock to prevent the machine to sleep
This is a very simple script which can prevent the machine to sleep. 

Python 

import pyautogui
import time

while True:
    pyautogui.press('numlock')
    pyautogui.press('numlock')
    time.sleep(60)
Number lock key double tap
Windows Powershell

while ($true) {
    [System.Windows.Forms.SendKeys]::SendWait("{NUMLOCK}")
    [System.Windows.Forms.SendKeys]::SendWait("{NUMLOCK}")
    Start-Sleep -Seconds 60
}



Here is the same script written in PowerShell without using the System.Windows.Forms.SendKeys class:

while ($true) {
    Add-Type -AssemblyName System.Windows.Forms
    [System.Windows.Forms.SendKeys]::Send("{NUMLOCK}")
    [System.Windows.Forms.SendKeys]::Send("{NUMLOCK}")
    Start-Sleep -Seconds 60
}


Here is the same script written in PowerShell using the SendWait() method from the System.Windows.Forms.SendKeys class:

Add-Type -AssemblyName System.Windows.Forms
while ($true) {
[System.Windows.Forms.SendKeys]::SendWait("{NUMLOCK}")
[System.Windows.Forms.SendKeys]::SendWait("{NUMLOCK}")
Start-Sleep -Seconds 60
}

Rubber Ducky

Standard

During my recent internal BlackBox testing, I got a chance to use the rubber ducky. This device looks like a USB thumb drive, can be concealed inside a standard USB case and it acts as a keyboard. The script written on the SD card is called ducky script which is very easy to understand.

Since there are a lot of write-ups on the internet about the ducky ill just be posting on of the script I used in my recent pen-testing. I hope you may find it useful.

The script is written keeping in mind that not all windows OS are the same, and hardware specifications are different as well. While using the default scripts at times the system was not able to type complete code, hence you will see many spaces and delays.


Reverse Shell

Continue reading