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


Python Display.error方法代码示例

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


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

示例1: __init__

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import error [as 别名]
class Test:
  def __init__(self, stream):
    self.display = Display()
    self.stream = Stream(stream)

  def parse(self):
    if not self.stream.line:
      return False
    parse = self.stream.line.split('#')
    if len(parse) == 2:
      try:
        self.result = int(parse[0].rstrip(' '))
        self.message = parse[1].rstrip(' ')
      except:
        return False
      if self.result != 0 and self.result != 1:
        return False
      return True
    return False

  def launch(self):
    sucess = 0
    total = 0
    while self.stream.read():
      if self.parse():
        if self.result == 1:
          sucess += 1
        else:
          self.display.error("Error on" + self.message)
        total += 1
    self.display.summary(sucess, total)
开发者ID:ThomasChaf,项目名称:Modulary,代码行数:33,代码来源:test.py

示例2: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import error [as 别名]

#.........这里部分代码省略.........
        self.config["enable_web"] = args.enable_web
        self.config["enable_email_sending"] = args.enable_send_email
        self.config["simulate_email_sending"] = args.simulate_send_email
        self.config["daemon_web"] = args.daemon_web
        self.config["always_yes"] = args.always_yes

        if args.enable_recon == True:
            self.config["gather_emails"] = True
            self.config["gather_dns"] = True

        if args.enable_all == True:
            self.config["gather_emails"] = True
            self.config["enable_externals"] = True
            self.config["enable_web"] = True
            self.config["enable_email_sending"] = True
            self.config["verbose"] = 2
            self.config["always_yes"] = True

        if args.enable_test == True:
            self.config["gather_emails"] = True
            self.config["enable_externals"] = True
            self.config["simulate_email_sending"] = True
            self.config["enable_web"] = True
            self.config["always_yes"] = True
            self.config["verbose"] = 2

        if args.enable_advanced == True:
            self.config["gather_dns"] = True
            self.config["profile_domain"] = True
            self.config["pillage_email"] = True

        if self.config["profile_domain"] and not self.config["gather_dns"]:
            self.config["profile_domain"] = False
            self.display.error("--profile requires the --dns option to be enabled as well.")

        if self.config["pillage_email"] and not self.config["gather_dns"]:
            self.config["pillage_email"] = False
            self.display.error("--pillage requires the --dns option to be enabled as well.")

        good = False
        if (
            self.config["gather_emails"]
            or self.config["enable_externals"]
            or self.config["enable_web"]
            or self.config["enable_email_sending"]
            or self.config["simulate_email_sending"]
            or self.config["gather_dns"]
            or self.config["profile_domain"]
            or self.config["pillage_email"]
        ):
            good = True
        if not good:
            self.display.error(
                "Please enable at least one of the following parameters: -g --external --dns -s --simulate -w ( --all --test --recon --adv )"
            )
            print
            parser.print_help()
            sys.exit(1)

    # ==================================================
    # Primary METHOD
    # ==================================================

    def run(self, argv):

        # ==================================================
开发者ID:jiangzhw,项目名称:SPF,代码行数:70,代码来源:framework.py

示例3: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import error [as 别名]

#.........这里部分代码省略.........
        # 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["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["enable_externals"] = args.enable_external
        self.config["enable_web"] = args.enable_web
        self.config["enable_email_sending"] = args.enable_send_email
        self.config["simulate_email_sending"] = args.simulate_send_email
        self.config["daemon_web"] = args.daemon_web
        self.config["always_yes"] = args.always_yes

        if (args.enable_all == True):
            self.config["gather_emails"] =  True
            self.config["enable_externals"] = True
            self.config["enable_web"] = True
            self.config["enable_email_sending"] = True

        if (args.enable_test == True):
            self.config["gather_emails"] = True
            self.config["enable_externals"] = True
            self.config["simulate_email_sending"] = True
            self.config["enable_web"] = True
            self.config["always_yes"] = True
            self.config["verbose"] = 2

        good = True
        if (not good):
            self.display.error("Please enable/define at least one of the following parameters: --all --test -e -g -s --simulate -w")
            print
            parser.print_help()
            sys.exit(1)


    #==================================================
    # Primary METHOD
    #==================================================

    def run(self, argv):

        #==================================================
        # Process/Load commanline args and config file
        #==================================================

        self.parse_parameters(argv)

        # load the config file
        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:
            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:
                self.display.error("a CONFIG FILE was not specified...")
                print
开发者ID:Sh3llSh0ck3d,项目名称:SPF,代码行数:70,代码来源:framework.py

示例4: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import error [as 别名]

#.........这里部分代码省略.........
        
        # recon = gather emails and gather dns
        if (args.enable_recon == True):
            self.config["gather_emails"] =  True
            self.config["gather_dns"] = True

        # all = gather emails, enable externals, etc...
        if (args.enable_all == True):
            self.config["gather_emails"] =  True
            self.config["enable_externals"] = True
            self.config["enable_web"] = True
            self.config["enable_email_sending"] = True
            self.config["verbose"] = 2
            self.config["always_yes"] = True

        # test = gather emails, enable externals, etc...
        if (args.enable_test == True):
            self.config["gather_emails"] = True
            self.config["enable_externals"] = True
            self.config["simulate_email_sending"] = True
            self.config["enable_web"] = True
            self.config["always_yes"] = True
            self.config["verbose"] = 2

        # advanced = dns, profile, and pillage
        if (args.enable_advanced == True):
            self.config["gather_dns"] = True
            self.config["profile_domain"] = True
            self.config["pillage_email"] = True

        # profile requires dns
        if (self.config["profile_domain"] and not self.config["gather_dns"]):
            self.config["profile_domain"] = False
            self.display.error("--profile requires the --dns option to be enabled as well.")

        # pillage requires dns
        if (self.config["pillage_email"] and not self.config["gather_dns"]):
            self.config["pillage_email"] = False
            self.display.error("--pillage requires the --dns option to be enabled as well.")

        # see if we are good to go
        good = False
        if (self.config["email_list_filename"]
                or self.config["gather_emails"]
                or self.config["enable_externals"]
                or self.config["enable_web"]
                or self.config["enable_email_sending"]
                or self.config["simulate_email_sending"]
                or self.config["gather_dns"]
                or self.config["profile_domain"]
                or self.config["pillage_email"]):
            good = True
        if (not good):
            self.display.error("Please enable at least one of the following parameters: -g --external --dns -s --simulate -w ( --all --test --recon --adv )")
            print
            parser.print_help()
            sys.exit(1)

    #----------------------------
    # Process/Load config file
    #----------------------------
    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"])
开发者ID:Phexcom,项目名称:SPF,代码行数:70,代码来源:framework.py


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