def geolocate_host(host): host = host api = f'http://ip-api.com/json/{host}' info = 'status,country,regionName,city,zip,lat,lon,isp,as,org' data = {'fields': info} def requesting(host): request = get(api, data=data) json_request = json.loads(request.content) return json_request info = info.split(',') table = """{}\ +--------------------------------------+ |FIELD | CONTENT| |--------------------------------------| {}+--------------------------------------+\ """ try: chain = "" for i in info: extract = requesting(host)[i] text = "|{3}{0:<15}{2} >> {4}{3}{1:>19}{2}|\n".format(i, extract, cyan, bold, green) chain += text formatted_table = table.format(cyan, chain) + '\n' return(formatted_table) except KeyError: cprint("[!] geolocate >> Unknown address\n", 'red', True)
def write_output(self, Scanner, result): from config.colors import white, blue, bold, normal from config.functions import sep_nmap_states, cprint if '!raw' in self.parameters: print(f'{white}{Scanner.csv()}\n') else: table = """\ >> SCAN RESULTS FROM {} << {} \ """ try: ports = Scanner[self.target].all_tcp() except KeyError: return (cprint( "[!] portscanner >> Please specify a port range\n", 'yellow')) table_chain = "" #print(ports) for port in ports: port_service = Scanner[self.target]['tcp'][port]['name'] port_state = Scanner[self.target]['tcp'][port]['state'] port_state = sep_nmap_states(port_state) # - Each line in output table - # add_string = "{0}{1}[-]{2} Discovered {3}{2} port on {4}, running {5}\n".format( blue, bold, normal, port_state, port, port_service) table_chain += add_string print(white + table.format(self.target, table_chain))
def getbyhostdns(hostscan): host = hostscan port = None if ':' in host: entry = host.split(':') host = str(entry[0]) port = int(entry[1]) if not port: port = 25565 try: request = dns.resolver.query(f'_minecraft._tcp.{host}', 'SRV') if len(request): get_request = request[0] host = str(get_request.target).rstrip('.') port = int(get_request.port) except dns.resolver.NXDOMAIN: return (cprint("[!] gethost >> DNS query doesn't exist\n", 'red', True)) return (print("{2}{3}[-] {2}Done! {3}'{0}'{2} >> {3}{1}\n".format( hostscan, socket.gethostbyname(host), cyan, bold)))
def getbyhost(host): try: hostIP = socket.gethostbyname(host) return (print("{2}{3}[-]{2} Done! {3}{0}{2} >> {3}{1}\n".format( host, hostIP, cyan, bold))) except socket.gaierror: return (cprint("[!] gethost >> Unknown host\n", 'red', True))
def port_lookup(self): import nmap from config.functions import cprint from config.colors import yellow, bold, normal print("{0}{1}[~] {0}Scanning {1}{2}{0} . . .\n".format( yellow, bold, self.target)) # - Scanning target - # Scanner = nmap.PortScanner() nmap_flags = Flags.get_nmap_flags(self.parameters) try: result = Scanner.scan(self.target, self.port_range, f'-sV {nmap_flags}') except Exception as e: return (cprint(f"[!] portscanner >> Something went wrong: '{e}'\n", 'red', True)) # - Formatting output - # self.write_output(Scanner, result) # - Special flags - # get_flags = Flags(self.parameters, self.target) get_flags.execute_flag(Scanner)
#!/usr/bin/python3 #_*_ coding:utf8 _*_ from config.functions import cprint, import_nmap from config.shell import Shell from sys import exit import_nmap() try: if __name__ == '__main__': shell_object = Shell() shell_object.cmdloop() except KeyboardInterrupt: exit(cprint("[!] CTRL-C Interrupt, leaving . . .\n", 'red', True))
___ ___| |_ _ _ _ __ / __|/ _ \ __| | | | '_ \ \__ \ __/ |_| |_| | |_) | |___/\___|\__|\__,_| .__/ 1.0| | |_|{2}{3}[{1}mc_git.py{2}{3}]""".format( green, bold, normal, cyan) + '\n') print("{0}{1}[-] >~ {2}Welcome to mc_git setup {0}{1}~< [-]".format( green, bold, white)) print("{1}{2}[{1}setup{2}] >> {3}Requirements to install >> {0}\n".format( requirements, cyan, bold, white)) install = input("[{0}{1}?{2}] {0}{1}Install? {2}y/n: ".format( black, bold, normal)) if install != 'y': exit(cprint("[!] Aborting . . .\n", 'red', True)) else: cprint("[setup] Installing . . .\n", 'cyan', True) # - Installing requirements - # system("pip3 install -q python-nmap") social_media = """ [{1}{0}GitHub{2}] catsploit [{3}{0}Instagram{2}] @catsploit [{4}{0}Telegram{2}] @catsploit\n""".format(bold, black, normal, magenta, cyan) print(f'Support: {social_media}') run = input("{0}{1}[+] {0}Set-up, run mc_git.py? y/n: {2}".format( green, bold, normal)) if run != 'y':