def main(): header() print ("Tor Ip Address :") a = readPage("https://check.torproject.org/") b = readPage("http://torlinkbgs6aabns.onion/") getMails(b) getLinks(b) print ("\n\n") return 0
def test_get_emails(): test_emails = ['*****@*****.**'] doc, tag, _, line = Doc().ttl() doc.asis('<!DOCTYPE html>') with tag('html'): with tag('body'): for email in test_emails: line('a', 'test_anchor', href=':'.join(('mailto', email))) mock_html = doc.getvalue() mock_soup = BeautifulSoup(mock_html, 'html.parser') emails = getemails.getMails(mock_soup) assert emails == test_emails
def main(): args = get_args() connect(args.ip, args.port) link = args.url # If flag is -v, --update, -q/--quiet then user only runs that operation # because these are single flags only if args.version: print("TorBot Version:" + __VERSION) exit() if args.update: updater.updateTor() exit() if not args.quiet: header() # If url flag is set then check for accompanying flag set. Only one # additional flag can be set with -u/--url flag if args.url: print("Tor IP Address :", pagereader.get_ip()) html_content, response = pagereader.read_first_page(link) print("Connection successful.") # -m/--mail if args.mail: emails = getemails.getMails(html_content) print(emails) if args.save: savefile.saveJson('Emails', emails) # -i/--info elif args.info: info.executeAll(link, html_content, response) if args.save: print('Nothing to save.\n') else: links = getweblinks.get_links(soup=html_content, live=args.live, ext=args.extension) if args.save: savefile.saveJson("Links", links) else: print("usage: torBot.py [-h] [-v] [--update] [-q] [-u URL] [-s] [-m]", "[-e EXTENSION] [-l] [-i]") print("\n\n")
def main(conn=False): if conn: connect(LOCALHOST, PORT) parser = argparse.ArgumentParser() parser.add_argument("-v", "--version", action="store_true", help="Show current version of TorBot.") parser.add_argument("--update", action="store_true", help="Update TorBot to the latest stable version") parser.add_argument("-q", "--quiet", action="store_true") parser.add_argument("-u", "--url", help="Specifiy a website link to crawl") parser.add_argument("-s", "--save", action="store_true", help="Save results in a file") parser.add_argument("-m", "--mail", action="store_true", help="Get e-mail addresses from the crawled sites") parser.add_argument("-e", "--extension", action='append', dest='extension', default=[], help=' '.join( ("Specifiy additional website extensions", "to the list(.com , .org etc)"))) parser.add_argument("-l", "--live", action="store_true", help="Check if websites are live or not (slow)") parser.add_argument("-i", "--info", action="store_true", help=' '.join(("Info displays basic info of the", "scanned site, (very slow)"))) args = parser.parse_args() link = args.url # If flag is -v, --update, -q/--quiet then user only runs that operation # because these are single flags only if args.version: print("TorBot Version:" + __VERSION) exit() if args.update: updater.updateTor() exit() if not args.quiet: header() # If url flag is set then check for accompanying flag set. Only one # additional flag can be set with -u/--url flag if args.url: print("Tor IP Address :", pagereader.get_ip()) html_content = pagereader.readPage(link, args.extension) # -m/--mail if args.mail: emails = getemails.getMails(html_content) print(emails) if args.save: savefile.saveJson('Emails', emails) # -i/--info elif args.info: info.executeAll(link) if args.save: print('Nothing to save.\n') else: links = getweblinks.getLinks(soup=html_content, live=args.live, ext=args.extension) if args.save: savefile.saveJson("Links", links) else: print( "usage: torBot.py [-h] [-v] [--update] [-q] [-u URL] [-s] [-m] [-e EXTENSION] [-l] [-i]" ) print("\n\n")
def test_get_emails_successful(): soup = pagereader.read_first_page('https://www.helloaddress.com/') test_emails = ["*****@*****.**"] emails = getemails.getMails(soup) assert emails == test_emails