Skip to content

Instantly share code, notes, and snippets.

@hc0d3r
hc0d3r / xreadlink.c
Created December 26, 2019 12:10
example of how to use readlink
#include <spyderhook.h>
#include <ignotum.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@hc0d3r
hc0d3r / background.js
Last active July 22, 2019 06:55
remove fbclid
function remove_fbclid(details){
let index, url = details.url, update = 0;
index = url.indexOf('facebook.com/l.php?u=');
if(index > -1 && index < 15){
url = url.substring(index+21, url.indexOf('&'));
if(url !== undefined){
url = decodeURIComponent(url);
update = 1;
@hc0d3r
hc0d3r / maps.py
Last active June 30, 2019 11:09
gdb script that provide better memory map information than "info proc map"
# Demo:
# (gdb) starti
# Starting program: /usr/bin/id
# Program stopped.
# 0x00007ffff7fd4100 in _start () from /lib64/ld-linux-x86-64.so.2
# (gdb) maps
# 555555554000-555555556000 r--p 00000000 fe:02 3945170 /usr/bin/id
# 555555556000-55555555b000 r-xp 00002000 fe:02 3945170 /usr/bin/id
# 55555555b000-55555555e000 r--p 00007000 fe:02 3945170 /usr/bin/id
# 55555555e000-555555560000 rw-p 00009000 fe:02 3945170 /usr/bin/id
@hc0d3r
hc0d3r / start-ep.py
Last active June 30, 2019 12:38
gdb script to set a breakpoint in the entry-point, works with PIE, non-PIE, and stripped binaries
import gdb
import re
class entryPoint(gdb.Command):
def __init__(self):
super(entryPoint, self).__init__("start-ep", gdb.COMMAND_BREAKPOINTS)
def invoke(self, arg, from_tty):
output = gdb.execute('starti '+arg, False, True)
@hc0d3r
hc0d3r / deproy.sh
Last active February 5, 2019 03:33
chmod +x deproy.sh
#!/bin/bash
help(){
cat <<B
deproy.sh
Usage: deproy.sh [cmd]
Command list:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
def getinfo(buf):
i = buf.index(' ')
return int(buf[2:i]), int(buf[i+3:])
@hc0d3r
hc0d3r / system_call.c
Created April 16, 2018 14:31
linux x86_64 system call using shellcode
// author: @hc0d3r
// license: wtfpl
#include <asm/unistd_64.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
static const char syscall_sc[]=
"\x48\x89\xf8" // mov %rdi,%rax
@hc0d3r
hc0d3r / cpf.pl
Created January 26, 2018 01:04
gerador de cpf
my(@cpf, $sum);
push @cpf, int rand 10 foreach (2 .. 10);
map { $sum += $cpf[$_] * (reverse 2..10)[$_] } 0..8;
push @cpf, $sum * 10 % 11 % 10;
map { $sum += $_ } unpack('(A)10XA', join('', @cpf));
push @cpf, $sum * 10 % 11 % 10;
print join('', @cpf) . "\n";
section .text
global _start
_start:
call $+13
das
bound ebp,[ecx+0x6e]
das
dw 0x6873
db 0x00
xor eax, eax