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


Python Color.pl方法代码示例

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


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

示例1: print_targets

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def print_targets(self):
        '''
            Prints targets to console
        '''
        if len(self.targets) == 0:
            Color.p('\r')
            return

        if self.previous_target_count > 0:
            # We need to "overwrite" the previous list of targets.
            if self.previous_target_count > len(self.targets) or \
               Scanner.get_terminal_height() < self.previous_target_count + 3:
                # Either:
                # 1) We have less targets than before, so we can't overwrite the previous list
                # 2) The terminal can't display the targets without scrolling.
                # Clear the screen.
                from Process import Process
                Process.call('clear')
            else:
                # We can fit the targets in the terminal without scrolling
                # "Move" cursor up so we will print over the previous list
                Color.pl(Scanner.UP_CHAR * (3 + self.previous_target_count))

        self.previous_target_count = len(self.targets)

        # Overwrite the current line
        Color.p('\r')

        Target.print_header()
        for (index, target) in enumerate(self.targets):
            index += 1
            Color.pl('   {G}%s %s' % (str(index).rjust(3), target))
开发者ID:wflk,项目名称:wifite2,代码行数:34,代码来源:Scanner.py

示例2: dump

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def dump(self):
     if self.essid:
         Color.pl('{+} %s: {C}%s{W}' % (      'ESSID'.rjust(12), self.essid))
     Color.pl('{+} %s: {C}%s{W}'     % (      'BSSID'.rjust(12), self.bssid))
     Color.pl('{+} %s: {C}WPA{W} ({C}WPS{W})' % 'Encryption'.rjust(12))
     Color.pl('{+} %s: {G}%s{W}'     % (     'WPS PIN'.rjust(12), self.pin))
     Color.pl('{+} %s: {G}%s{W}'     % ('PSK/Password'.rjust(12), self.psk))
开发者ID:schoonc,项目名称:wifite2,代码行数:9,代码来源:CrackResultWPS.py

示例3: save_handshake

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def save_handshake(self, handshake):
        '''
            Saves a copy of the handshake file to hs/
            Args:
                handshake - Instance of Handshake containing bssid, essid, capfile
        '''
        # Create handshake dir
        if not os.path.exists(Configuration.wpa_handshake_dir):
            os.mkdir(Configuration.wpa_handshake_dir)

        # Generate filesystem-safe filename from bssid, essid and date
        essid_safe = re.sub('[^a-zA-Z0-9]', '', handshake.essid)
        bssid_safe = handshake.bssid.replace(':', '-')
        date = time.strftime('%Y-%m-%dT%H-%M-%S')
        cap_filename = 'handshake_%s_%s_%s.cap' % (essid_safe, bssid_safe, date)
        cap_filename = os.path.join(Configuration.wpa_handshake_dir, cap_filename)

        if Configuration.wpa_strip_handshake:
            Color.p("{+} {C}stripping{W} non-handshake packets, saving to {G}%s{W}..." % cap_filename)
            handshake.strip(outfile=cap_filename)
            Color.pl('{G}saved{W}')
        else:
            Color.p('{+} saving copy of {C}handshake{W} to {C}%s{W} ' % cap_filename)
            copy(handshake.capfile, cap_filename)
            Color.pl('{G}saved{W}')

        # Update handshake to use the stored handshake file for future operations
        handshake.capfile = cap_filename
开发者ID:schoonc,项目名称:wifite2,代码行数:30,代码来源:AttackWPA.py

示例4: found_target

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def found_target(self):
        '''
            Check if we discovered the target AP
            Returns: the Target if found,
                     Otherwise None.
        '''
        bssid = Configuration.target_bssid
        essid = Configuration.target_essid

        if bssid == None and essid == None:
            return False

        for target in self.targets:
            if bssid and bssid.lower() == target.bssid.lower():
                self.target = target
                break
            if essid and essid.lower() == target.essid.lower():
                self.target = target
                break

        if self.target:
            Color.pl('\n{+} {C}found target{G} %s {W}({G}%s{W})'
                % (self.target.bssid, self.target.essid))
            return True

        return False
