Skip to content

Instantly share code, notes, and snippets.

@strayge
strayge / find_sectors.py
Last active December 11, 2018 07:24
Recover files from damaged disk using The Sleuth Kit and ddrescue (GNU)
#!/usr/bin/python3
# Script for combine The Sleuth Kit and ddrescue (GNU)
# It's allowed to restore from damaged drive only needed files
import argparse
import json
import os
import subprocess
import time
@strayge
strayge / shortcuts.ahk
Last active March 18, 2018 10:19
windows shortcuts
; # - win, ! - alt, ^ - ctrl, + - shift
#MaxHotkeysPerInterval 200
global en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
ChangeActiveLayoutToEng()
{
WinGet, window_id, ID, A
pid := DllCall("GetWindowThreadProcessId", "UInt", window_id, "Ptr", 0)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; This should be replaced by whatever your native language is. See
; http://msdn.microsoft.com/en-us/library/dd318693%28v=vs.85%29.aspx
; for the language identifiers list.
ru := DllCall("LoadKeyboardLayout", "Str", "00000419", "Int", 1)
; For faster switching with standard method needs to disable "Animate windows when minimizing and maximizing"
; in SystemPropertiesAdvanced.exe -> Advanced -> Performance -> Settings -> Visual Effects
; Globals
DesktopCount := 4 ; Windows starts with 2 desktops at boot
CurrentDesktop := 1 ; Desktop count is 1-indexed (Microsoft numbers them this way)
PreviousDesktop := 1 ; Number of previous desktop
UseAltSwitchAfter := 2 ; Use alternative (TaskView) switch method if distance is more than this variable
KeyDelayStandartSwitch := 100 ; Delay between switching each desktop in standard mode.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; #NoTrayicon
Menu, Tray, Icon, tray.ico,1
Menu, Tray, NoStandard
Menu, Tray, Add, Toggle Touch, Toggle
Menu, Tray, Add,
Menu, Tray, Standard
#SingleInstance, Force
loop {
WTS := ProcessExplorer.WTSEnumerateProcessesEx()
string := ""
loop % WTS.MaxIndex()
{
name := WTS[A_Index, "ProcessName"]
@strayge
strayge / grub_efi_secure_boot.sh
Created October 7, 2017 21:27
Create GRUB for secureboot (only builtin modules allowed) for Kali and Parrot OS on usb stick
# GRUB for secureboot (only builtin modules allowed) for Kali and Parrot OS on usb stick
# main part from kali build scripts: http://git.kali.org/gitweb/?p=packages/live-build.git;a=blob;f=scripts/build/efi-image
# parrot os includes already compiled binaries
# generate keys for secureboot: https://habrahabr.ru/post/273497/
# compiled binary can just replaced builded on efi partition on usb stick
mkdir grub-efi-temp-x86_64-efi
mkdir workdir
mkdir -p workdir/boot/grub
diffmks = 0.1 * 10**6
for i in range(20):
p=sniff(count=1, lfilter=lambda x: x.haslayer(ICMP));
r=IP(dst=p[0][IP].src)/ICMP(type="echo-reply", code=p[0][ICMP].code, id=p[0][ICMP].id, seq=p[0][ICMP].seq)/p[0].load;
sec, mks = unpack('QQ', r.load[0:16]);
mks += diffmks;
load = pack('QQ', sec, mks) + r.load[16:];
r.load = load;
send(r, loop=0);
@strayge
strayge / styles.css
Last active January 28, 2018 05:32
ff 57 tree style tab fixes
/* ======================================================================= */
/* userChrome.css */
/* Create file at %AppData%\Mozilla\Firefox\Profiles\<profile_name>\chrome */
/* ======================================================================= */
/* Remove horizontal tabs */
#tabbrowser-tabs {
visibility: collapse;
}
@strayge
strayge / python_email_parse.py
Last active April 7, 2023 15:54
email parse pop3 python
import poplib
import email
from base64 import b64decode
pop3_server = 'pop.gmail.com'
pop3_port = '995'
username = 'XXXXXXXXXX@gmail.com'
password = 'XXXXXXXXXXXXXX'
M = poplib.POP3_SSL(pop3_server, pop3_port)