当前位置: 首页>>代码示例>>Python>>正文


Python Utils.getIP方法代码示例

本文整理汇总了Python中utils.Utils.getIP方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.getIP方法的具体用法?Python Utils.getIP怎么用?Python Utils.getIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.Utils的用法示例。


在下文中一共展示了Utils.getIP方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def __init__(self):
        self.config = {}        # dict to contain combined list of config file options and commandline parameters
        self.email_list = []    # list of email targets
        self.webserver = None   # web server process

        # initialize some config options
        self.config["domain_name"] = ""
        self.config["company_name"] = ""
        self.config["config_filename"] = ""
        self.config["email_list_filename"] = ""

        # default all bool values to False
        self.config["verbose"] = False
        self.config["gather_emails"] = False
        self.config["enable_externals"] = False
        self.config["enable_web"] = False
        self.config["enable_email"] = False
        self.config["enable_email_sending"] = False
        self.config["simulate_email_sending"] = False
        self.config["daemon_web"] = False
        self.config["always_yes"] = False


        # get current IP
        self.config['ip'] = Utils.getIP()

        # set a few misc values
        self.pid_path = os.path.dirname(os.path.realpath(__file__)) + "/../"
        self.display = Display()
        self.email_templates = defaultdict(list)
开发者ID:Sh3llSh0ck3d,项目名称:SPF,代码行数:32,代码来源:framework.py

示例2: __init__

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def __init__(self):
        self.display = Display()
        self.modulelock = RLock()

        self.inputModules = {}
        self.actionModules = {}
        self.reportModules = {}

        self.progName = "APT2"
        self.version = "None"
        try:
            self.version = pkg_resources.get_distribution("apt2").version
        except:
            None

        if Utils.isReadable('VERSION'):
            version_pattern = "'(\d+\.\d+\.\d+[^']*)'"
            self.version = re.search(version_pattern, open('VERSION').read()).group(1)

        self.isRunning = True  # Conditional to check if user wants to quit

        self.inputs = {}

        self.config = {}

        self.config["homeDir"] = expanduser("~")
        self.config["outDir"] = self.config["homeDir"] + "/.apt2/"
        self.config["reportDir"] = ""
        self.config["logDir"] = ""
        self.config["proofsDir"] = ""
        self.config["tmpDir"] = ""
        self.config["pkgDir"] = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/"
        self.config["miscDir"] = ""
        self.config['lhost'] = Utils.getIP()

        self.setupDirs()

        # initialize some config options
        self.config["config_filename"] = ""

        # default all bool values to False
        self.config["verbose"] = False
        self.config["always_yes"] = False
        self.config["list_modules"] = False

        self.config["scan_target"] = None
        self.config["scan_target_list"] = None

        self.config["safe_level"] = 4
        self.config["exclude_types"] = ""

        # make temp file for the KB save file
        self.kbSaveFile = self.config["proofsDir"] + "KB-" + Utils.getRandStr(10) + ".save"

        self.threadcount_thread = None
        self.keyevent_thread = None

        self.allFinished = False
开发者ID:MooseDojo,项目名称:apt2,代码行数:60,代码来源:framework.py

示例3: __init__

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def __init__(self):
        self.display = Display()
        self.modulelock = RLock()

        self.inputModules = {}
        self.actionModules = {}
        self.reportModules = {}

        self.progName = "APT2"
        self.version = "error"
        self.isRunning = True  # Conditional to check if user wants to quit

        self.inputs = {}

        self.config = {}

        self.config["outDir"] = os.getcwd() + "/"
        self.config["reportDir"] = ""
        self.config["logDir"] = ""
        self.config["proofsDir"] = ""
        self.config["tmpDir"] = ""
        self.config["miscDir"] = ""
        self.config['lhost'] = Utils.getIP()

        self.setupDirs()

        # initialize some config options
        self.config["config_filename"] = ""

        # default all bool values to False
        self.config["verbose"] = False
        self.config["always_yes"] = False
        self.config["list_modules"] = False

        self.config["scan_target"] = None
        self.config["scan_target_list"] = None

        self.config["safe_level"] = 4

        # make temp file for the KB save file
        self.kbSaveFile = self.config["proofsDir"] + "KB-" + Utils.getRandStr(10) + ".save"

        self.threadcount_thread = None
        self.keyevent_thread = None

        self.allFinished = False
