IDK where I have been, but I never heard of this language until today. So, what’s the first thing you do when you learn about a language? You write a directory enumeration script with it.
Please disregard my horrible code, inability to follow Nim standards and philosophies, and the general hackiness of this code.
import httpclient import parseopt import strutils import system var p = initOptParser() var wordlist: string var url: string while true: p.next() case p.kind of cmdEnd: break of cmdShortOption, cmdLongOption: if p.key == "u": url = p.val if p.key == "w": wordlist = p.val of cmdArgument: echo "" let contents = readFile(wordlist) let words = contents.splitLines() var final_url: string var client = newHttpClient(timeout = 100) for i in 0 ..< words.len: final_url = url & "/" & words[i] try: let response = client.request(final_url, httpMethod = HttpGet) let status_code = response.status.split(' ') if status_code == "200": echo final_url except: echo ""
All this code does is take a url parameter and a wordlist parameter and makes http get requests to the url + wordlist entry – standard directory enumeration stuff. If the response code is 200, that url gets sent to stdout.
As time permits I’ll update this app. It’d be cool to have it much more feature complete like gobuster, wfuzz, et. al. For now, see the github respository for more information.