Skip to content

Instantly share code, notes, and snippets.

@smx-smx
smx-smx / makeproxy.php
Created November 26, 2022 02:48
Generate DLL proxy
<?php
<?php
//$DUMPBIN= "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/dumpbin.exe";
$DUMPBIN = 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\dumpbin.exe';
function genproxy(string $lib_path, $def, $asm){
global $DUMPBIN;
$NUMBER="\d+";
$SPACES="\s+";
$HEX="[0-9a-fA-F]+";
@smx-smx
smx-smx / kabylake.php
Created November 1, 2022 13:55
GPIO generator for Kabylake
<?php
class IntelToolGpio {
private SplFileObject $logFile;
public function __construct(string $logPath){
$this->logFile = new SplFileObject($logPath, 'r');
}
private function gpioRows(){
$HEX = "0x[0-9a-fA-F]+";
@smx-smx
smx-smx / qnx6_toolchain.sh
Last active September 11, 2022 17:37
QNX6 Cross Toolchain
#!/usr/bin/env bash
##
## This script creates a C cross compiler toolchain for QNX
## NOTE: cross compiling libstdc++ isn't yet supported, therefore it's a C-only toolchain
## Author: Stefano Moioli <smxdev4@gmail.com>
##
set -e
## SSH password to the running QNX system
SSHPASS=root
@smx-smx
smx-smx / grep.php
Last active July 14, 2022 23:42
Better grep
<?php
/**
* grep.php
* author: Stefano Moioli <smxdev4@gmail.com>
*
* Custom variant of grep that supports:
* - utf8/utf16 strings
* - hex BE/LE patterns
*/
define("CHUNKSIZE", 1024*1024);
@smx-smx
smx-smx / gas_rapl.c
Created April 27, 2022 23:44
Binutils GAS file-less frontend
/**
* @file libgas.c
* @author Stefano Moioli <smxdev4@gmail.com>
* @brief use GAS from Binutils as a library, without temporary files
* this example implements a GAS assembler RAPL - Read Assemble Print Loop
* @version 0.1
* @date 2022-04-28
*
* @copyright Copyright (c) Stefano Moioli 2022
*
@smx-smx
smx-smx / !references.txt
Last active February 20, 2022 17:10
C++ modules with CMake
> How to use c++20 modules with CMake?
https://stackoverflow.com/a/62499857/11782802
> How to compile/use header unit modules under CLang C++?
https://stackoverflow.com/a/67254709/11782802
> Modules in Clang 11
https://mariusbancila.ro/blog/2020/05/15/modules-in-clang-11/
> Using C++ Modules TS with standard headers on linux
@smx-smx
smx-smx / InvokeBundleScript.java
Created February 13, 2022 18:54
Ghidra InvokeBundleScript
/**
* A Ghidra script to chainload another Script bundled in an OSGI module
* Scripts must be placed in the /scripts package inside the bundle
*
* Written by Stefano Moioli <smxdev4@gmail.com>
*/
import generic.stl.Pair;
import ghidra.app.script.GhidraScript;
import ghidra.app.tablechooser.AddressableRowObject;
import ghidra.app.tablechooser.StringColumnDisplay;
@smx-smx
smx-smx / cirrusci_tail.sh
Created February 6, 2022 20:20
CirrusCI log tail
#!/bin/bash
taskId="$1"
echo "{\"type\":\"logs\",\"taskId\":${taskId},\"command\":\"build\"}" \
| websocat -n "wss://api.cirrus-ci.com/ws" \
| php -R 'echo json_decode($argn)->data;'
@smx-smx
smx-smx / !build_php_embed
Created January 29, 2022 21:45
build-php-embed
build_php_embed
@smx-smx
smx-smx / !pwnkit
Last active January 26, 2022 04:28
CVE-2021-4034 (pkexec) self contained exploit PoC
CVE-2021-4034 (pkexec) self contained exploit PoC