开发者ID:HMSH00D,项目名称:apt2,代码行数:48,代码来源:framework.py

示例4: __init__

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def __init__(self):
        self.config = {}  # dict to contain combined list of config file options and commandline parameters
        self.email_list = []  # list of email targets
        self.hostname_list = []  # list of dns hosts
        self.server_list = {}
        self.profile_valid_web_templates = []
        self.profile_dynamic_web_templates = []
        self.pillaged_users = []
        self.bestMailServerPort = None
        self.bestMailServer = None
        self.webserver = None  # web server process
        self.webserverpid = None
        self.gather = None
        self.mp = None  # mail pillager

        # initialize some config options
        self.config["domain_name"] = ""
        self.config["phishing_domain"] = ""
        self.config["company_name"] = ""
        self.config["config_filename"] = ""
        self.config["email_list_filename"] = ""

        # default all bool values to False
        self.config["verbose"] = False
        self.config["gather_emails"] = False
        self.config["gather_dns"] = False
        self.config["enable_externals"] = False
        self.config["enable_web"] = False
        self.config["enable_email"] = False
        self.config["enable_email_sending"] = False
        self.config["simulate_email_sending"] = False
        self.config["daemon_web"] = False
        self.config["always_yes"] = False
        self.config["enable_advanced"] = False
        self.config["profile_domain"] = False
        self.config["pillage_email"] = False

        # get current IP
        self.config["ip"] = Utils.getIP()

        # set a few misc values
        self.pid_path = os.path.dirname(os.path.realpath(__file__)) + "/../"
        self.display = Display()
        self.email_templates = defaultdict(list)
开发者ID:jiangzhw,项目名称:SPF,代码行数:46,代码来源:framework.py

示例5: load_config

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def load_config(self):
        # does config file exist?
        if (self.config["config_filename"] is not None):
            temp1 = self.config
            temp2 = Utils.load_config(self.config["config_filename"])
            self.config = dict(temp2.items() + temp1.items())
        else:
            # guess not..   so try to load the default one
            if Utils.is_readable("default.cfg"):
                self.display.error("a CONFIG FILE was not specified...  defaulting to [default.cfg]")
                print
                temp1 = self.config
                temp2 = Utils.load_config("default.cfg")
                self.config = dict(temp2.items() + temp1.items())
            else:
                # someone must have removed it!
                self.display.error("a CONFIG FILE was not specified...")
                print
                sys.exit(1)

        # set verbosity/debug level
        if (self.config['verbose'] >= 1):
            self.display.enableVerbose()
        if (self.config['verbose'] > 1):
            self.display.enableDebug()

        if (self.config["ip"] == "0.0.0.0") or (self.config["ip"] == None):
            self.config["ip"]=Utils.getIP()

        # set logging path
        self.outdir = os.getcwd() + "/" + self.config["domain_name"] + "_" + self.config["phishing_domain"] + "/"
        if not os.path.exists(os.path.dirname(self.outdir)):
            os.makedirs(os.path.dirname(self.outdir))
        self.display.setLogPath(self.outdir + "logs/")

        # create sqllite db
        self.db = MyDB(sqlite_file=self.outdir)

        # log it
        self.display.log("STARTTIME=%s\n" % (time.strftime("%Y/%m/%d %H:%M:%S")), filename="INFO.txt")
        self.display.log("TARGETDOMAIN=%s\n" % (self.config["domain_name"]), filename="INFO.txt")
        self.display.log("PHISHINGDOMAIN=%s\n" % (self.config["phishing_domain"]), filename="INFO.txt")
开发者ID:firebitsbr,项目名称:SPF,代码行数:44,代码来源:framework.py

示例6: parse_parameters

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]

