Skip to content

Instantly share code, notes, and snippets.

View Shishqa's full-sized avatar
:shipit:

Mikhail Shishatskiy Shishqa

:shipit:
View GitHub Profile
@Shishqa
Shishqa / Dockerfile
Last active September 21, 2023 10:04
pg in docker
FROM ubuntu:20.04
ENV TZ=Europe/Moscow
COPY install_deps.sh /
RUN sh install_deps.sh
@Shishqa
Shishqa / poison.py
Created May 7, 2023 18:24
ARP spoofing attack
from scapy.all import *
import time
def discover_mac(target_ip):
E = Ether(dst="ff:ff:ff:ff:ff:ff")
A = ARP(op=1, pdst=target_ip)
packet = E / A
ans = srp(packet, timeout=2)
mac = ans[0][0][1].hwsrc
print('discovered {} MAC address: {}'.format(target_ip, mac))
local table_new = require "table.new"
local function payload()
local _ = table_new(10, 0)
for i = 1, 10 do
_[i] = "memprof-str-"..i
end
_ = nil
local chunk = [[
function lua_global_f()
local str = string.rep("%d", 100)
end
]]
for i=1,1000000 do
local f, err = loadstring(chunk:format(i))
assert(f, err)
f()
jit.off()
local st, err = misc.memprof.start('memprof.bin')
assert(st, err)
local chunk = [[
function lua_global_f()
local str = string.rep("%d", 100)
end
]]
@Shishqa
Shishqa / bench.lua
Created July 28, 2021 12:58
run `$ ./src/luajit bench.lua 16 <path-to-payload>`. 16 is the recommended argument in `PARAM_x86.txt`
local misc = require("misc")
local jit = require("jit")
local os = require("os")
local io = require("io")
local N_RUNS = 15
local function avg(n, func)
local sum = 0
for _ = 1, n do
// CXX_FLAGS: -std=c++17 -Wall -Wextra -fsanitize=address -fsanitize=undefined
#include <iostream>
#include <string_view>
#include <deque>
#ifndef NDEBUG
#define LOG( smth ) smth
#else
#define LOG( smth ) if (0) smth
__asm__ (".intel_syntax noprefix\n"
"sub rax, rdx\n"
"sub rdx, 16\n"
".strloop:\n"
"add rdx, 16\n"
"movdqu xmm0, [rdx]\n"
"pcmpistri xmm0, [rdx+rax], 0b00011000\n"
"ja .strloop\n"
"jc .not_eq\n"
"mov rax, 1\n"