Skip to content

Instantly share code, notes, and snippets.

View dpogorzelski's full-sized avatar

Dawid Pogorzelski dpogorzelski

View GitHub Profile
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
function getRandomBytes (howMany) {
var fs= require('fs');
var bytes= new Buffer(howMany);
var fd= fs.openSync('/dev/random', 'r');
fs.readSync(fd, bytes, 0, howMany, null);
fs.closeSync(fd)
return bytes;
}
app.post('/api/foo', function (req, res) {
res.send(200);
});
app.post('/api/bar', function (req, res) {
res.send(200);
});
app.use(function (err, req, res, next) {
if (err.constructor.name === 'UnauthorizedError') {
upstream game{
server 127.0.0.1:4000;
}
server {
listen 80;
server_name game.haanto.com www.game.haanto.com;
# Gzip Compression
gzip on;
function spawn(m) {
var label = m.Id.match(/(^\w*)-/i)[1];
var p = game.add.sprite(m.X, m.Y, 'char');
p.animations.add('down', [0, 1, 2], 10);
p.animations.add('left', [12, 13, 14], 10);
p.animations.add('right', [24, 25, 26], 10);
p.animations.add('up', [36, 37, 38], 10);
p.label = game.add.text(m.X, m.Y - 10, label, style);
return p;
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
player.animations.play('left');
player.x -= 3;
var pos = JSON.stringify({
x: player.x
});
sock.send(pos);
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
player.animations.play('right');
function create() {
game.stage.backgroundColor = '#2d2d2d';
player = game.add.sprite(0, 0, 'char'); //spawning our player
player.animations.add('down', [0, 1, 2], 10); //adding animations
player.animations.add('left', [12, 13, 14], 10);
player.animations.add('right', [24, 25, 26], 10);
player.animations.add('up', [36, 37, 38], 10);
function preload() {
game.load.spritesheet('char', 'images/char01.png', 32, 48);
}
var player, //our player
players = {}, //this will hold the list of players
sock, //this will be player's ws connection
label,
style = {
font: "12px Arial",
fill: "#ffffff"
}, //styling players labels a bit
ip = "192.168.1.13"; //ip of our Go server
var game = new Phaser.Game(1024, 768, Phaser.AUTO, null, {
preload: preload,
create: create,
update: update
});