开发者ID:wflk,项目名称:wifite2,代码行数:28,代码来源:Scanner.py

示例5: run

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def run(self):
        ''' Run all WPS-related attacks '''

        # Drop out if user specified to not use Reaver
        if Configuration.no_reaver:
            self.success = False
            return self.success

        # Run Pixie-Dust attack
        if self.is_pixiedust_supported():
            if self.run_pixiedust_attack():
                # Pixie-Dust attack succeeded. We're done.
                self.success = True
                return self.success
        else:
            Color.pl(
                '{!} {R}your version of "reaver" does not' +
                ' support the {O}WPS pixie-dust attack{W}')

        if Configuration.pixie_only:
            Color.pl('{!} {O}--pixie{R} set, ignoring WPS-PIN attack{W}')
            self.success = False
        else:
            # Run WPS-PIN attack
            self.success = self.run_wps_pin_attack()
        return self.success
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:28,代码来源:AttackWPS.py

示例6: choose_handshake

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def choose_handshake(self):
        Color.pl("\n{+} Listing captured handshakes...\n")
        handshakes = CrackResult.load_all()
        handshakes = [hs for hs in handshakes if "handshake_file" in hs and os.path.exists(hs["handshake_file"])]
        if len(handshakes) == 0:
            raise Exception("No handshakes found in %s" % os.path.realpath(CrackResult.cracked_file))

        # Handshakes Header
        max_essid_len = max([len(hs["essid"]) for hs in handshakes])
        Color.p("  NUM")
        Color.p("  " + "ESSID".ljust(max_essid_len))
        Color.p("  " + "BSSID".ljust(17))
        Color.p("  DATE CAPTURED\n")
        Color.p("  ---")
        Color.p("  " + ("-" * max_essid_len))
        Color.p("  " + ("-" * 17))
        Color.p("  " + ("-" * 19) + "\n")
        # Print all handshakes
        for index, hs in enumerate(handshakes):
            bssid = hs["bssid"]
            essid = hs["essid"]
            date = datetime.strftime(datetime.fromtimestamp(hs["date"]), "%Y-%m-%dT%H:%M:%S")
            Color.p("  {G}%s{W}" % str(index + 1).rjust(3))
            Color.p("  {C}%s{W}" % essid.ljust(max_essid_len))
            Color.p("  {C}%s{W}" % bssid)
            Color.p("  {C}%s{W}\n" % date)
        # Get number from user
        hs_index = raw_input(Color.s("\n{+} Select handshake num to crack ({G}1-%d{W}): " % len(handshakes)))
        if not hs_index.isdigit():
            raise Exception("Invalid input: %s" % hs_index)
        hs_index = int(hs_index)
        if hs_index < 1 or hs_index > len(handshakes):
            raise Exception("Handshake num must be between 1 and %d" % len(handshakes))

        return handshakes[hs_index - 1]
开发者ID:schoonc,项目名称:wifite2,代码行数:37,代码来源:CrackHandshake.py

示例7: crack_handshake

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def crack_handshake(self, handshake):
     cap_file = os.path.realpath(handshake["handshake_file"])
     Color.pl("{+} Different ways to crack {C}%s{W}:" % cap_file)
     self.print_aircrack(cap_file)
     self.print_pyrit(cap_file)
     self.print_john(cap_file)
     self.print_oclhashcat(cap_file)
     Color.pl("")
开发者ID:schoonc,项目名称:wifite2,代码行数:10,代码来源:CrackHandshake.py

示例8: dump

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def dump(self):
     if self.essid:
         Color.pl('{+}      ESSID: {C}%s{W}' % self.essid)
     Color.pl('{+}      BSSID: {C}%s{W}' % self.bssid)
     Color.pl('{+} Encryption: {C}%s{W}' % self.result_type)
     Color.pl('{+}    Hex Key: {G}%s{W}' % self.hex_key)
     if self.ascii_key:
         Color.pl('{+}  Ascii Key: {G}%s{W}' % self.ascii_key)
开发者ID:schoonc,项目名称:wifite2,代码行数:10,代码来源:CrackResultWEP.py

