1
0
Fork 0

nmap: do not check for length of output

This commit is contained in:
Swee 2024-11-09 14:48:51 -08:00
parent 7bc24ca6fc
commit dfbf0ba7ce

View file

@ -190,23 +190,19 @@ async def on_message(message):
if output.split("\n")[1][:6] == "Failed":
mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Command Failed!",description="Nmap failed to resolve the domain!"))
else:
if len(output.split("\n")) < 8:
mess = await message.reply(embed=guilded.Embed(title=":sweebot-unknown:",description="Nmap ran successfully, but the output is smaller than usual."))
else:
ending = False
for i, j in enumerate(output.split("\n")):
if not ending:
if j[:4] == "PORT":
ending = True
pass
ending = False
for i, j in enumerate(output.split("\n")):
if not ending:
if j[:4] == "PORT":
ending = True
pass
else:
temp = (re.sub(' +', ' ', j)).split(" ")
print(temp)
if j != "":
ports.append(("🟢 " if temp[1] == "open" else "🔴 ") + temp[0] + " (" + temp[2] + ")")
else:
temp = (re.sub(' +', ' ', j)).split(" ")
print(temp)
if j != "":
ports.append(("🟢 " if temp[1] == "open" else "🔴 ") + temp[0] + " (" + temp[2] + ")")
else:
break
break
mess = await message.reply(embed=guilded.Embed(title=":sweebot-success: Found " + str(len(ports)) +" ports",description="\n".join(ports)))
print("[" + GREEN + "OK" + RESET + "] '$nmap' executed successfully.")
else: