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


Python Process.exists方法代码示例

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


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

示例1: print_oclhashcat

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [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

示例2: print_john

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
 def print_john(self, cap_file):
     if not Process.exists("pyrit"): return
     Color.pl("\n  {O}# JOHN: CPU or GPU-based cracking. Fast.")
     Color.pl("  {O}# Use --format=wpapsk-cuda (or wpapsk-opengl) to enable GPU acceleration")
     Color.pl("  {O}# See http://openwall.info/wiki/john/WPA-PSK for more info on this process")
     Color.pl("  {G}aircrack-ng {W}-J hccap {C}%s{W}" % cap_file)
     Color.pl("  {G}hccap2john {W}hccap.hccap > hccap.john{W}")
     Color.pl("  {G}john {W}--wordlist {C}\"%s\" {W}--format=wpapsk {C}\"hccap.john\"{W}" % (self.wordlist))
开发者ID:schoonc,项目名称:wifite2,代码行数:10,代码来源:CrackHandshake.py

示例3: cowpatty_handshakes

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
    def cowpatty_handshakes(self):
        ''' Returns True if cowpatty identifies a handshake, False otherwise '''
        if not Process.exists('cowpatty'):
            return []
        if not self.essid:
            return [] # We need a essid for cowpatty :(

        proc = Process(self.cowpatty_command(), devnull=False)
        for line in proc.stdout().split('\n'):
            if 'Collected all necessary data to mount crack against WPA' in line:
                return [(None, self.essid)]
        return []
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:14,代码来源:Handshake.py

示例4: pyrit_handshakes

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
    def pyrit_handshakes(self):
        ''' Returns True if pyrit identifies a handshake, False otherwise '''
        if not Process.exists('pyrit'):
            return []

        bssid_essid_pairs = set()
        hit_target = False
        current_bssid = self.bssid
        current_essid = self.essid
        proc = Process(self.pyrit_command(), devnull=False)
        for line in proc.stdout().split('\n'):
            mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1]
            match = re.search("^#\d+: AccessPoint (%s) \('(.*)'\):$"
                % (mac_regex), line)
            if match:
                # We found a BSSID and ESSID
                (bssid, essid) = match.groups()

                # Compare to what we're searching for
                if self.bssid and self.bssid.lower() == bssid.lower():
                    current_essid = essid
                    hit_target = True
                    continue

                elif self.essid and self.essid == essid:
                    current_bssid = bssid
                    hit_target = True
                    continue

                elif not self.bssid and not self.essid:
                    # We don't know either
                    current_bssid = bssid
                    current_essid = essid
                    hit_target = True
                else:
                    # This AccessPoint is not what we're looking for
                    hit_Target = False
            else:
                # Line does not contain AccessPoint
                if hit_target and ', good,' in line:
                    bssid_essid_pairs.add( (current_bssid, current_essid) )
        return [x for x in bssid_essid_pairs]
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:44,代码来源:Handshake.py

示例5: check_for_wps_and_update_targets

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
    def check_for_wps_and_update_targets(capfile, targets):
        '''
            Given a cap file and list of targets, use Wash to
            find which BSSIDs in the cap file use WPS.
            Then update the 'wps' flag for those BSSIDs in the targets.

            Args:
                capfile - .cap file from airodump containing packets
                targets - list of Targets from scan, to be updated
        '''
        # Wash/Walsh is required to detect WPS
        wash_name = 'wash'
        if not Process.exists(wash_name):
            wash_name = 'walsh'
            if not Proces.exists(wash_name):
                # Wash isn't found, drop out
                return

        command = [
            'wash',
            '-f', capfile, # Path to cap file
            '-C'            # Ignore Frame Check Sum errors
        ]
        p = Process(command)
        for line in p.stdout().split('\n'):
            # Ignore irrelevant lines
            if line.strip() == '' or line.startswith('Scanning for'):
                continue
            bssid = line.split(' ')[0]
            for t in targets:
                if t.bssid.lower() == bssid.lower():
                    # Update the WPS flag
                    t.wps = True

        # Mark other targets as "no" wps support
        for t in targets:
            if t.wps: continue
            t.wps = False
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:40,代码来源:Wash.py