示例9: print_oclhashcat

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def print_oclhashcat(self, cap_file):
     if not Process.exists("hashcat"): return
     Color.pl("\n  {O}# OCLHASHCAT: GPU-based cracking. Fast.")
     hccapx_file = "generated.hccapx"
     if Process.exists("cap2hccapx"):
         Color.pl("  {G}cap2hccapx {C}%s %s{W}" % (cap_file, hccapx_file))
     else:
         Color.pl("  {O}# Visit https://hashcat.net/cap2hccapx to generate a .hccapx file{W}")
         Color.pl("  {O}# Browse -> %s -> Convert" % cap_file)
     Color.pl("  {G}hashcat {W}-m 2500 {C}%s %s{W}" % (hccapx_file, self.wordlist))
开发者ID:schoonc,项目名称:wifite2,代码行数:12,代码来源:CrackHandshake.py

示例10: run

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def run(self):
        with Airodump(channel=self.target.channel,
                      target_bssid=self.target.bssid,
                      skip_wash=True,
                      output_file_prefix='wps_pin') as airodump:
            # Wait for target
            Color.clear_entire_line()
            Color.pattack("WPS",
                    self.target,
                    self.attack_type(),
                    "Waiting for target to appear...")
            self.target = self.wait_for_target(airodump)

            # Start bully
            self.bully_proc = Process(self.cmd,
                stderr=Process.devnull(),
                bufsize=0,
                cwd=Configuration.temp())
            t = Thread(target=self.parse_line_thread)
            t.daemon = True
            t.start()
            try:
                while self.bully_proc.poll() is None:
                    try:
                        self.target = self.wait_for_target(airodump)
                    except Exception as e:
                        Color.clear_entire_line()
                        Color.pattack("WPS",
                                self.target,
                                self.attack_type(),
                                "{R}failed: {O}%s{W}" % e)
                        Color.pl("")
                        self.stop()
                        break
                    Color.clear_entire_line()
                    Color.pattack("WPS",
                            self.target,
                            self.attack_type(),
                            self.get_status())
                    time.sleep(0.5)
            except KeyboardInterrupt as e:
                self.stop()
                raise e
            except Exception as e:
                self.stop()
                raise e

        if self.crack_result is None:
            Color.clear_entire_line()
            Color.pattack("WPS",
                    self.target,
                    self.attack_type(),
                    "{R}Failed{W}\n")
开发者ID:schoonc,项目名称:wifite2,代码行数:55,代码来源:Bully.py

示例11: save

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def save(self):
     ''' Adds this crack result to the cracked file and saves it. '''
     name = CrackResult.cracked_file
     json = []
     if os.path.exists(name):
         f = open(name, 'r')
         text = f.read()
         f.close()
         try:
             json = loads(text)
         except Exception, e:
             Color.pl('{!} error while loading %s: %s' % (name, str(e)))
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:14,代码来源:CrackResult.py

示例12: print_pairs

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def print_pairs(pairs, capfile, tool=None):
        '''
            Prints out BSSID and/or ESSID given a list of tuples (bssid,essid)
        '''
        tool_str = ''
        if tool:
            tool_str = '{C}%s{W}: ' % tool.rjust(8)

        if len(pairs) == 0:
            Color.pl("{!} %s.cap file {R}does not{O} contain a valid handshake{W}"
                % (tool_str))
            return

        for (bssid, essid) in pairs:
            if bssid and essid:
                Color.pl('{+} %s.cap file' % tool_str +
                         ' {G}contains a valid handshake{W}' +
                         ' for {G}%s{W} ({G}%s{W})' % (bssid, essid))
            elif bssid:
                Color.pl('{+} %s.cap file' % tool_str +
                         ' {G}contains a valid handshake{W}' +
                         ' for {G}%s{W}' % bssid)
            elif essid:
                Color.pl('{+} %s.cap file' % tool_str +
                         ' {G}contains a valid handshake{W}' +
                         ' for ({G}%s{W})' % essid)
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:28,代码来源:Handshake.py

示例13: fake_auth

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
 def fake_auth(self):
     '''
         Attempts to fake-authenticate with target.
         Returns: True if successful,
                  False is unsuccesful.
     '''
     Color.p('\r{+} attempting {G}fake-authentication{W} with {C}%s{W}...' % self.target.bssid)
     fakeauth = Aireplay.fakeauth(self.target, timeout=AttackWEP.fakeauth_wait)
     if fakeauth:
         Color.pl(' {G}success{W}')
     else:
         Color.pl(' {R}failed{W}')
         if Configuration.require_fakeauth:
             # Fakeauth is requried, fail
             raise Exception(
                 'Fake-authenticate did not complete within' +
                 ' %d seconds' % AttackWEP.fakeauth_wait)
         else:
             # Warn that fakeauth failed
             Color.pl('{!} {O}' +
                 'unable to fake-authenticate with target' +
                 ' (%s){W}' % self.target.bssid)
             Color.pl('{!} continuing attacks because' +
                 ' {G}--require-fakeauth{W} was not set')
     return fakeauth
开发者ID:schoonc,项目名称:wifite2,代码行数:27,代码来源:AttackWEP.py

示例14: user_wants_to_continue

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def user_wants_to_continue(self, attack_index):
        ''' Asks user if attacks should continue using remaining methods '''
        Color.pl('\n{!} {O}interrupted{W}\n')

        if attack_index + 1 >= len(Configuration.wep_attacks):
            # No more WEP attacks to perform.
            return False

        attacks_remaining = Configuration.wep_attacks[attack_index + 1:]
        Color.pl("{+} {G}%d{W} attacks remain ({C}%s{W})" % (len(attacks_remaining), ', '.join(attacks_remaining)))
        prompt = Color.s('{+} type {G}c{W} to {G}continue{W}' +
                         ' or {R}s{W} to {R}stop{W}: ')
        if raw_input(prompt).lower().startswith('s'):
            return False
        else:
            return True
开发者ID:Andrey-Omelyanuk,项目名称:wifite2,代码行数:18,代码来源:AttackWEP.py

示例15: start

# 需要导入模块: from Color import Color [as 别名]
# 或者: from Color.Color import pl [as 别名]
    def start(iface):
        '''
            Starts an interface (iface) in monitor mode
            Args:
                iface - The interface to start in monitor mode
                        Either an instance of Interface object,
                        or the name of the interface (string).
            Returns:
                Name of the interface put into monitor mode.
            Throws:
                Exception - If an interface can't be put into monitor mode
        '''
        # Get interface name from input
        if type(iface) == Interface:
            iface = iface.name
        Airmon.base_interface = iface

        # Call airmon-ng
        Color.p("{+} enabling {G}monitor mode{W} on {C}%s{W}... " % iface)
        (out,err) = Process.call('airmon-ng start %s' % iface)

        # Find the interface put into monitor mode (if any)
        mon_iface = None
        for line in out.split('\n'):
            if 'monitor mode' in line and 'enabled' in line and ' on ' in line:
                mon_iface = line.split(' on ')[1]
                if ']' in mon_iface:
                    mon_iface = mon_iface.split(']')[1]
                if ')' in mon_iface:
                    mon_iface = mon_iface.split(')')[0]
                break

        if mon_iface == None:
            # Airmon did not enable monitor mode on an interface
            Color.pl("{R}failed{W}")

        mon_ifaces = Airmon.get_interfaces_in_monitor_mode()

        # Assert that there is an interface in monitor mode
        if len(mon_ifaces) == 0:
            Color.pl("{R}failed{W}")
            raise Exception("iwconfig does not see any interfaces in Mode:Monitor")

        # Assert that the interface enabled by airmon-ng is in monitor mode
        if mon_iface not in mon_ifaces:
            Color.pl("{R}failed{W}")
            raise Exception("iwconfig does not see %s in Mode:Monitor" % mon_iface)

        # No errors found; the device 'mon_iface' was put into MM.
        Color.pl("{G}enabled {C}%s{W}" % mon_iface)

        Configuration.interface = mon_iface

        return mon_iface
开发者ID:schoonc,项目名称:wifite2,代码行数:56,代码来源:Airmon.py


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