Skip to content

Instantly share code, notes, and snippets.

View iljavs's full-sized avatar

Ilja van Sprundel iljavs

View GitHub Profile
@iljavs
iljavs / xml2json.py
Created February 25, 2024 22:17
convert xml to json
import xmltodict
import json
import sys
xmlfile = sys.argv[1]
jsonfile = xmlfile.replace('.xml', '.json')
with open(xmlfile, 'r') as file:
xml_string = file.read()
dict_data = xmltodict.parse(xml_string)
import impacket.dns
import socket
import select
import sys
import multiprocessing
import signal
# DNS server to connect to
dns_server = "8.8.8.8"
#include <stdio.h>
#include <windows.h>
#include <sddl.h>
#pragma comment(lib, "advapi32.lib")
void error(char *msg) {
fprintf(stderr, "%s" , msg);
exit(1);
}
@iljavs
iljavs / mprocmon.py
Last active November 30, 2022 10:03
#!/usr/bin/python
import os
import sys
import time
import win32api
import win32con
import win32security
import wmi # pip install wmi
import psutil
@iljavs
iljavs / recflow.go
Last active May 8, 2022 15:52
find recursive functions in c files in a directory using cflow
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
/*
* Rust has no APIs for random numbers. At all! If you want that you have
* to rely on 3rd party libraries. This is simply ridiculous. Relying on
* 3rd party libraries for cryptographically strong random numbers is one
* thing, however, there are many instances where you need a random number
* that doesn't have to be cryptographically strong, and any modern
* programming environment (or even not so modern) should offer this,
* Without having to rely on a 3rd party library!!!
*
* Because rust doesn't offer it, we'll just have to build our own. We'll
#include <windows.h>
#include <stdio.h>
#define IOCTL_PROCESS_PROTECT_BY_PID CTL_CODE(FILE_DEVICE_UNKNOWN , 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PROCESS_UNPROTECT_BY_PID CTL_CODE(FILE_DEVICE_UNKNOWN , 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PROCESS_PROTECT_CLEAR CTL_CODE(FILE_DEVICE_UNKNOWN , 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
int main(int argc, char **argv) {
if (argc < 2) {
#include <ntddk.h>
#include <windef.h>
#define DEVNAME L"\\Device\\ProcProt"
#define LINKNAME L"\\??\\ProcProt"
PVOID regHandle;
#define IOCTL_PROCESS_PROTECT_BY_PID CTL_CODE(FILE_DEVICE_UNKNOWN , 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PROCESS_UNPROTECT_BY_PID CTL_CODE(FILE_DEVICE_UNKNOWN , 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
#include <Windows.h>
#include <stdio.h>
#include <winternl.h>
#include <ntstatus.h>
#define BEEPDEV L"\\Device\\Beep"
#define IOCTLCODE 0x10000
typedef NTSTATUS(CALLBACK* NTOPENFILE)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK, ULONG, ULONG);
// ZeroRead.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <Windows.h>
#include <stdio.h>
void hexdump(unsigned char* p, DWORD len) {
DWORD i;
for (i = 0; i < len; i++) {