-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource
66 lines (48 loc) · 1.43 KB
/
source
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://natas.labs.overthewire.org/css/level.css">
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/jquery-ui.css" />
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/wechall.css" />
</head>
<body>
<h1>Argus CTF day</h1>
<div id="content">
<?
$encodedSecret = "3d3d516343746d4d6d6c315669563362";
function encodeSecret($secret) {
return bin2hex(strrev(base64_encode($secret)));
}
if(array_key_exists("submit", $_POST)) {
if(encodeSecret($_POST['secret']) == $encodedSecret) {
print "Access granted. The password for natas9 is <censored>";
} else {
print "Wrong secret";
}
}
?>
<form method=post>
Input secret: <input name=secret><br>
<input type=submit name=submit>
</form>
<div id="viewsource">
<button onclick="downloadFile()">Download Source Code</button>
</div>
<script>
function downloadFile() {
// Create a dummy link
var link = document.createElement("a");
// Set the href attribute to the file you want to download
link.href = "source";
// Specify the download attribute along with the desired file name
link.download = "source";
// Append the link to the document
document.body.appendChild(link);
// Trigger a click on the link to start the download
link.click();
// Remove the link from the document
document.body.removeChild(link);
}
</script>
</div>
</body>
</html>