반응형
코드게이트 2016 주니어 JS_is_not_a_jail
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | function challenge100 (arr) { var random_value = "ac1a39300ce7ee8b6cff8021fd7b0b5caf5bc1c316697bd8f22e00f9fab710d6b8dba23ca80f6d80ca697e7aa26fd5f6"; var check = "20150303"; if((arr === null || arr === undefined)) { print("arr is null or undefined."); return; } if(!arr.hasOwnProperty('length')) { print("length property is null or undefined."); return; } if(arr.length >= 0) { print("i think you're not geek. From now on, a GEEK Only!"); return; } if(Object.getPrototypeOf(arr) !== Array.prototype) { print("Oh.... can you give me an array?"); return; } var length = check.length; for(var i=0;i<length;i++) { arr[i] = random_value[Math.floor(Math.random() * random_value.length)]; } for(i=0;i<length;i++) { if(arr[i] !== check[i]) { print("Umm... i think 2015/03/03 is so special day.\nso you must set random value to 20150303 :)"); return; } } print("Yay!!"); print(flag); } | cs |
JS challenge 내용이다.
Array 함수 내용이면서 내용이 0미만이어야 하는데
그냥 함수를 만들면 된다.
또한 렌덤함수로 인해 20150303을 맞출 수 없는데
이때도 그냥 함수를 만들면 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function Array() { this.length=-1;} function math(){ this.test=-1; this.random = function(){return 1;}; this.floor = function(x){ this.test+=1; if(this.test==0) return 22; if(this.test==1) return 7; if(this.test==2) return 2; if(this.test==3) return 30; if(this.test==4) return 7; if(this.test==5) return 4; if(this.test==6) return 7; if(this.test==7) return 4; }; } var Math=new math(); var test = new Array(); challenge100(test); | cs |
'CTF' 카테고리의 다른 글
PlaidCTF 2016 quick (0) | 2016.04.18 |
---|---|
CodeGate 2016 Junior BugBug (0) | 2016.03.20 |
CodeGate 2016 Junior MICCheck (0) | 2016.03.19 |
DIMICON Write Up (0) | 2015.11.13 |
2015 정보보호올림피아드 본선 Q2 (0) | 2015.10.18 |