This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) | |
| # The author disclaims copyright to this source code. | |
| import sys | |
| import struct | |
| import socket | |
| import time | |
| import select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| upstream game{ | |
| server 127.0.0.1:4000; | |
| } | |
| server { | |
| listen 80; | |
| server_name game.haanto.com www.game.haanto.com; | |
| # Gzip Compression | |
| gzip on; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function preload() { | |
| game.load.spritesheet('char', 'images/char01.png', 32, 48); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var game = new Phaser.Game(1024, 768, Phaser.AUTO, null, { | |
| preload: preload, | |
| create: create, | |
| update: update | |
| }); |