Skip to content

Instantly share code, notes, and snippets.

@eyJhb
eyJhb / flask-shutdown-restart.py
Created July 22, 2018 19:13
Simple flask web server to shutdown and restart a server
from flask import Flask
import subprocess
app = Flask(__name__)
@app.route("/")
def index():
return "Please visit /shutdown or /restart"
@app.route("/restart")
def restart():
@eyJhb
eyJhb / default.nix
Last active January 14, 2024 11:37
nixus sources test
let
sources = import ./sources.nix;
in import sources.nixus {
specialArgs.sources = sources;
} ({ config, ... }: {
defaults = { lib, name, ... }: {
configuration = {
config._module.args.sources = sources;
config.networking.hostName = lib.mkDefault name;
};
{ config, pkgs, lib, ... }:
with lib;
let
verifiedNetfilter = { text, modules ? [ ] }:
let
file = pkgs.writeText "netfilter" text;
vmTools = pkgs.vmTools.override {
rootModules =
#! /usr/bin/env nix-shell
#! nix-shell -i perl -p perl nixUnstable.perl-bindings
# pipe using stdin, to this script, where each line has the format
# <algo> <hash> <name>
# sha256 0q6gwd9pqh41f6j5p9jl92aji4p8kx9inffpha93d7jc3ndsfq6q rematch2_2.1.2.tar.gz
use strict;
use Nix::Store;
@eyJhb
eyJhb / README.adoc
Last active August 14, 2023 09:41 — forked from danbst/README.adoc
Pure Nix Minecraft launcher. For every MC version!

Pure Nix Minecraft launchers

  1. Download .nix file

  2. Run:

    $ nix run -f all-minecrafts.nix versions.v1_8_9.client -c minecraft
  3. Enjoy (…​power of fixed-output derivations)!

@eyJhb
eyJhb / frida-okhttp3-hook.js
Created March 31, 2022 12:52
Android Frida Reverse Engineer Hook for okhttp3 requests/response
function hook_okhttp3() {
Java.perform(function() {
var ByteString = Java.use("com.android.okhttp.okio.ByteString");
var Buffer = Java.use('okio.Buffer'); var Interceptor = Java.use("okhttp3.Interceptor");
var MyInterceptor = Java.registerClass({
name: "okhttp3.MyInterceptor",
implements: [Interceptor],
methods: {
intercept: function(chain) {
var request = chain.request();
@eyJhb
eyJhb / schedule-finder.sh
Last active September 4, 2021 21:44
Schedule finder for AAU
#!/usr/bin/env bash
START=6100
KEYWORD=$1
for i in {1..2000}; do
if [ $(($i%100)) -eq 0 ]; then
echo "Currently at: $i"
fi
@eyJhb
eyJhb / happy-writeup.md
Created May 11, 2021 08:31
Happy writeup

The Happy Website

Phase 1 - What the hell is this?

A website is presented, where you can choose from a list of options. When changing the options, a request is sent to the backend server which will give you a reply. One of the options is XXE, which will tell you that you cannot do XXE on JSON.

Inspecting the source of the website, it is shown that it encodes using JSON to communicate with the backend, which includes setting Content-Type: application/json, with a format of {"message": "Cola"}. Instead it can be set to Content-Type: application/xml, <message>Cola</message>.

@eyJhb
eyJhb / ocr.nix
Last active January 11, 2021 09:39
OCR
{ pkgs ? import <nixpkgs> }:
let
scriptScreenOCR = pkgs.writeScript "screenocr" ''#!/bin/sh
${pkgs.maim}/bin/maim -s | ${pkgs.tesseract4}/bin/tesseract stdin stdout -l "eng+equ" --psm 1 --oem 3 | ${pkgs.xsel}/bin/xsel -i -b
${pkgs.libnotify}/bin/notify-send "OCR ready!"
'';
scriptScreenOCRWayland = pkgs.writeScript "screenocr" ''#!/bin/sh
${pkgs.grim}/bin/grim -t png -g "$(slurp)" - | ${pkgs.tesseract4}/bin/tesseract tesseract stdin stdout -l "eng+equ" --psm 1 --oem 3 | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.libnotify}/bin/notify-send "OCR ready!"
@eyJhb
eyJhb / inequality.go
Created May 10, 2020 13:30
inequality
package memory
import (
"reflect"
"testing"
"gitlab.com/deviosec/octp/server/pkgs/store/models"
"golang.org/x/exp/errors/fmt"
)