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


Python Color.Color类代码示例

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


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

示例1: found_target

    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,代码行数:26,代码来源:Scanner.py

示例2: run

    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,代码行数:26,代码来源:AttackWPS.py

示例3: fake_auth

 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,代码行数:25,代码来源:AttackWEP.py

示例4: dump

 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,代码行数:7,代码来源:CrackResultWPS.py

示例5: dump

 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,代码行数:8,代码来源:CrackResultWEP.py

示例6: crack_handshake

 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,代码行数:8,代码来源:CrackHandshake.py

示例7: print_oclhashcat

 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,代码行数:10,代码来源:CrackHandshake.py

示例8: start

    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,代码行数:54,代码来源:Airmon.py

示例9: save

 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,代码行数:12,代码来源:CrackResult.py

示例10: __str__

    def __str__(self):
        ''' Colored string representation of interface '''
        s = Color.s("{W}%s" % self.phy)
        s += ' ' * max(Interface.PHY_LEN - len(self.phy), 0)

        s += Color.s("{G}%s" % self.name)
        s += ' ' * max(Interface.NAME_LEN - len(self.name), 0)

        s += Color.s("{C}%s" % self.driver)
        s += ' ' * max(Interface.DRIVER_LEN - len(self.driver), 0)

        s += Color.s("{W}%s" % self.chipset)
        s += ' ' * max(Interface.CHIPSET_LEN - len(self.chipset), 0)
        return s
开发者ID:schoonc,项目名称:wifite2,代码行数:14,代码来源:Interface.py

示例11: save_handshake

    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,代码行数:28,代码来源:AttackWPA.py

示例12: call

    def call(command, cwd=None,shell=False):
        '''
            Calls a command (either string or list of args).
            Returns tuple:
                (stdout, stderr)
        '''
        if type(command) != str or ' ' in command or shell:
            shell = True
            if Configuration.verbose > 1:
                Color.pe("\n {C}[?] {W} Executing (Shell): {B}%s{W}" % command)
        else:
            shell = False
            if Configuration.verbose > 1:
                Color.pe("\n {C}[?]{W} Executing: {B}%s{W}" % command)

        pid = Popen(command, cwd=cwd, stdout=PIPE, stderr=PIPE, shell=shell)
        pid.wait()
        (stdout, stderr) = pid.communicate()

        if Configuration.verbose > 1 and stdout.strip() != '':
            Color.pe("{P} [stdout] %s{W}" % '\n [stdout] '.join(stdout.split('\n')))
        if Configuration.verbose > 1 and stderr.strip() != '':
            Color.pe("{P} [stderr] %s{W}" % '\n [stderr] '.join(stderr.split('\n')))

        return (stdout, stderr)
开发者ID:Andrey-Omelyanuk,项目名称:wifite2,代码行数:25,代码来源:Process.py

示例13: print_targets

    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,代码行数:32,代码来源:Scanner.py

示例14: print_pairs

    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,代码行数:26,代码来源:Handshake.py

示例15: user_wants_to_continue

    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,代码行数:16,代码来源:AttackWEP.py


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