Skip to content

Instantly share code, notes, and snippets.

@raresteak
raresteak / wireless.md
Created April 12, 2025 14:04
Some wifi notes

place adapter in monitor mode

sudo airmon-ng start wlan1

scan for targets

sudo airodump wlan1mon --band a # a band 5ghz

or

@raresteak
raresteak / gist:e8250ce891ce07f02b8718ec4b3839db
Created April 8, 2025 21:17
C Format specifiers - Ascii to Decimal conversion
ASCII to Decimal conversion
C ---> Decimal
: %c ---> 58 32 37 99
: %d ---> 58 32 37 100
: %f ---> 58 32 37 102
: %i ---> 58 32 37 105
: %s ---> 58 32 37 115
: ---> 58
@raresteak
raresteak / Migrating_harddrives.txt
Last active December 28, 2024 16:31
Migrating harddrives
# Scenario 1 - smaller to larger drive
1. boot Clonezilla
2. Choose second option - Clonezilla live (VGA 800x600 & To RAM)
3. follow prompts for source and destination disks
# Scenario 2 - larger to smaller drive
1. Boot gparted livecd
2. shrink source partition to smaller than destination
3. boot shrunk drive and check filesystem with native OS tool
4. see scenario 1 to migrate drive.
@raresteak
raresteak / timeouts.md
Created November 26, 2024 12:58
Reduced systemd timeouts /etc/systemd/system.conf

Edit file

sudo vim /etc/systemd/system.conf

Modify

DefaultTimeoutStartSec=20s
DefaultTimeoutStopSec=20s
@raresteak
raresteak / gist:2309df08d197f2ab8d9a4435f94abb3f
Created November 19, 2024 20:31
Desktop screenshots - recording desktop from cmd line
Start recording process
```
psr.exe /start /output c:\my\path\screenshots.zip /sc 1 /gui 0
```
Stop recording process
```
psr.exe /stop
```
@raresteak
raresteak / uptime.ps1
Created November 12, 2024 14:48
Uptime command similiar to Unix uptime
# Similiar to unix command uptime
$bootTime = Get-CimInstance -ClassName win32_operatingsystem | Select-Object -ExpandProperty LastBootUpTime
$currentTime = Get-Date
$uptime = $currentTime - $bootTime
$days = $uptime.Days
$hours = $uptime.Hours
$minutes = $uptime.Minutes
$users = (quser).Count-1
if ( $users -lt 0 ) {
$users = 0
@raresteak
raresteak / Enable-PSWA.ps1
Last active November 12, 2024 13:41
Install and configure PowerShell Web Access
install-windowsfeature -name WindowsPowerShellWebAccess -computername server1 -includemanagementtools -restart
install-pswawebapplication -usetestcertificate
add-pswaauthorizationrule -username * -computername * -configurationname *
set-item wsman:\localhost\Client\TrustedHosts -Value 'localhost,server1,10.10.10.1' -force
enable-psremoting -force
# Goto URL https://localhost/pswa
# Login username format
# localhost\theuser
@raresteak
raresteak / myservice.service
Last active September 24, 2024 12:51
Example systemd service file
# myservice.service
[Unit]
Description=Python HTTP server /tmp port 4848
Documentation=man systemd.service
After=network.target #myservice.service requires networking be up first
[Service]
User=sam
ExecStartPre=sh -c 'echo TRUE > /tmp/TRUE'#not required, just an example
ExecStart=/usr/bin/python3 -m http.server -d /tmp 4848
@raresteak
raresteak / windows-ip-cmdline.md
Created August 22, 2024 12:01
Manually setting IP information in Windows

Get name of adapter

netsh interface ipv4 show config

Set static IP

Change name= to name of interface found above

netsh interface ipv4 set address name=Ethernet static 10.10.10.10 255.0.0.0 [optional IP of default gateway]
netsh interface ipv4 show config
@raresteak
raresteak / bluetooth.md
Last active August 12, 2024 12:56
Bluetooth Classic at Linux command line

List devices

hciconfig
hciconfig hci0 version

Bring interface up | down

sudo hciconfig hci0 up