Fixed errors with ports and exclusions. Also added in domain name compatibility.

This commit is contained in:
ProDigySML
2019-01-10 03:31:54 -08:00
parent 30e6b71c36
commit 1090f64018

View File

@@ -2,6 +2,7 @@ from argparse import ArgumentParser
from netaddr import IPNetwork, IPRange, IPGlob
from Interlace.lib.core.output import OutputHelper, Level
import os.path
from re import compile
class InputHelper(object):
@@ -96,6 +97,10 @@ class InputHelper(object):
target = target.replace(" ", "")
for ips in target.split(","):
# check if it is a domain name
if ips.split(".")[-1][0].isalpha():
targets.add(ips)
continue
# checking for CIDR
if not arguments.nocidr and "/" in ips:
targets.update(InputHelper._get_cidr_to_ips(ips))
@@ -113,6 +118,10 @@ class InputHelper(object):
exclusion = exclusion.replace(" ", "")
for ips in exclusion.split(","):
# check if it is a domain name
if ips.split(".")[-1][0].isalpha():
targets.add(ips)
continue
# checking for CIDR
if not arguments.nocidr and "/" in ips:
exclusions.update(InputHelper._get_cidr_to_ips(ips))
@@ -138,16 +147,24 @@ class InputHelper(object):
# replace flags
for command in commands:
tmp_command = command
for port in ports:
if arguments.port:
for port in ports:
command = tmp_command
command = str(command).replace("_target_", target)
command = str(command).replace("_host_", target)
if arguments.output:
command = str(command).replace("_output_", arguments.output)
command = str(command).replace("_port_", str(port))
if arguments.realport:
command = str(command).replace("_realport_", arguments.realport)
final_commands.add(command)
output.terminal(Level.VERBOSE, command, "Added after processing")
else:
command = tmp_command
command = str(command).replace("_target_", target)
command = str(command).replace("_host_", target)
if arguments.output:
command = str(command).replace("_output_", arguments.output)
if arguments.port:
command = str(command).replace("_port_", str(port))
if arguments.realport:
command = str(command).replace("_realport_", arguments.realport)
final_commands.add(command)
output.terminal(Level.VERBOSE, command, "Added after processing")