Skip to content

Instantly share code, notes, and snippets.

View Inndy's full-sized avatar

Inndy Inndy

View GitHub Profile
#!/bin/bash
f="$1"
if [ -z "$f" ]
then
echo "Usage: $0 elf-to-fix"
exit 1
fi
if [ -n "$f" -a ! -f "$f" ]
function searchTag(el, tag) {
return el.tagName === tag ? el : searchTag(el.parentNode, tag);
}
const blockList = /acer|kioxia|pny/ig
const requireList = /[124]tb/ig
[...$$('#ItemContainer .prod_name')]
.filter(el => el.textContent.match(blockList) || !el.textContent.match(requireList))
.map(el => searchTag(el, 'DL'))
Add-WindowsCapability -Online -Name (Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server~~~*').Name
Start-Service sshd
Set-Service sshd -StartupType Automatic
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
ssh w11 powershell 'chcp 65001; Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value \"ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\";icacls.exe \"$env:ProgramData\ssh\administrators_authorized_keys\" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"'
from ctypes import wintypes
import ctypes
import threading
import time
kernel32 = ctypes.CDLL('kernel32')
ENABLE_PROCESSED_INPUT = 1
ENABLE_LINE_INPUT = 2
ENABLE_ECHO_INPUT = 4
package main
import "fmt"
func fcolor(r, g, b byte) string {
return fmt.Sprintf("\x1b[38;2;%d;%d;%dm", r, g, b)
}
func bcolor(r, g, b byte) string {
return fmt.Sprintf("\x1b[48;2;%d;%d;%dm", r, g, b)
@Inndy
Inndy / monkey.py
Created October 31, 2023 09:59
monkey patch socket module
import os
proxy = os.getenv('socks5_proxy')
if proxy:
host, port = proxy.split(':')
import socks # pip install pysocks
import socket
def create_connection(address, timeout=None, source_address=None):
sock = socks.socksocket()
import { Tooltip } from 'bootstrap';
import { nextTick } from 'vue';
const attrName = 'data-bs-title';
const contextAttrName = '__v_bs_tooltip__';
export default {
install(app, options) {
app.directive('bs-tooltip', {
mounted(el, binding, vnode, prevVnode) {
@Inndy
Inndy / tab.sh
Created August 24, 2023 08:16
Execute command in new tab (for iTerm)
tab() {
s=$(printf "%s" "$*" | base64 | tr -d \\n)
osascript &>/dev/null <<EOF
tell application "iTerm"
activate
tell current window to set tb to create tab with default profile
tell current session of current window to write text " eval \$(echo $s | base64 --decode)"
end tell
EOF
}
#include <windows.h>
#include <winternl.h>
#include <stdarg.h>
#define GetCurrentProcess() ((HANDLE)-1)
NTSYSCALLAPI NTSTATUS NTAPI NtCreateSection(
_Out_ PHANDLE SectionHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
import ctypes
import ctypes.wintypes as wintypes
import time
import win32con
user32 = ctypes.CDLL('user32')
user32.MapVirtualKeyW.restype = wintypes.UINT
user32.MapVirtualKeyW.argtypes = (wintypes.UINT, wintypes.UINT)