Merge branch 'master' of https://www.github.com/plane000/examples
This commit is contained in:
118
JavaScript/Part2-CTF-JS/challenge.html
Normal file
118
JavaScript/Part2-CTF-JS/challenge.html
Normal file
File diff suppressed because one or more lines are too long
74
JavaScript/Part2-CTF-JS/index.html
Normal file
74
JavaScript/Part2-CTF-JS/index.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Professional data safe</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function x(g) {
|
||||
console.log(g);
|
||||
|
||||
let success = 1;
|
||||
let res = [];
|
||||
g.split('').forEach((c) => {
|
||||
let i = alphabet.indexOf(c);
|
||||
if (i == -1) success = -1;
|
||||
res.push(i);
|
||||
});
|
||||
if (success == -1) return false;
|
||||
|
||||
let compare = "";
|
||||
res.forEach((c) => {
|
||||
compare += c;
|
||||
});
|
||||
|
||||
let result = computeChecksum(parseInt(compare));
|
||||
|
||||
if (result == 2.1853534282531312e+48) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
let alphabet = "abcdefghijklmnoqrstuvwxyz1234567890{}-";
|
||||
|
||||
function computeChecksum(num) {
|
||||
|
||||
num = Math.floor(Math.abs(num));
|
||||
|
||||
if (num < 10) {
|
||||
return num;
|
||||
}
|
||||
|
||||
let divisor = Math.pow(10, num.toString().length);
|
||||
let checksum = 0;
|
||||
|
||||
while (divisor >= 10) {
|
||||
let quotient = Math.floor(num / divisor);
|
||||
let divisorAsString = divisor.toString();
|
||||
|
||||
checksum += quotient;
|
||||
num -= quotient * divisor;
|
||||
|
||||
divisor = divisorAsString.slice(0, divisorAsString.length - 1);
|
||||
}
|
||||
|
||||
return checksum + num;
|
||||
}
|
||||
|
||||
function check(a) {
|
||||
localStorage.content = "pwwd24ctf189HIhi"
|
||||
k = document.getElementById("keyhole");
|
||||
a = document.getElementById("access");
|
||||
if (!x(k.value)) return a.innerHTML = "access denied"
|
||||
a.innerHTML = "access granted"
|
||||
password = Array.from(k.value).map(c => c.charCodeAt());
|
||||
encrypted = localStorage.content || '';
|
||||
}
|
||||
|
||||
</script>
|
||||
password: <input id="keyhole" type="text" autofocus onchange="check()" placeholder="🔑">
|
||||
<div id="access"></div>
|
||||
</body>
|
||||
</html>
|
||||
17
JavaScript/Part2-CTF-JS/text.txt
Normal file
17
JavaScript/Part2-CTF-JS/text.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
***HELLO AND WELCOME TO PART 2 OF THE 4 PART CTF***
|
||||
|
||||
*you don't need to have completed part 1 to do this but in order to win you must have done all 4*
|
||||
|
||||
CTF:
|
||||
Same deal with last time, this is a javascript safe that i cba to write a backstory for, the flag is still in the format `/ctf{.*}/`.
|
||||
|
||||
Winners will be awarded a special role
|
||||
On completion send the flag to Ben
|
||||
|
||||
**RULES:**
|
||||
|
||||
0) DO NOT SHARE THE FLAG
|
||||
1) Use any method you see fit to solve it, if it works you reverse engeneered it :)
|
||||
|
||||
Have fun :)))))
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Professional data safe</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
x = () => {
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
check = (a) => {
|
||||
localStorage.content = "pwwd24ctf189HIhi"
|
||||
k = document.getElementById("keyhole");
|
||||
a = document.getElementById("access");
|
||||
if (!x(k.value)) return a.innerHTML = "access denied"
|
||||
a.innerHTML = "access granted"
|
||||
password = Array.from(k.value).map(c => c.charCodeAt());
|
||||
encrypted = localStorage.content || '';
|
||||
content = encrypted.map((c, x) => c ^ password[i % k.value.length]).map(String.fromCharCode).join('');
|
||||
}
|
||||
</script>
|
||||
password: <input id="keyhole" type="text" autofocus onchange="check()" placeholder="🔑">
|
||||
<div id="access"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user