Skip to content

Instantly share code, notes, and snippets.

@Crinfarr
Last active September 3, 2024 20:25
Show Gist options
  • Select an option

  • Save Crinfarr/dd38f44ec811befdf0a8a1f053a4a1c4 to your computer and use it in GitHub Desktop.

Select an option

Save Crinfarr/dd38f44ec811befdf0a8a1f053a4a1c4 to your computer and use it in GitHub Desktop.
Parses the output of masscan [...] -oL - --banners | grep banner
#!/usr/bin/env python3
hook = ""# YOUR CHANNEL HOOK HERE
from discord_webhook import DiscordWebhook, DiscordEmbed
wh = DiscordWebhook(hook)
for line in input():
[_, tcudp, port, ip, ts, stype] = line.split(' ')
if stype == "X509":
continue # All HTTPS servers send SSL -> X509 so we only care about one
banner = ' '.join(line.split(' ')[6:])
embed = DiscordEmbed()
embed.set_title(f'Discovered open {tcudp} port')
embed.set_description(f'{stype} server discovered at {"http://" if stype == "http" else "https://" if stype=="SSL" else ""}{ip}:{port}. {"cert" if stype == "ssl" else "banner"}:```\n{banner}\n```')
embed.set_timestamp(int(ts))
wh.add_embed(embed)
wh.execute(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment