Skip to content

Instantly share code, notes, and snippets.

View XVilka's full-sized avatar
💭
Rusting

Anton Kochkov XVilka

💭
Rusting
View GitHub Profile
@johanndt
johanndt / upgrade-postgres-9.3-to-9.5.md
Last active July 15, 2022 12:35 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
diff --git a/colour.c b/colour.c
index a56ddce..8098f83 100644
--- a/colour.c
+++ b/colour.c
@@ -29,305 +29,85 @@
* of the 256 colour palette.
*/
-struct colour_rgb {
- u_char i;
@bnagy
bnagy / gpgmutt.md
Last active March 30, 2024 07:52
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well

radare2 is a very cool set of tools that you probably don't know how to use! Let's go through a simple exploit CTF challenge to understand how to use it for exploit development.

We'll be focusing on "ropasaurus rex" which is a simple challenge from Plaid CTF After checking out the latest and greatest radare from git, let's get started!

Open up ropasaurusrex in r2 and call analyze on the binary. We can list the functions with "afl"

@atheriel
atheriel / macroexpand.c
Last active January 20, 2018 07:58
Can one write a Python extension in Rust?
PyObject * RustPy_InitModule(const char *name, PyMethodDef *methods, const char *doc) {
// return Py_InitModule4(name, methods, doc, (PyObject *) NULL, PYTHON_API_VERSION);
return Py_InitModule3(name, methods, doc);
}
@pastcompute
pastcompute / gist:8b3788b9263c515a3d97
Created June 19, 2014 11:41
Radare2 macro (work in progress) for string scanning a stripped / embedded MIPS binary for strings
# Assumes strings are referenced downwards from the top of a segment
# e.g - set
f string_end @ 0x80620000
# then addui a0,a0,-12288 <-- string is at 0x8061d000
# This used to add a comment with the text but that broke recently
# So now it adds a comment String_addressofstring
# It adds a xref mut I am still perfecting that
RARVM reversible/patchme
Modified 'unrar' source to dump context and disassembly.
Wrote two separate solvers since the challenge was broken.
To build the disassembler/debugger:
- unzip unrar-src-disassembler.zip -d unrar
- cd unrar
@hugsy
hugsy / QuickTip1.md
Last active June 18, 2020 22:29
Using new syscalls to bypass ptrace-protected process and read/write arbitrary memory.

Even though well known methods exist to bypass ptrace deactivation on a process when spawning (fake ptrace() preloading, breakpoint on ptrace(), etc... ), it is trickier when process is already protected.

Thankfully Linux 3.2+ was generous enough to provide read/write capabilities to another process with 2 new system calls: sys_process_vm_readv and sys_process_vm_writev. (see https://github.com/torvalds/linux/blob/master/arch/x86/syscalls/syscall_64.tbl#L319)

Manual says:

These system calls transfer data between the address space of the calling

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results