#.........这里部分代码省略.........
        )
        advgroup.add_argument(
            "--profile",
            dest="profile_domain",
            action="store_true",
            help="profile the target domain (requires the --dns flag)",
        )
        advgroup.add_argument(
            "--pillage",
            dest="pillage_email",
            action="store_true",
            help="auto pillage email accounts (requires the --dns flag)",
        )

        # ==================================================
        # Optional Args
        # ==================================================
        parser.add_argument("-d", metavar="<domain>", dest="domain", action="store", help="domain name to phish")
        parser.add_argument(
            "-p",
            metavar="<domain>",
            dest="phishdomain",
            default="example.com",
            action="store",
            help="newly registered 'phish' domain name",
        )
        parser.add_argument(
            "-c", metavar="<company's name>", dest="company", action="store", help="name of company to phish"
        )
        parser.add_argument(
            "--ip",
            metavar="<IP address>",
            dest="ip",
            default=Utils.getIP(),
            action="store",
            help="IP of webserver defaults to [%s]" % (Utils.getIP()),
        )
        parser.add_argument("-v", "--verbosity", dest="verbose", action="count", help="increase output verbosity")

        # ==================================================
        # Misc Flags
        # ==================================================
        miscgroup = parser.add_argument_group("misc")
        miscgroup.add_argument(
            "-y", dest="always_yes", action="store_true", help="automatically answer yes to all questions"
        )

        args = parser.parse_args()

        # convert parameters to values in the config dict
        self.config["domain_name"] = args.domain
        if self.config["domain_name"] is None:
            self.config["domain_name"] = ""
        self.config["phishing_domain"] = args.phishdomain
        if self.config["phishing_domain"] is None:
            self.config["phishing_domain"] = "example.com"
        self.config["company_name"] = args.company
        self.config["ip"] = args.ip
        self.config["config_filename"] = args.config_file
        self.config["email_list_filename"] = args.email_list_file
        self.config["verbose"] = args.verbose
        self.config["gather_emails"] = args.enable_gather_email
        self.config["gather_dns"] = args.enable_gather_dns
        self.config["profile_domain"] = args.profile_domain
        self.config["pillage_email"] = args.pillage_email
        self.config["enable_externals"] = args.enable_external
开发者ID:jiangzhw,项目名称:SPF,代码行数:70,代码来源:framework.py

示例7: parse_parameters

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def parse_parameters(self, argv):
        parser = argparse.ArgumentParser()

        #==================================================
        # Required Args
        #==================================================
#        requiredgroup = parser.add_argument_group('required arguments')
#        requiredgroup.add_argument("-d",
#                            metavar="<domain>",
#                            dest="domain",
#                            action='store',
#                            required=True,
#                            help="domain name to phish")

        #==================================================
        # Input Files
        #==================================================
        filesgroup = parser.add_argument_group('input files')
        filesgroup.add_argument("-f",
                            metavar="<list.txt>",
                            dest="email_list_file",
                            action='store',
#                            type=argparse.FileType('r'),
                            help="file containing list of email addresses")
        filesgroup.add_argument("-C",
                            metavar="<config.txt>",
                            dest="config_file",
                            action='store',
#                            type=argparse.FileType('r'),
                            help="config file")

        #==================================================
        # Enable Flags
        #==================================================
        enablegroup = parser.add_argument_group('enable flags')
        enablegroup.add_argument("--all",
                            dest="enable_all",
                            action='store_true',
                            help="enable ALL flags... same as (-e -g -s -w)")
        enablegroup.add_argument("--test",
                            dest="enable_test",
                            action='store_true',
                            help="enable all flags EXCEPT sending of emails... same as (-e -g --simulate -w -y -v -v)")
        enablegroup.add_argument("-e",
                            dest="enable_external",
                            action='store_true',
                            help="enable external tool utilization")
        enablegroup.add_argument("-g",
                            dest="enable_gather_email",
                            action='store_true',
                            help="enable automated gathering of email targets")
        enablegroup.add_argument("-s",
                            dest="enable_send_email",
                            action='store_true',
                            help="enable automated sending of phishing emails to targets")
        enablegroup.add_argument("--simulate",
                            dest="simulate_send_email",
                            action='store_true',
                            help="simulate the sending of phishing emails to targets")
        enablegroup.add_argument("-w",
                            dest="enable_web",
                            action='store_true',
                            help="enable generation of phishing web sites")
        enablegroup.add_argument("-W",
                            dest="daemon_web",
                            action='store_true',
                            help="leave web server running after termination of spf.py")

        #==================================================
        # Optional Args
        #==================================================
        parser.add_argument("-d",
                            metavar="<domain>",
                            dest="domain",
                            action='store',
                            help="domain name to phish")
        parser.add_argument("-c",
                            metavar="<company's name>",
                            dest="company",
                            action='store',
                            help="name of company to phish")
        parser.add_argument("--ip",
                            metavar="<IP address>",
                            dest="ip",
                            default=Utils.getIP(),
                            action='store',
                            help="IP of webserver defaults to [%s]" % (Utils.getIP()))
        parser.add_argument("-v", "--verbosity",
                            dest="verbose",
                            action='count',
                            help="increase output verbosity")

        #==================================================
        # Misc Flags
        #==================================================
        miscgroup = parser.add_argument_group('misc')
        miscgroup.add_argument("-y",
                            dest="always_yes",
                            action='store_true',
                            help="automatically answer yes to all questions")
