Skip to content

Instantly share code, notes, and snippets.

View mnixry's full-sized avatar
😴
Sleeping

Mix mnixry

😴
Sleeping
View GitHub Profile
@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;
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<div id="app" class="container">
<div class="info">
<svg
xmlns="http://www.w3.org/2000/svg"
from functools import cached_property
from timeit import timeit
class BaseN:
def __init__(self, charset: str) -> None:
self.charset = charset
self.reverse_charset = {c: i for i, c in enumerate(charset)}
assert len(self.charset) == len(self.reverse_charset), "charset must be unique"
@mnixry
mnixry / wsrx.py
Last active August 17, 2023 04:57
WebSocketReflectorX, but Python.
import asyncio
import random
import sys
from typing import Optional
from websockets.legacy.client import WebSocketClientProtocol
from websockets.legacy.client import connect as websockets_connect
BUFFER_SIZE = 1024
import uuid
from flask import Flask, request, session
from secret import black_list
import json
app = Flask(__name__)
app.secret_key = str(uuid.uuid4())
def check(data):
@mnixry
mnixry / directory_dump_from_entryjs.py
Created April 22, 2023 15:02
DASCTF 2023, dump leaked directory
import asyncio
import re
from pathlib import Path
from urllib.parse import urljoin, urlparse
from anyio import open_file
from httpx import AsyncClient
from loguru import logger
MATCH_QUOTES = re.compile(r'["\'](.*?)["\']')
@mnixry
mnixry / one_line_base16384.py
Last active March 30, 2023 21:34
Implentment https://github.com/fumiama/base16384 in Python by only one line
encoding, decoding = (
lambda input_bytes: (
"".join(
chr(0x4E00 + sum(1 << i for i, bit in enumerate(reversed(row)) if bit))
for row in (
lambda x, length: (
tuple(next(it, None) for it in x) for _ in range(length)
)
)(
[((char >> i) & 1 for char in input_bytes for i in reversed(range(8)))]
@mnixry
mnixry / decrypt_tim_database.py
Created March 21, 2023 17:16
Decrypt all TEXT and BLOB fields in MobileQQ/TIM database and update records in-place.
import itertools
import sqlite3
import sys
import rich
import rich.progress
def decrypt_blob(data: bytes, byte_key: bytes) -> bytes:
key_iterator = itertools.cycle(byte_key)