def __init__(self): try: import argparse self.argparser = argparse.ArgumentParser(add_help=False) except ImportError: self.argparser = utils.FakeArgparserParent() self.argparser.add_argument( '--category', metavar='CAT', help='show only results from this category') self.argparser.add_argument( '--country', metavar='CODE', help='show only results from this country') self.argparser.add_argument( '--asnum', metavar='NUM[,NUM[...]]', help='show only results from this(those) AS(es)') self.argparser.add_argument( '--asname', metavar='NAME', help='show only results from this(those) AS(es)') self.argparser.add_argument('--source', metavar='SRC', help='show only results from this source') self.argparser.add_argument('--version', metavar="VERSION", type=int) self.argparser.add_argument('--timeago', metavar='SECONDS', type=int) self.argparser.add_argument('--host', metavar='IP') self.argparser.add_argument('--hostname') self.argparser.add_argument('--domain') self.argparser.add_argument('--net', metavar='IP/MASK') self.argparser.add_argument('--range', metavar='IP', nargs=2) self.argparser.add_argument('--hop', metavar='IP') self.argparser.add_argument('--port', metavar='PORT') self.argparser.add_argument('--not-port', metavar='PORT') self.argparser.add_argument('--openport', action='store_true') self.argparser.add_argument('--no-openport', action='store_true') self.argparser.add_argument('--countports', metavar='COUNT', help='show only results with a number of open ' 'ports within the provided range', nargs=2) self.argparser.add_argument('--no-countports', metavar='COUNT', help='show only results with a number of open ' 'ports NOT within the provided range', nargs=2) self.argparser.add_argument('--service', metavar='SVC') self.argparser.add_argument('--script', metavar='ID[:OUTPUT]') self.argparser.add_argument('--hostscript', metavar='SCRIPT') self.argparser.add_argument('--svchostname') self.argparser.add_argument('--os') self.argparser.add_argument('--anonftp', action='store_true') self.argparser.add_argument('--anonldap', action='store_true') self.argparser.add_argument('--authhttp', action='store_true') self.argparser.add_argument('--authbypassvnc', action='store_true') self.argparser.add_argument('--ypserv', '--nis', action='store_true') self.argparser.add_argument('--nfs', action='store_true') self.argparser.add_argument('--x11', action='store_true') self.argparser.add_argument('--xp445', action='store_true') self.argparser.add_argument('--owa', action='store_true') self.argparser.add_argument('--vuln-boa', '--vuln-intersil', action='store_true') self.argparser.add_argument('--torcert', action='store_true') self.argparser.add_argument('--sshkey', metavar="FINGERPRINT") self.argparser.add_argument('--archives', action='store_true')
def __init__(self): try: import argparse self.argparser = argparse.ArgumentParser(add_help=False) USING_ARGPARSE = True except ImportError: self.argparser = utils.FakeArgparserParent() USING_ARGPARSE = False self.argparser.add_argument( '--category', metavar='CAT', help='show only results from this category') self.argparser.add_argument('--country', metavar='CODE', help='show only results from this country') self.argparser.add_argument( '--asnum', metavar='NUM[,NUM[...]]', help='show only results from this(those) AS(es)') self.argparser.add_argument( '--asname', metavar='NAME', help='show only results from this(those) AS(es)') self.argparser.add_argument('--source', metavar='SRC', help='show only results from this source') self.argparser.add_argument('--version', metavar="VERSION", type=int) self.argparser.add_argument('--timeago', metavar='SECONDS', type=int) if USING_ARGPARSE: self.argparser.add_argument('--id', metavar='ID', help='show only ' 'results with this(those) ID(s)', nargs='+') self.argparser.add_argument('--no-id', metavar='ID', help='show ' 'only results WITHOUT this(those) ' 'ID(s)', nargs='+') else: self.argparser.add_argument('--id', metavar='ID', help='show only ' 'results with this ID') self.argparser.add_argument('--no-id', metavar='ID', help='show ' 'only results WITHOUT this ID') self.argparser.add_argument('--host', metavar='IP') self.argparser.add_argument('--hostname') self.argparser.add_argument('--domain') self.argparser.add_argument('--net', metavar='IP/MASK') self.argparser.add_argument('--range', metavar='IP', nargs=2) self.argparser.add_argument('--hop', metavar='IP') self.argparser.add_argument('--port', metavar='PORT') self.argparser.add_argument('--not-port', metavar='PORT') self.argparser.add_argument('--openport', action='store_true') self.argparser.add_argument('--no-openport', action='store_true') self.argparser.add_argument( '--countports', metavar='COUNT', help='show only results with a number of open ' 'ports within the provided range', nargs=2) self.argparser.add_argument( '--no-countports', metavar='COUNT', help='show only results with a number of open ' 'ports NOT within the provided range', nargs=2) self.argparser.add_argument('--service', metavar='SVC') self.argparser.add_argument( '--label', metavar='GROUP[:TAG]', help='retrieve host labeled with TAG ' 'in GROUP, if TAG is not provided, retrieve ' 'hosts with at least one TAG in GROUP') self.argparser.add_argument( '--no-label', metavar='GROUP[:TAG]', help='retrieve host WITHOUT the label TAG ' 'in GROUP, if TAG is not provided, retrieve ' 'hosts WITHOUT any tag in GROUP') self.argparser.add_argument('--script', metavar='ID[:OUTPUT]') self.argparser.add_argument('--svchostname') self.argparser.add_argument('--os') self.argparser.add_argument('--anonftp', action='store_true') self.argparser.add_argument('--anonldap', action='store_true') self.argparser.add_argument('--authhttp', action='store_true') self.argparser.add_argument('--authbypassvnc', action='store_true') self.argparser.add_argument('--ypserv', '--nis', action='store_true') self.argparser.add_argument('--nfs', action='store_true') self.argparser.add_argument('--x11', action='store_true') self.argparser.add_argument('--xp445', action='store_true') self.argparser.add_argument('--owa', action='store_true') self.argparser.add_argument('--vuln-boa', '--vuln-intersil', action='store_true') self.argparser.add_argument('--torcert', action='store_true') self.argparser.add_argument('--sshkey', metavar="FINGERPRINT") self.argparser.add_argument('--archives', action='store_true')
# # You should have received a copy of the GNU General Public License # along with IVRE. If not, see <http://www.gnu.org/licenses/>. """This sub-module is responsible for generating Nmap options.""" from ivre import config import shlex try: import argparse argparser = argparse.ArgumentParser(add_help=False) USING_ARGPARSE = True except ImportError: from ivre import utils argparser = utils.FakeArgparserParent() USING_ARGPARSE = False if USING_ARGPARSE: argparser.add_argument('--nmap-template', help="Select Nmap scan template", choices=config.NMAP_SCAN_TEMPLATES, default="default") NMAP_OPT_PORTS = { None: [], 'fast': ['-F'], 'more': ['--top-ports', '2000'], 'all': ['-p', '-'], }