示例6: tshark_bssid_essid_pairs

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
    def tshark_bssid_essid_pairs(self):
        '''
            Scrapes capfile for beacon frames indicating the ESSID.
            Returns list of tuples: (bssid,essid)
        '''
        if not Process.exists('tshark'):
            raise Exception('tshark is required to find ESSID')

        essids = set()

        # Extract beacon frames from cap file
        cmd = [
            'tshark',
            '-r', self.capfile,
            '-R', 'wlan.fc.type_subtype == 0x08 || wlan.fc.type_subtype == 0x05',
            '-2', # tshark: -R without -2 is deprecated.
            '-n'
        ]
        proc = Process(cmd, devnull=False)
        for line in proc.stdout().split('\n'):
            # Extract src, dst, and essid
            mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1]
            match = re.search('(%s) [^ ]* (%s).*.*SSID=(.*)$'
                % (mac_regex, mac_regex), line)
            if match == None:
                # Line doesn't contain src, dst, ssid
                continue
            (src, dst, essid) = match.groups()
            if dst.lower() == "ff:ff:ff:ff:ff:ff": continue
            if self.bssid:
                # We know the BSSID, only return the ESSID for this BSSID.
                if self.bssid.lower() == src.lower() or self.bssid.lower() == dst.lower():
                    essids.add((src, essid))
            else:
                # We do not know BSSID, add it.
                essids.add((src, essid))
        # Return list of tuples
        return [x for x in essids]
开发者ID:schoonc,项目名称:wifite2,代码行数:40,代码来源:Handshake.py

示例7: tshark_handshakes

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
    def tshark_handshakes(self):
        ''' Returns True if tshark identifies a handshake, False otherwise '''
        if not Process.exists('tshark'):
            return []

        target_client_msg_nums = {}

        # Dump EAPOL packets
        proc = Process(self.tshark_command(), devnull=False)
        for line in proc.stdout().split('\n'):
            # Extract source mac, destination mac, and message numbers
            mac_regex = ('[a-zA-Z0-9]{2}:' * 6)[:-1]
            match = re.search('(%s) -> (%s).*Message.*(\d).*(\d)'
                % (mac_regex, mac_regex), line)
            if match == None:
                # Line doesn't contain src, dst, Message numbers
                continue
            (src, dst, index, ttl) = match.groups()
            # "Message (index) of (ttl)"
            index = int(index)
            ttl = int(ttl)

            if ttl != 4:
                # Must be a 4-way handshake
                continue

            # Identify the client and target MAC addresses
            if index % 2 == 1:
                # First and Third messages
                target = src
                client = dst
            else:
                # Second and Fourth messages
                client = src
                target = dst

            if self.bssid and self.bssid.lower() != target.lower():
                # We know the BSSID and this msg was not for the target
                continue

            target_client_key = '%s,%s' % (target, client)

            # Ensure all 4 messages are:
            # Between the same client and target
            # In numeric & chronological order (1,2,3,4)
            if index == 1:
                # First message, add to dict
                target_client_msg_nums[target_client_key] = 1

            elif target_client_key not in target_client_msg_nums:
                # Not first message, we haven't gotten the first message yet
                continue

            elif index - 1 != target_client_msg_nums[target_client_key]:
                # Message is not in sequence
                continue

            else:
                # Message is > 1 and is received in-order
                target_client_msg_nums[target_client_key] = index

        bssids = set()
        # Check if we have all 4 messages for the handshake between the same MACs
        for (client_target, num) in target_client_msg_nums.iteritems():
            if num == 4:
                # We got a handshake!
                bssid = client_target.split(',')[0]
                bssids.add(bssid)

        return [(bssid, None) for bssid in bssids]
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:72,代码来源:Handshake.py

示例8: print_pyrit

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
 def print_pyrit(self, cap_file):
     if not Process.exists("pyrit"): return
     Color.pl("\n  {O}# PYRIT: GPU-based cracking. Fast.")
     Color.pl("  {G}pyrit {W}-i {C}%s {W}-r {C}%s {W}attack_passthrough{W}" % (self.wordlist, cap_file))
开发者ID:schoonc,项目名称:wifite2,代码行数:6,代码来源:CrackHandshake.py

示例9: print_aircrack

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import exists [as 别名]
 def print_aircrack(self, cap_file):
     if not Process.exists("aircrack-ng"): return
     Color.pl("\n  {O}# AIRCRACK: CPU-based cracking. Slow.")
     Color.pl("  {G}aircrack-ng {W}-a 2 -w {C}%s %s{W}" % (self.wordlist, cap_file))
开发者ID:schoonc,项目名称:wifite2,代码行数:6,代码来源:CrackHandshake.py


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