Skip to content

Instantly share code, notes, and snippets.

View v14dislav's full-sized avatar

Vladislav Lastname v14dislav

View GitHub Profile
@v14dislav
v14dislav / Tools.txt
Last active September 10, 2020 17:48
tools for RE
1. Binary editors
hiew
bz
010
winhex
binwalk (IDA)
bindiff (IDA)
2. Disassembling
IDA (+hexrays plugin) (https://t.me/idapro)
@v14dislav
v14dislav / debugger_winappdbg.py
Last active September 10, 2020 17:46
pydbg -> winappdbg
from winappdbg import *
import sys
import random
import struct
import subprocess
size = 1000
exe_name = "fuzz_server.exe"
snapshot_hook = 0x1400070C0
restore_hook = 0x140007537
@v14dislav
v14dislav / dllinject.c
Created April 26, 2019 13:35
dll path injection. depends on LoadLibrary()
#include <windows.h>
#include <tlhelp32.h>
DWORD getProcessID() {
DWORD processID = 0;
HANDLE snapHandle;
PROCESSENTRY32 processEntry = {0};
if( (snapHandle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE ) {
return 0;
@v14dislav
v14dislav / process_hollowing.c
Created April 26, 2019 13:33
replacment process memory. injection technic
//https://github.com/theevilbit/injection/blob/master/ProcessHollowing/ProcessHollowing/ProcessHollowing.cpp
#include <stdio.h>
#include <Windows.h>
#include <winternl.h>
#pragma comment(lib,"ntdll.lib")
EXTERN_C NTSTATUS NTAPI NtTerminateProcess(HANDLE, NTSTATUS);
EXTERN_C NTSTATUS NTAPI NtReadVirtualMemory(HANDLE, PVOID, PVOID, ULONG, PULONG);
@v14dislav
v14dislav / vulnprintf.c
Last active June 26, 2019 14:39
Format (printf) vulner
arg= "\x79\x01\x43\x77%s"
cmdline = "C:\\Users\\designer\\Desktop\\printf\\src.exe {}".format(arg)
import binascii
import subprocess
output = subprocess.check_output(cmdline, shell=True)
output = binascii.b2a_hex(output)
print output
@v14dislav
v14dislav / slab_alloc.c
Created April 11, 2019 14:27
SLAB allocator
#include <stdio.h>
#define ORDER 10
#define POWER 1024 /* 2^ORDER */
/**
* Эти две функции вы должны использовать для аллокации
* и освобождения памяти в этом задании. Считайте, что
* внутри они используют buddy аллокатор с размером
* страницы равным 4096 байтам.
**/
@v14dislav
v14dislav / simpleallocator.c
Created April 11, 2019 14:26
Simple memory allocator
#include <inttypes.h>
#include <stdio.h>
#define FREE 0x6B
#define META 5
#define MIN_block 16
void * buffer= 0;
size_t length=0;
@v14dislav
v14dislav / operator2.cpp
Created April 11, 2019 14:24
Operator overloading > < != ==
struct Rational
{
Rational(int numerator = 0, int denominator = 1);
void add(Rational rational);
void sub(Rational rational);
void mul(Rational rational);
void div(Rational rational);
void neg();
@v14dislav
v14dislav / operator.cpp
Created April 11, 2019 14:23
Operator overloading []
#include <iostream>
#include <string.h>
using namespace std;
class SubString;
class String{
public:
char *str;
size_t size; //len +1
String(const char *s);
@v14dislav
v14dislav / sharedptr.cpp
Created April 11, 2019 14:21
Smart C++ pointers: shared ptr
struct Expression;
struct Number;
struct BinaryOperation;
struct SharedPtr
{
explicit SharedPtr(Expression *ptr = 0){
ptr_=ptr; count= new int; *count=1;
}