Skip to content

Instantly share code, notes, and snippets.

View mnixry's full-sized avatar
😴
Sleeping

Mix mnixry

😴
Sleeping
View GitHub Profile
"""A module for serving static files with URL rewriting support.
Module Overview:
This module provides the RewrittenStaticFiles class, an extension of Starlette's StaticFiles that supports URL rewriting.
The class is designed to serve static files from a specified directory or packages and to apply rewrite rules in case a requested
file is not found (HTTP 404). Rewrite rules are defined as a dictionary where keys are patterns (either wildcard strings or compiled
regular expressions) and values are target paths. If a request initially results in a 404 error, the class will attempt to match
the path against the rewrite rules and serve the corresponding rewritten file if found.
Examples:
@mnixry
mnixry / unpack_ysm.py
Created October 13, 2024 04:00
Unpack YesSteveModel's proprietary format into zip format, for version < 1.2.0 only.
import hashlib
import zipfile
import zlib
from base64 import b64decode
from dataclasses import dataclass
from io import BytesIO
from pathlib import Path
from typing import IO, Literal, Optional
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
@mnixry
mnixry / scrcpy.Dockerfile
Created May 28, 2024 19:08
Running Scrcpy in Docker with VNC support.
# stage for building scrcpy
FROM ubuntu:latest AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl gcc git pkg-config meson ninja-build libsdl2-dev ca-certificates \
libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
libswresample-dev libusb-1.0-0-dev libswscale-dev libvncserver-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@mnixry
mnixry / class_ical.py
Last active February 26, 2024 14:57
Generate iCalendar file for BUPT class schedule.
"""
Generate iCalendar file for BUPT class schedule.
Usage:
python this_file.py <username> <password>
Note:
1. You need to install the following packages:
- httpx
- ics
@mnixry
mnixry / remarkable2-chinese-user-checklist.md
Last active January 6, 2025 06:38
reMarkable2 国内用户自救指南

reMarkable2 国内用户自救指南

Warning

请在系统更新/出厂设置后食用。

将设备连接至电脑,打开Settings -> General -> About -> Copyrights and License, 翻到最底部可以看到系统root密码。

在电脑上使用 ssh [email protected] 进行连接,下列说明均基于已连接到的前提。

中文字体

@mnixry
mnixry / ast.py
Created December 18, 2023 08:39
Python Jail, QWB2023, by @crazymanarmy
import ast
BAD_ATS = {
ast.Attribute,
ast.Subscript,
ast.comprehension,
ast.Delete,
ast.Try,
ast.For,
ast.ExceptHandler,
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
git clone https://github.com/LagrangeDev/Lagrange.Core /app
WORKDIR /app
RUN dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj \
--self-contained \
-p:PublishSingleFile=true \
@mnixry
mnixry / shell_client.c
Last active November 8, 2023 15:48
Reverse shell with TTY and RC4 obfuscated traffic.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <pty.h>
#include <time.h>
#include <arpa/inet.h>
#include <signal.h>
#include <sys/select.h>
#include <sys/wait.h>
@mnixry
mnixry / hashcash_pow.py
Created October 30, 2023 06:56
Pure Python implementation for HashCash proof-of work, friendly for CTF.
from typing import Optional
import re
from pwn import *
def mint(
resource: str,
bits: int = 20,
now: Optional[float] = None,
ext: str = "",
@mnixry
mnixry / base3050.php
Created September 27, 2023 00:28
Base3050 Challenge (TSCTF-J 2023)
<?php
class BaseN
{
protected $charset;
protected $reverseCharset;
public function __construct(array $charset)
{
$this->charset = $charset;