Skip to content

Instantly share code, notes, and snippets.

View singchia's full-sized avatar
🎯
Focusing

singchia

🎯
Focusing
View GitHub Profile
@singchia
singchia / tun-ping-linux.py
Created January 7, 2018 09:27 — forked from glacjay/tun-ping-linux.py
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
const { NodeVM } = require('vm2');
const vm = new NodeVM({
console: 'inherit',
sandbox: {},
require: {
external: false,
builtin: ['fs', 'path'],
}
});
var code = `
const { NodeVM } = require('vm2');
const vm = new NodeVM({
console: 'inherit',
sandbox: { hello: hello },
require: {
external: false,
builtin: ['fs', 'path'],
}
});
var code = `