Skip to content

Instantly share code, notes, and snippets.

@movEAX
movEAX / gist:7794950
Last active December 30, 2015 07:19
Hg 'commit' hook implementation for auto comment link of changeset to redmine./path/to/project/.hg/hgrc[hooks]commit.autocomment = python:path/to/script.py:comment_to_redmine[redmine]url = https://...key = note = some note https://.../changeset/{rev}
# coding: utf-8
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
# Stdlib
import os
import re
# 3rdparty
@movEAX
movEAX / demixer
Created March 6, 2014 19:06
demixer note
#!/usr/bin/env python3
import re
def demixer(iid, p):
return ''.join(re.findall(r'[\da-f]+',p)[::iid%1or-1])[::3]
if __name__ == '__main__':
print(demixer(291703670, 'b538f45188e082b038dad37e22466097861cef6sd4ff355e16dd279e973ddb1esce7adad83bb220e081s06fac1187c06a42'))
~
@movEAX
movEAX / gist:b8c9e6b83acc44dc5c80
Created June 15, 2014 21:12
Asyncio interactive subprocess communication, where subprocess is python script.
'''
test.py look like this::
msg = 'prompt'
for i in range(1, 4):
msg = input(msg * i + '\n')
'''
import sys
import asyncio
@movEAX
movEAX / ipython_load_django_model
Created July 11, 2014 20:59
Расширение для IPython, позволяющее подгружать модели на лету, без импортов.
from IPython import Magics, magics_class, line_magic
from django.db.models import get_model
@magics_class
class ModelSearchMagics(Magics):
@line_magic
def model(self, app_label, model_name):
model_class = get_model(app_label, model_name)
self.shell.user_ns[model_class.__name__] = model_class
@movEAX
movEAX / gist:d128a9602cf93e3dba2e
Created August 31, 2014 16:21
Postgresql: PL/Python trigger for logging row changes.
CREATE EXTENSION plpython2u;
-- TODO:
-- 1) Кэш соединения с ZMQ
-- 2) Найти оптимальный способ сериализаци данных
-- 3) Рассмотреть вариант с LISTEN/NOTIFY и PGQ
CREATE OR REPLACE FUNCTION row_trigger()
RETURNS TRIGGER
AS $$
import json, zmq
@movEAX
movEAX / gist:32740fc0d3c52e52a568
Created September 1, 2014 20:30
Поковырять под gdb
const int bufferSize = 32;
void first()
{
char buffer[bufferSize];
memset( buffer, 'A', sizeof( buffer ) );
}
void second()
{

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"

@movEAX
movEAX / gist:e4a0b1164b7a813ccd72
Created September 27, 2014 13:48
DHCP Shellshock
#!/usr/bin/perl
# largely purloined from http://www.perlmonks.org/?node_id=1093916 as my PoC for the old options overflow proved too messy^wPerlish to rework - [machine]
use strict;
use IO::Socket;
use Net::DHCP::Packet;
use Net::DHCP::Constants;
my $server_ip = "10.10.10.1";
@movEAX
movEAX / gist:f53d90c24f83071ed8cc
Last active August 29, 2015 14:17
Simple HLS player
# buggy - no sound
gst-launch-1.0 -v souphttpsrc location="http://hlsstr03.svc.iptv.rt.ru/hls/CH_2X2/variant.m3u8" ! hlsdemux ! tsdemux ! h264parse ! avdec_h264 ! autovideosink
#!/usr/bin/python
"""
Building (Python3.4):
> cython --embed window.pyx
> gcc -I/usr/include/python3.4m -o window -lpython3.4m -lpthread -lm -lutil -ldl
"""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import logging