Skip to content

Instantly share code, notes, and snippets.

View suryadana's full-sized avatar

I Komang Suryadana suryadana

View GitHub Profile
from subprocess import Popen, PIPE
from time import sleep
import struct
proc = Popen(['gdb', 'ch16'], bufsize=1, stdin=PIPE)
def sendline(param):
proc.stdin.write(param+'\n')
sleep(2)

gdb ch14 -batch -ex 'disass main'

@suryadana
suryadana / .tmux.conf
Created May 3, 2018 09:14
My tmux configure
# change key binding from C-b to Emacs style C-x
unbind C-b
set -g prefix C-x
bind C-x send-prefix
# interface
#------------
# pane
#------------
set -g pane-border-fg black
@suryadana
suryadana / decorator_coroutine_asyncio.py
Last active May 17, 2018 05:19
I have stupid decorator for running your function with coroutine asyncio. Don't expect for the script, because it is script kiddie.
import asyncio
def static_async(method):
def wrapper(*args, **kwargs):
event = asyncio.new_event_loop()
asyncio.set_event_loop(event)
event.run_until_complete(method(*args, **kwargs))
event.close()
return wrapper
@suryadana
suryadana / decorator_check_func.py
Last active May 17, 2018 08:43
Check function speed Python
from datetime import datetime
def check_func(method):
def wrapper(*args, **kwargs):
t0 = datetime.now()
result = method(*args, **kwargs)
t1 = datetime.now()
print('Run with {:.16f} seccond'.format((t1-t0).total_seconds()))
return result
return wrapper
#!/bin/sh
# CVE-2016-1531 exim <= 4.84-3 local root exploit
# ===============================================
# you can write files as root or force a perl module to
# load by manipulating the perl environment and running
# exim with the "perl_startup" arguement -ps.
#
# e.g.
# [fantastic@localhost tmp]$ ./cve-2016-1531.sh
# [ CVE-2016-1531 local root exploit
@suryadana
suryadana / attribute value detect.js
Created May 23, 2018 09:47
Script for detect attribute value you can custome with callback function inside on mutation observer
$(document).ready(function(){
let list = document.querySelectorAll('.card-header');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
let observer = new MutationObserver(function(mutations) {
let mutation = mutations[0]
let element = $(mutation.target)
if (element.attr('aria-expanded') === 'true'){
element.removeClass('bg-white').css('background-color', '#f58508')
}else{
element.addClass('bg-white')
/*
* cve-2009-1185.c
*
* udev < 141 Local Privilege Escalation Exploit
* Jon Oberheide <[email protected]>
* http://jon.oberheide.org
*
* Information:
*
* http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-1185
@suryadana
suryadana / template_systemd.service
Created May 26, 2018 03:55
Run your script with systemd on linux
# Copy to /etc/systemd/system/ this script and change ExecStart value.
After=syslog.target network.target
[Service]
ExecStart=/usr/bin/python /path/of/script/main.py
Restart=on-abort
[Install]
WantedBy=multi-user.target
#!/bin/sh
# Linux 2.6
# bug found by Sebastian Krahmer
#
# lame sploit using LD technique
# by kcope in 2009
# tested on debian-etch,ubuntu,gentoo
# do a 'cat /proc/net/netlink'
# and set the first arg to this
# script to the pid of the netlink socket