Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
from sys import argv
from taser.proto.http.spider import Spider
from taser.proto.http import extract_subdomain
from taser.logx import setup_consoleLogger
class MySpider(Spider):
def __init__(self, url):
Spider.__init__(self, url)
self.ur = url
def outputHandler(self, url, src_url):
subdomain = extract_subdomain(url).lower()
if url.startswith('mailto'):
logger.info('{} => {}'.format(src_url, url), bullet='[EMAIL] ', fg='green')
elif self.base_domain in subdomain:
if self.base_subdomain != subdomain:
logger.info('{} => {}'.format(src_url, url), bullet='[SUBDOMAIN] ', fg='red')
else:
logger.info('{} => {}'.format(src_url, url), bullet='[URL] ', fg='blue')
else:
logger.info('{} => {}'.format(src_url, url), bullet='[EXTERNAL-URL] ', fg='purple')
if __name__ == '__main__':
target = argv[1]
logger = setup_consoleLogger()
x = MySpider(target)
x.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment