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


Python Display.output方法代码示例

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


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

示例1: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import output [as 别名]
class Framework(object):
    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)

    # ==================================================
    # SUPPORT METHODS
    # ==================================================

    def ctrlc(self):
        print
        self.display.alert("Ctrl-C caught!!!")
        self.cleanup()

    def cleanup(self):
        print
        if self.webserver is not None:
            if self.config["daemon_web"]:
                self.display.alert("Webserver is still running as requested.")
            else:
                # send SIGTERM to the web process
                self.display.output("stopping the webserver")
                self.webserver.send_signal(signal.SIGINT)
                # delete the pid file
                os.remove(self.pid_path + "spfwebsrv.pid")
                # as a double check, manually kill the process
                self.killProcess(self.webserverpid)
        # call report generation
        self.generateReport()
        # exit
        sys.exit(0)

    def killProcess(self, pid):
        if os.path.exists("/proc/" + str(pid)):
            self.display.alert("Killing process [%s]" % (pid))
            os.kill(pid, signal.SIGKILL)
            if os.path.isfile(self.pid_path + "spfwebsrv.pid"):
                os.remove(self.pid_path + "spfwebsrv.pid")

    def generateReport(self):
        self.display.output("Generating phishing report")
        self.display.log("ENDTIME=%s\n" % (time.strftime("%Y/%m/%d %H:%M:%S")), filename="INFO.txt")

        path = os.path.dirname(os.path.realpath(__file__))
        # Start process
        cmd = [path + "/../report.py", self.logpath]
        self.display.output("Report file located at %s%s" % (self.logpath, subprocess.check_output(cmd)))

    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',
#.........这里部分代码省略.........
开发者ID:jiangzhw,项目名称:SPF,代码行数:103,代码来源:framework.py

示例2: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import output [as 别名]
class Framework(object):

    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

        #self.config["attachment_filename"] = None
        #self.config["attachment_fullpath"] = None

        # get current IP
        #self.config['ip'] = None

        # set a few misc values
        self.pid_path = os.path.dirname(os.path.realpath(__file__)) + "/../"
        self.display = Display()
        self.email_templates = defaultdict(list)

    #==================================================
    # SUPPORT METHODS
    #==================================================

    #----------------------------
    # CTRL-C display and exit
    #----------------------------
    def ctrlc(self):
        print
        self.display.alert("Ctrl-C caught!!!")
        self.cleanup()

    #----------------------------
    # Close everything down nicely
    #----------------------------
    def cleanup(self):
        print
        if (self.webserver is not None):
            if (self.config["daemon_web"]):
                self.display.alert("Webserver is still running as requested.")
            else:
                # send SIGTERM to the web process
                self.display.output("stopping the webserver")
                self.webserver.send_signal(signal.SIGINT)
                # delete the pid file
                os.remove(self.pid_path + "spfwebsrv.pid") 
                # as a double check, manually kill the process
                self.killProcess(self.webserverpid)
        # call report generation
        self.generateReport()
        # exit
        sys.exit(0)

    #----------------------------
    # Kill specified process
    #----------------------------
    def killProcess(self, pid):
        if (os.path.exists("/proc/" + str(pid))):
            self.display.alert("Killing process [%s]" % (pid))
            os.kill(pid, signal.SIGKILL)
            if (os.path.isfile(self.pid_path + "spfwebsrv.pid")):
                os.remove(self.pid_path + "spfwebsrv.pid") 

    #----------------------------
    # Generate The simple report
    #----------------------------
    def generateReport(self):
        self.display.output("Generating phishing report")
        self.display.log("ENDTIME=%s\n" % (time.strftime("%Y/%m/%d %H:%M:%S")), filename="INFO.txt")

#.........这里部分代码省略.........
开发者ID:Phexcom,项目名称:SPF,代码行数:103,代码来源:framework.py

示例3: Framework

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import output [as 别名]
class Framework(object):

    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)

    #==================================================
    # SUPPORT METHODS
    #==================================================

    def cleanup(self):
        self.display.alert("Ctrl-C caught!!!")
        if (self.webserver is not None):
            if (self.config["daemon_web"]):
                self.display.alert("Webserver is still running as requested.")
            else:
                # send SIGTERM to the web process
                self.display.output("stopping webserver")
                self.webserver.send_signal(signal.SIGINT)
                # delete the pid file
                os.remove(self.pid_path + "spfwebsrv.pid") 
        # call report generation
        self.generateReport()
        # exit
        sys.exit(0)

    def generateReport(self):
        self.display.output("Generating phishing report")
        self.display.log("ENDTIME=%s\n" % (time.strftime("%Y/%m/%d %H:%M:%S")), filename="INFO.txt")

        path = os.path.dirname(os.path.realpath(__file__))
        # Start process
        cmd = [path + "/../report.py", os.getcwd() + "/" + self.config["domain_name"] + "_" + self.config["phishing_domain"] + "/"]
        self.display.output("Report file located at %s%s" % (os.getcwd() + "/" + self.config["domain_name"] + "_" + self.config["phishing_domain"] + "/", subprocess.check_output(cmd)))

    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',
#.........这里部分代码省略.........
开发者ID:Sh3llSh0ck3d,项目名称:SPF,代码行数:103,代码来源:framework.py

示例4: Display

# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import output [as 别名]
# base handler, make a request to BSM to get the game status or the next
# time we need to run, then sling that output to the display classes

import sys
import requests
import time
from display import Display


display = Display()
try:
    while(True): #TODO: figure out the right way to poll and control state around that
        r = requests.get('https://boxscoremania.com/api/game-status', verify=False)
        gamestate = r.json()
        display.output(gamestate)
        time.sleep(2)

except KeyboardInterrupt:
    display.clear()
except:
    display.clear()

开发者ID:muntzen,项目名称:HWHacking,代码行数:23,代码来源:init.py


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