Skip to content

Instantly share code, notes, and snippets.

View hax0r31337's full-sized avatar

hax0r31337

View GitHub Profile
@hax0r31337
hax0r31337 / header.rs
Created August 11, 2025 14:33
demoinfocs2_lite generated headers
This file has been truncated, but you can view the full file.
// GENERATED CODE
// Network Protocol: 14094
use demoinfocs2_lite::{game_event::derive::GameEvent, entity::EntityClass};
use demoinfocs2_lite::entity::serializer::vector::*;
#[derive(EntityClass, Clone, Default)]
pub struct CAK47 {
#[entity(name = "m_flAnimTime")]
@hax0r31337
hax0r31337 / ipset.py
Last active October 26, 2025 22:56
Generate IPSet rule to block all Chinese IP addresses to prevent unwanted bittorrent leecher
import json, requests
def fetch_and_write_ipset(output, data_type, resource_type):
url = (
f"https://stat.ripe.net/data/{data_type}/data.json?v4_format=prefix&resource={resource_type}"
)
r = requests.get(url)
data = json.loads(r.text)["data"]
@hax0r31337
hax0r31337 / qbtpmp.py
Last active December 26, 2024 23:33
Request NAT-PMP for a publicly accessable port and modify qBittorrent prefs automatically
import natpmp
import threading
import urllib.request
import json
import traceback
BASE_URL = "http://127.0.0.1:11205"
def get_qbittorrent_perfs():
@hax0r31337
hax0r31337 / heap.rs
Created November 11, 2024 15:45
countainer/heap
pub trait SortInterface<T> {
fn less(&self, another: &T) -> bool;
}
/// provides a exact same copy of the go container/heap implementation
pub struct Heap<T: SortInterface<T>> {
pub data: Vec<T>,
}
impl<T: SortInterface<T>> Heap<T> {
@hax0r31337
hax0r31337 / main.rs
Created October 25, 2024 19:19
Rust SOCK_RAW Linux raw sockets UDP example
use std::os::fd::AsRawFd;
use nix::sys::socket;
fn main() -> Result<(), std::io::Error> {
let sock = socket::socket(
socket::AddressFamily::Inet,
socket::SockType::Raw,
socket::SockFlag::empty(),
socket::SockProtocol::Udp,
@hax0r31337
hax0r31337 / protobuf_decompiler.py
Last active October 14, 2023 02:15
Decompiles ProtoBuf by it's binary File Descriptor
from google.protobuf import descriptor_pb2 as descriptor_pb
def print_field(field: descriptor_pb.FieldDescriptorProto, indent, is_proto3, sout):
labels = {descriptor_pb.FieldDescriptorProto.LABEL_OPTIONAL: 'optional',
descriptor_pb.FieldDescriptorProto.LABEL_REQUIRED: 'required',
descriptor_pb.FieldDescriptorProto.LABEL_REPEATED: 'repeated'}
types = {descriptor_pb.FieldDescriptorProto.TYPE_DOUBLE: 'double',
descriptor_pb.FieldDescriptorProto.TYPE_FLOAT: 'float',
descriptor_pb.FieldDescriptorProto.TYPE_INT64: 'int64',
descriptor_pb.FieldDescriptorProto.TYPE_UINT64: 'uint64',
@hax0r31337
hax0r31337 / http_reader.go
Created October 11, 2023 06:55
Golang HTTP Reader to Unzip CDN-Hosted Content with a Low Memory Footprint
package hotpatch
import (
"fmt"
"io"
"net/http"
"strconv"
)
type PartialHttpReader struct {
@hax0r31337
hax0r31337 / steamguard.js
Created September 8, 2023 13:45
SteamGuard TOTP Generation
const CryptoJS = require('crypto-js');
function hexStringToUint8Array(hexString) {
const length = hexString.length;
const uint8Array = new Uint8Array(length / 2);
for (let i = 0; i < length; i += 2) {
uint8Array[i / 2] = parseInt(hexString.substring(i, i + 2), 16);
}
return uint8Array;
}
@hax0r31337
hax0r31337 / rotor.go
Created June 28, 2023 14:40
rotor implementation in golang
package main
import (
"math"
)
// replicates https://pypi.org/project/rotor/
// which is used to decipher NXPK files
type RotorObj struct {
key [5]int16
@hax0r31337
hax0r31337 / pymarshal.py
Created May 3, 2023 08:44 — forked from fate0/pymarshal.py
onmyoji: test
import types
import cStringIO
TYPE_NULL = '0'
TYPE_NONE = 'N'
TYPE_FALSE = 'F'
TYPE_TRUE = 'T'
TYPE_STOPITER = 'S'
TYPE_ELLIPSIS = '.'
TYPE_INT = 'i'