Skip to content

Instantly share code, notes, and snippets.

View ph1048's full-sized avatar
🎯
Focusing

Alex ph1048

🎯
Focusing
View GitHub Profile
@ph1048
ph1048 / wsl_ssh.bat
Last active December 20, 2020 18:50
@echo off
SET name=kali-linux
SET port=2222
SET port2=8082
wsl -d %name% -u root -e /bin/bash -c "service ssh start"
SET getipcmd=wsl -d %name% -e /bin/bash -c "ifconfig eth0 | grep netm | grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}' | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:"
for /f "delims=" %%i in ('%getipcmd%') do set tgtip=%%i
netsh interface portproxy add v4tov4 listenport=%port% listenaddress=0.0.0.0 connectport=%port% connectaddress=%tgtip%
job := DllCall("CreateJobObject", "Ptr", 0, "Ptr", 0)
jobinfo := BufferAlloc(144, 0)
NumPut("UInt", 0x2000, jobinfo, 16)
setinfo := DllCall("SetInformationJobObject", "Ptr", job, "UInt", 9, "Ptr", jobinfo, "UInt", 144)
assigned := DllCall("AssignProcessToJobObject", "Ptr", job, "Ptr", DllCall("GetCurrentProcess"))
ProcessClose("Launcher.exe")
ProcessClose("SocialClubHelper.exe")
ProcessClose("LauncherPatcher.exe")
ProcessWaitClose("Launcher.exe", 30)
@ph1048
ph1048 / VFIO Setup Guide.md
Created December 26, 2020 00:29 — forked from 0chroma/VFIO Setup Guide.md
Windows 10 VFIO QEMU Setup

VFIO Setup Guide

I play games regularly, and the sad reality is that it forces me to use Windows on my desktop. There's a Linux installation on there, but rebooting into it is such a massive interruption that I usually just move over to my laptop for programming. Working on a laptop leads to all sorts of ergonomic issues, and it felt like a massive waste to not develop on the desktop hardware I invested so much in. So after extensively researching what the VFIO community has been doing, I've deleted my Windows installation and moved all my gaming into a virtual machine on a Linux host.

Normally VMs are too slow for gaming, but thanks to a feature called VFIO you can run games at near-native performance by passing graphics cards and USB controllers directly to a virtual machine. The only requirement is that your board supports IOMMU, which most modern systems have. In this guide I'll wal

<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
<name>win10_silent</name>
<uuid>d21581f4-c186-4571-b1bc-d8c63a7be3b4</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">16787456</memory>
<currentMemory unit="KiB">4194304</currentMemory>
@ph1048
ph1048 / pci-passthrough.md
Created January 4, 2021 00:02 — forked from ulkeshkosh/pci-passthrough.md
PCI-Passthrough Rig, OS, and Setup

Introduction

This is my guide for a successful PCI-Passthrough from Linux (Arch Linux) to QEMU/KVM via virt-manager and libvirtd into a Windows 10 Home guest.

NOTE: This is a guide for Intel only. I do not own an AMD machine, and will not add AMD information this guide until such time that I do, which could be never.

Hardware

Device Type Device
CPU Intel Core i7 7700K Quad-Core, Hyperthreading
Motherboard Gigabyte Z270X-Gaming 5
@ph1048
ph1048 / gist:b8743b180e423383741fbaff37c255d1
Created May 1, 2021 22:06
keenetic port knocking for vpn
#!/bin/sh
[ "$table" != "filter" ] && exit 0
/opt/sbin/ipset create knockd hash:ip -exist
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 1701 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 4500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 1701 -j ACCEPT
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 500 -j ACCEPT
@ph1048
ph1048 / gist:e05bb419857e3dd937d7de6b30409f48
Created July 7, 2021 06:42
transmission remote handler
"C:\Program Files\Transmission\transmission-remote.exe" 192.168.x.x:9999 -a %1
pause
@ph1048
ph1048 / mount_qcow2.md
Created August 22, 2021 13:01 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@ph1048
ph1048 / userconfig.cfg
Created November 13, 2021 12:47
switch xash3d control config
unbindall
// - button
bind BACK "toggleconsole"
// + button
bind START "escape"
// Left stick press
bind STICK1 "+speed"
// Right stick press
bind STICK2 ""
// L button