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":
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue