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


Python Process.split方法代码示例

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


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

示例1: terminate_conflicting_processes

# 需要导入模块: from Process import Process [as 别名]
# 或者: from Process.Process import split [as 别名]
    def terminate_conflicting_processes():
        ''' Deletes conflicting processes reported by airmon-ng '''

        '''
        % airmon-ng check

        Found 3 processes that could cause trouble.
        If airodump-ng, aireplay-ng or airtun-ng stops working after
        a short period of time, you may want to kill (some of) them!
        -e 
        PID Name
        2272    dhclient
        2293    NetworkManager
        3302    wpa_supplicant
        '''

        out = Process(['airmon-ng', 'check']).stdout()
        if 'processes that could cause trouble' not in out:
            # No proceses to kill
            return

        hit_pids = False
        for line in out.split('\n'):
            if re.search('^ *PID', line):
                hit_pids = True
                continue
            if not hit_pids: continue
            if line.strip() == '': continue
            match = re.search('^[ \t]*(\d+)[ \t]*([a-zA-Z0-9_\-]+)[ \t]*$', line)
            if match:
                # Found process to kill
                pid = match.groups()[0]
                pname = match.groups()[1]
                Color.pl('{!} {R}terminating {O}conflicting process' +
                         ' {R}%s{O} ({R}%s{O})' % (pname, pid))
                os.kill(int(pid), signal.SIGTERM)
开发者ID:HoMeCracKeR,项目名称:wifite2,代码行数:38,代码来源:Airmon.py


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