-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflaginator.html
More file actions
40 lines (39 loc) · 1.3 KB
/
flaginator.html
File metadata and controls
40 lines (39 loc) · 1.3 KB
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
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>flaginator</title>
<link rel="stylesheet" href="">
</head>
<body>
<input type="text" id="prefix" value="flag" placeholder="flag">
<input type="text" id="string" placeholder="this is only a test flag!!" autofocus>
<button onclick="flaginate()">Flaginate</button>
<hr>
<p id="result">flag{TH15_IS_0nly_A_tEst_flag!!}</p>
<script type="text/javascript">
function flaginate_char(char) {
let substitutions = ["Aa4", "Bb", "Cc", "Dd", "Ee3", "Ff", "Gg", "Hh", "Ii1", "Jj", "Kk", "Ll", "Mm", "Nn", "Oo0", "Pp", "Qq", "Rr", "Ss5", "Tt", "Uu", "Vv", "Ww", "Xx", "Yy", "Zz2"];
for (var i = 0; i < substitutions.length; i++) {
if ( substitutions[i].indexOf(char) >= 0) {
return substitutions[i][Math.floor(Math.random() * substitutions[i].length)];
}
}
if ( char === " " || char === "_" ) {
return "_";
}
return char;
}
function flaginate() {
let prefix = document.getElementById("prefix").value;
let string = document.getElementById("string").value;
let result = "";
for (var i = 0; i < string.length; i++) {
result += flaginate_char(string[i]);
}
document.getElementById("result").innerHTML = prefix + "{" + result + "}";
}
</script>
</body>
</html>