Last active
May 25, 2017 16:15
-
-
Save BlackVikingPro/65a675b335f00cf13c616c178c24d1c5 to your computer and use it in GitHub Desktop.
ServerDoXXy - Server DoXing Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" !- ServerDoXXy - Server DoXing Tool ~ By: Willy Fox - @BlackVikingPro -! """ | |
import sys, time, socket | |
import os, argparse, subprocess | |
parser = argparse.ArgumentParser(description='!- ServerDoXXy - Server DoXing Tool ~ By: Willy Fox - @BlackVikingPro -!') | |
config = parser.add_argument_group('Configuration:') | |
config.add_argument('-s', '--server', help='Target server\'s ip/hostname', required=False) | |
config.add_argument('-l', '--list', help='List of server\'s to DoX [not required if server was defined]', required=False) | |
config.add_argument('-o', '--output', help='Output file to log DoX\'s into', required=False) | |
config.add_argument('-v', '--verbose', help='Enable verbose output', action='store_true', required=False) | |
args = parser.parse_args() | |
if not args.list: | |
if not args.server: | |
parser.error('Please define either a specific server or list of server\'s to DoX') | |
pass | |
pass | |
if args.output: | |
with open(args.output, 'w') as f: | |
f.truncate() | |
pass | |
pass | |
class console: | |
@staticmethod | |
def info(message): | |
print ( "\n\033[92m [+] \033[93m%s\033[0m\n " % message ) | |
pass | |
@staticmethod | |
def warn(message): | |
print ( "\n\033[95m [i] \033[93m%s\033[0m\n " % message ) | |
pass | |
@staticmethod | |
def error(message): | |
print ( "\n \033[93m[-] \033[91m%s\033[0m\n" % message ) | |
pass | |
pass | |
def curl(url): | |
command = 'curl -s %s' % url | |
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read() | |
def doxx(server): | |
server = server.translate(None, '/') | |
if ':' in server: | |
server = server[(server.index(':') + 1):] | |
pass | |
try: | |
socket.inet_aton(server) # valid | |
pass | |
except socket.error: | |
server = socket.gethostbyname(server) # invalid, let's grab the ipv4 | |
except Exception as e: | |
print e | |
pass | |
return curl("ipinfo.io/%s" % server) | |
pass | |
def formatDoX(server, color): | |
if color == True: | |
dox_contents = "\n\033[92m== DoX of [ %s ] ==\n\033[0m" % server | |
dox_contents += "\033[95m" + doxx(server) + "\033[0m" | |
dox_contents += "\n\033[93m== End DoX of [ %s ] ==\n\033[0m" % server | |
pass | |
elif color == False: | |
dox_contents = "\n== DoX of [ %s ] ==\n" % server | |
dox_contents += doxx(server) | |
dox_contents += "\n== End DoX of [ %s ] ==\n" % server | |
pass | |
return dox_contents | |
pass | |
if __name__ == '__main__': | |
if args.list: | |
with open(args.list) as f: | |
serverlist = f.readlines() | |
serverlist = [x.strip() for x in serverlist] | |
pass | |
for server in serverlist: | |
if server != "": | |
if args.output != None: | |
with open(args.output, "a") as output_file: | |
output_file.write(formatDoX(server, False)) | |
pass | |
console.info("%s's DoX has been written to [ %s ]." % (server, args.output)) | |
pass | |
else: | |
print formatDoX(server, True) | |
pass | |
pass | |
pass | |
pass | |
elif args.server: | |
if args.output != None: | |
with open(args.output, "a") as output_file: | |
output_file.write(formatDoX(args.server, False)) | |
pass | |
console.info("%s's DoX has been written to [ %s ]." % (args.server, args.output)) | |
pass | |
else: | |
print formatDoX(args.server, True) | |
pass | |
pass | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment