This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By default, EBPF programs will not run on WSL2 due to required kernel modules missing. The following example error is an | |
indication of this problem: | |
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microso | |
ft-standard/modules.dep.bin' | |
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.84-microsoft-standard | |
chdir(/lib/modules/4.19.84-microsoft-standard/build): No such file or directory | |
To fix this you need to rebuild the WSL2 kernel with the missing kernel modules. The below instructions are for Ubuntu 18.04 WSL2. | |
1. git clone https://github.com/microsoft/WSL2-Linux-Kernel.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
int | |
main(void) { | |
int ii; | |
uint8_t buf[8192] = { 0 }; | |
// Worlds most impressive exploit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
typedef struct { | |
int size; | |
char* data; | |
} test_struct; | |
void some_func(test_struct **s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def j(lineno): | |
frame = sys._getframe().f_back | |
called_from = frame | |
def hook(frame, event, arg): | |
if event == 'line' and frame == called_from: | |
try: | |
frame.f_lineno = lineno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var connect = new NativeFunction( | |
Module.findExportByName(null, "connect"), | |
'int', | |
['int', 'pointer', 'int'] | |
); | |
Interceptor.replace(connect, new NativeCallback(function (sockfd, addr, addrlen) { | |
console.log(sockfd, addr, addrlen); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
import requests | |
import json | |
app = Flask(__name__) | |
def msg_process(msg, tstamp): | |
js = json.loads(msg) | |
msg = 'Region: {0} / Alarm: {1}'.format( | |
js['Region'], js['AlarmName'] |