#.........这里部分代码省略.........
开发者ID:Sh3llSh0ck3d,项目名称:SPF,代码行数:103,代码来源:framework.py

示例8: parseParameters

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import getIP [as 别名]
    def parseParameters(self, argv):
        parser = argparse.ArgumentParser()

        # ==================================================
        # Input Files
        # ==================================================
        filesgroup = parser.add_argument_group('inputs')
        filesgroup.add_argument("-C",
                                metavar="<config.txt>",
                                dest="config_file",
                                action='store',
                                help="config file")
        filesgroup.add_argument("-f",
                                metavar="<input file>",
                                dest="inputs",
                                default=[],
                                action='store',
                                help="one of more input files seperated by spaces",
                                nargs='*')
        filesgroup.add_argument("--target",
                                metavar="",
                                dest="scan_target",
                                action='store',
                                help="initial scan target(s)")

        # ==================================================
        # Advanced Flags
        # ==================================================
        advgroup = parser.add_argument_group('advanced')
        advgroup.add_argument("--ip",
                              metavar="<local IP>",
                              dest="lhost",
                              default=Utils.getIP(),
                              action='store',
                              help="defaults to %s" % Utils.getIP())

        # ==================================================
        # Optional Args
        # ==================================================
        parser.add_argument("-v", "--verbosity",
                            dest="verbose",
                            action='count',
                            help="increase output verbosity")
        parser.add_argument("-s", "--safelevel",
                            dest="safe_level",
                            action='store',
                            default=4,
                            help="set min safe level for modules. 0 is unsafe and 5 is very safe. Default is 4")
        parser.add_argument("-x", "--exclude",
                            dest="exclude_types",
                            action="store",
                            default="",
                            help="specify a comma seperatec list of module types to exclude from running")
#        parser.add_argument("-b", "--bypassmenu",
#                            dest="bypass_menu",
#                            action='store_true',
#                            help="bypass menu and run from command line arguments")
        # ==================================================
        # Misc Flags
        # ==================================================
        miscgroup = parser.add_argument_group('misc')
        miscgroup.add_argument("--listmodules",
                               dest="list_modules",
                               action='store_true',
                               help="list out all current modules and exit")

        # parse args
        args = parser.parse_args()

        # convert parameters to values in the config dict
        self.config["config_filename"] = args.config_file
        self.config["verbose"] = args.verbose
        self.config["list_modules"] = args.list_modules
        self.config["scan_target"] = args.scan_target
        self.config["safe_level"] = int(args.safe_level)
        self.config["exclude_types"] = args.exclude_types
        self.config['lhost'] = args.lhost
#       self.config["bypass_menu"] = args.bypass_menu
        for f in args.inputs:
            if (Utils.isReadable(f)):
                type = self.idFileType(f)
                if (type):
                    if type in self.inputs:
                        self.inputs[type].append(f)
                    else:
                        self.inputs[type] = [f]
            else:
                print "Can not access [" + f + "]"
开发者ID:MooseDojo,项目名称:apt2,代码行数:90,代码来源:framework.py


注:本文中的utils.Utils.getIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。