nmap: do not check for length of output
This commit is contained in:
parent
7bc24ca6fc
commit
dfbf0ba7ce
1 changed files with 12 additions and 16 deletions
28
guild2.py
28
guild2.py
|
@ -190,23 +190,19 @@ async def on_message(message):
|
||||||
if output.split("\n")[1][:6] == "Failed":
|
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!"))
|
mess = await message.reply(embed=guilded.Embed(title=":sweebot-fail: Command Failed!",description="Nmap failed to resolve the domain!"))
|
||||||
else:
|
else:
|
||||||
if len(output.split("\n")) < 8:
|
ending = False
|
||||||
mess = await message.reply(embed=guilded.Embed(title=":sweebot-unknown:",description="Nmap ran successfully, but the output is smaller than usual."))
|
for i, j in enumerate(output.split("\n")):
|
||||||
else:
|
if not ending:
|
||||||
ending = False
|
if j[:4] == "PORT":
|
||||||
for i, j in enumerate(output.split("\n")):
|
ending = True
|
||||||
if not ending:
|
pass
|
||||||
if j[:4] == "PORT":
|
else:
|
||||||
ending = True
|
temp = (re.sub(' +', ' ', j)).split(" ")
|
||||||
pass
|
print(temp)
|
||||||
|
if j != "":
|
||||||
|
ports.append(("🟢 " if temp[1] == "open" else "🔴 ") + temp[0] + " (" + temp[2] + ")")
|
||||||
else:
|
else:
|
||||||
temp = (re.sub(' +', ' ', j)).split(" ")
|
break
|
||||||
print(temp)
|
|
||||||
if j != "":
|
|
||||||
ports.append(("🟢 " if temp[1] == "open" else "🔴 ") + temp[0] + " (" + temp[2] + ")")
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
mess = await message.reply(embed=guilded.Embed(title=":sweebot-success: Found " + str(len(ports)) +" ports",description="\n".join(ports)))
|
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.")
|
print("[" + GREEN + "OK" + RESET + "] '$nmap' executed successfully.")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue