Skip to content

Instantly share code, notes, and snippets.

View ysf's full-sized avatar
💭
writing jokes.

ysf ysf

💭
writing jokes.
View GitHub Profile
.text
.global _start
_start:
# setresuid() syscall
# Narnia FIX: Bash drop the setuid bit if EUID != RUID
# I need to call setresuid() to set a different RUID
xor %eax, %eax # Cleaning syscall number
@ysf
ysf / dns_server.py
Created September 11, 2017 10:58
requires python 3.5+ and dnslib, see https://github.com/samuelcolvin/dnserver for full/better implementation
from datetime import datetime
from time import sleep
from dnslib import DNSLabel, QTYPE, RD, RR
from dnslib import A, AAAA, CNAME, MX, NS, SOA, TXT
from dnslib.server import DNSServer
EPOCH = datetime(1970, 1, 1)
SERIAL = int((datetime.utcnow() - EPOCH).total_seconds())
@ysf
ysf / collector_transaction.rb
Created August 16, 2012 09:13 — forked from gravis/collector_transaction.rb
A secure event tracking system for online betting in France
# Copyright © 2010-2011 Tech-Angels. All Rights Reserved.
# CollectorTransaction will be created each time the Collector needs
# to trace an activity.
#
# Attributes:
# * id [integer, primary, not null] - primary key
# * before_tr [binary] - associated model serialized before transaction
# * created_at [datetime] - creation time
# * model_id [integer] - belongs_to Model (polymorphic)
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"