Skip to content

Instantly share code, notes, and snippets.

@sekaiwish
sekaiwish / convert_quests.py
Last active February 11, 2024 09:13
MHF Quest Backport Script
import os
import argparse
from multiprocessing import Pool
def convert_quest(fn):
if not os.path.exists(args.path + fn):
print(fn, 'does not exist')
return
if os.path.exists(args.path + fn + '.bak'):
@sekaiwish
sekaiwish / mhf_server.py
Last active December 17, 2023 12:09
MHF HTTP Server
#!/usr/bin/python
import http.server
import socketserver
from urllib.parse import parse_qs
port = 80
print_headers = True
print_params = True
class CustomHandler(http.server.SimpleHTTPRequestHandler):
@sekaiwish
sekaiwish / GenerateEventSchema.py
Created August 1, 2023 11:04
Python script to port Erupe 9.2 event quests to Erupe 9.3
import os
d = 'bin/events'
out = 'begin;insert into event_quests(max_players, quest_type, quest_id, mark)values'
for y, _, x in os.walk(d):
for z in x:
f = os.path.join(y, z)
if os.stat(f).st_size < 352:
continue
with open(f, 'rb') as p:
@sekaiwish
sekaiwish / ErupeReindexGuild.sql
Created November 10, 2022 12:51
Reindex Erupe Guild
do
$$
declare guild_to_resort integer := <guild id>;
declare f record;
declare i integer := 2;
declare char_id integer;
begin
for f in select gc.id
from public.guild_characters gc
@sekaiwish
sekaiwish / DSGN002.go
Created November 5, 2022 01:26
MHF DSGN002 Response
func (s *Session) makeSignIn002Resp(uid int) []byte {
chars, err := s.server.getCharactersForUser(uid)
if err != nil {
s.logger.Warn("Error getting characters from DB", zap.Error(err))
}
rand.Seed(time.Now().UnixNano())
token := randSeq(16)
bf := byteframe.NewByteFrame()
bf.WriteUint8(1) //resp
@sekaiwish
sekaiwish / SU9.sql
Last active August 2, 2022 10:19
SU9 Update Schema
BEGIN;
ALTER TABLE IF EXISTS public.users
ALTER rights SET DEFAULT 14;
ALTER TABLE IF EXISTS public.users
ALTER rights SET NOT NULL;
UPDATE public.users SET rights=14 WHERE rights IS NULL;
@sekaiwish
sekaiwish / MHFDecrypt.py
Last active July 23, 2022 00:20
MHF Packet Decrypter
# Monster Hunter Frontier packet decryption PoC.
import socket
import struct
import sys
from hexdump import hexdump
ENCRYPT_KEY = b'\x90\x51\x26\x25\x04\xBF\xCF\x4C\x92\x02\x52\x7A\x70\x1A\x41\x88\x8C\xC2\xCE\xB8\xF6\x57\x7E\xBA\x83\x63\x2C\x24\x9A\x67\x86\x0C\xBE\x72\xFD\xB6\x7B\x79\xB0\x22\x5A\x60\x5C\x4F\x49\xE2\x0E\xF5\x3A\x81\xAE\x11\x6B\xF0\xA1\x01\xE8\x65\x8D\x5B\xDC\xCC\x93\x18\xB3\xAB\x77\xF7\x8E\xEC\xEF\x05\x00\xCA\x4E\xA7\xBC\xB5\x10\xC6\x6C\xC0\xC4\xE5\x87\x3F\xC1\x82\x29\x96\x45\x73\x07\xCB\x43\xF9\xF3\x08\x89\xD0\x99\x6A\x3B\x37\x19\xD4\x40\xEA\xD7\x85\x16\x66\x1E\x9C\x39\xBB\xEE\x4A\x03\x8A\x36\x2D\x13\x1D\x56\x48\xC7\x0D\x59\xB2\x44\xA3\xFE\x8B\x32\x1B\x84\xA0\x2E\x62\x17\x42\xB9\x9B\x2B\x75\xD8\x1C\x3C\x4D\x76\x27\x6E\x28\xD3\x33\xC3\x21\xAF\x34\x23\xDD\x68\x9F\xF1\xAD\xE1\xB4\xE7\xA6\x74\x15\x4B\xFA\x3D\x5F\x7C\xDA\x2F\x0A\xE3\x7D\xC8\xB7\x12\x6F\x9E\xA9\x14\x53\x97\x8F\x64\xF4\xF8\xA2\xA4\x2A\xD2\x47\x9D\x71\xC5\xE9\x06\x98\x20\x54\x80\xAA\xF2\xAC\x50\xD6\x7F\xD9\xC9\xCD\x69\x46\x6D\x30\x
@sekaiwish
sekaiwish / charID.go
Created April 17, 2022 18:26
MHF charID to int
package main
import (
"fmt"
"math"
)
func pwr(a int, b int) int {
return int(math.Pow(float64(a), float64(b)))
}
@sekaiwish
sekaiwish / Delete.js
Created April 15, 2022 14:29
Prevent DevTools
setInterval(function() {
var responseTime = 100;
var before = new Date().getTime();
debugger;
var after = new Date().getTime();
if (after - before > responseTime) {
document.body.innerHTML = "";
location.reload();
}
}, 50);
@sekaiwish
sekaiwish / shadow.py
Last active December 21, 2021 13:14
Discord Shadowban Bot
#!/usr/bin/python -u
import os, asyncio, discord
from discord.ext import commands
owner = 119094696487288833
shadowed = {} # user IDs as ints
intents = discord.Intents.none()
intents.guild_messages = True
bot = commands.Bot(command_prefix='.', owner_id=owner, intents=intents)