Python multiprocessing.forking.Popen() Examples
The following are 13
code examples of multiprocessing.forking.Popen().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
multiprocessing.forking
, or try the search function
.
Example #1
Source File: patator.py From patator with GNU General Public License v2.0 | 6 votes |
def __init__(self, *args, **kw): if hasattr(sys, 'frozen'): # We have to set original _MEIPASS2 value from sys._MEIPASS # to get --onefile mode working. os.putenv('_MEIPASS2', sys._MEIPASS) try: super(_Popen, self).__init__(*args, **kw) finally: if hasattr(sys, 'frozen'): # On some platforms (e.g. AIX) 'os.unsetenv()' is not # available. In those cases we cannot delete the variable # but only set it to the empty string. The bootloader # can handle this case. if hasattr(os, 'unsetenv'): os.unsetenv('_MEIPASS2') else: os.putenv('_MEIPASS2', '') # Second override 'Popen' class with our modified version.
Example #2
Source File: patator.py From patator with GNU General Public License v2.0 | 6 votes |
def execute(self, host, port='389', binddn='', bindpw='', basedn='', ssl='0'): uri = 'ldap%s://%s:%s' % ('s' if ssl != '0' else '', host, port) cmd = ['ldapsearch', '-H', uri, '-e', 'ppolicy', '-D', binddn, '-w', bindpw, '-b', basedn, '-s', 'one'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env={'LDAPTLS_REQCERT': 'never'}) out = p.stdout.read() err = p.stderr.read() with Timing() as timing: code = p.wait() mesg = repr((out + err).strip())[1:-1] trace = '[out]\n%s\n[err]\n%s' % (out, err) return self.Response(code, mesg, timing, trace) # }}} # SMB {{{
Example #3
Source File: patator.py From patator with GNU General Public License v2.0 | 6 votes |
def execute(self, host, port='3389', user=None, password=None): cmd = ['xfreerdp', '/v:%s:%d' % (host, int(port)), '/u:%s' % user, '/p:%s' % password, '/cert-ignore', '+auth-only', '/sec:nla', '/log-level:error'] with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode m = re.search(' (ERR.+?) ', err) if m: err = m.group(1) elif 'Authentication only, exit status 0' in err: err = 'OK' mesg = repr((out + err).strip())[1:-1] trace = '[out]\n%s\n[err]\n%s' % (out, err) return self.Response(code, mesg, timing, trace) # }}} # VNC {{{
Example #4
Source File: patator.py From patator with GNU General Public License v2.0 | 6 votes |
def execute(self, keystore, password, storetype='jks'): keystore = os.path.abspath(keystore) cmd = ['keytool', '-list', '-keystore', keystore, '-storepass', password, '-storetype', storetype] with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode mesg = repr(out.strip())[1:-1] trace = '%s\n[out]\n%s\n[err]\n%s' % (cmd, out, err) return self.Response(code, mesg, timing, trace) # }}} # SQLCipher {{{
Example #5
Source File: EventMonkey.py From EventMonkey with Apache License 2.0 | 6 votes |
def __init__(self, *args, **kw): if hasattr(sys, 'frozen'): # We have to set original _MEIPASS2 value from sys._MEIPASS # to get --onefile mode working. os.putenv('_MEIPASS2', sys._MEIPASS) try: super(_Popen, self).__init__(*args, **kw) finally: if hasattr(sys, 'frozen'): # On some platforms (e.g. AIX) 'os.unsetenv()' is not # available. In those cases we cannot delete the variable # but only set it to the empty string. The bootloader # can handle this case. if hasattr(os, 'unsetenv'): os.unsetenv('_MEIPASS2') else: os.putenv('_MEIPASS2', '') # Second override 'Popen' class with our modified version.
Example #6
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 6 votes |
def __init__(self, *args, **kw): if hasattr(sys, 'frozen'): # We have to set original _MEIPASS2 value from sys._MEIPASS # to get --onefile mode working. os.putenv('_MEIPASS2', sys._MEIPASS) try: super(_Popen, self).__init__(*args, **kw) finally: if hasattr(sys, 'frozen'): # On some platforms (e.g. AIX) 'os.unsetenv()' is not # available. In those cases we cannot delete the variable # but only set it to the empty string. The bootloader # can handle this case. if hasattr(os, 'unsetenv'): os.unsetenv('_MEIPASS2') else: os.putenv('_MEIPASS2', '') # Second override 'Popen' class with our modified version.
Example #7
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 6 votes |
def execute(self, host, port='389', binddn='', bindpw='', basedn='', ssl='0'): uri = 'ldap%s://%s:%s' % ('s' if ssl != '0' else '', host, port) cmd = ['ldapsearch', '-H', uri, '-e', 'ppolicy', '-D', binddn, '-w', bindpw, '-b', basedn, '-s', 'one'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env={'LDAPTLS_REQCERT': 'never'}) out = p.stdout.read() err = p.stderr.read() with Timing() as timing: code = p.wait() mesg = repr((out + err).strip())[1:-1] trace = '[out]\n%s\n[err]\n%s' % (out, err) return self.Response(code, mesg, timing, trace) # }}} # SMB {{{
Example #8
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 6 votes |
def execute(self, keystore, password, storetype='jks'): keystore = os.path.abspath(keystore) cmd = ['keytool', '-list', '-keystore', keystore, '-storepass', password, '-storetype', storetype] with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode mesg = repr(out.strip())[1:-1] trace = '%s\n[out]\n%s\n[err]\n%s' % (cmd, out, err) return self.Response(code, mesg, timing, trace) # }}} # SQLCipher {{{
Example #9
Source File: patator.py From patator with GNU General Public License v2.0 | 5 votes |
def __iter__(self): p = subprocess.Popen(self.prog.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p.stdout
Example #10
Source File: patator.py From patator with GNU General Public License v2.0 | 5 votes |
def execute(self, host, port='500', transform='5,1,1,2', aggressive='0', groupname='foo', vid=''): cmd = ['ike-scan', '-M', '--sport', self.sport, host, '--dport', port, '--trans', transform] if aggressive == '1': cmd.append('-A') if groupname: cmd.extend(['--id', groupname]) for v in vid.split(','): cmd.extend(['--vendor', v]) with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode trace = '%s\n[out]\n%s\n[err]\n%s' % (cmd, out, err) logger.debug('trace: %r' % trace) has_sa = 'SA=(' in out if has_sa: mesg = 'Handshake returned: %s (%s)' % (re.search('SA=\((.+) LifeType', out).group(1), re.search('\t(.+) Mode Handshake returned', out).group(1)) else: try: mesg = out.strip().split('\n')[1].split('\t')[-1] except: mesg = ' '.join(repr(s) for s in filter(None, [out, err])) resp = self.Response(code, mesg, timing, trace) if has_sa: endpoint = '%s:%s (%s Mode)' % (host, port, 'Aggressive' if aggressive == '1' else 'Main') resp.rrs = endpoint, transform return resp # }}} # Unzip {{{
Example #11
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 5 votes |
def __iter__(self): p = subprocess.Popen(self.prog.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p.stdout
Example #12
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 5 votes |
def execute(self, host, port='3389', user=None, password=None): cmd = ['xfreerdp', '/v:%s:%d' % (host, int(port)), '/u:%s' % user, '/p:%s' % password, '/cert-ignore', '+auth-only', '/sec:nla'] with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode err = err.replace('''Authentication only. Don't connect to X. credssp_recv() error: -1 freerdp_set_last_error 0x20009\n''', '') err = err.replace(''', check credentials. If credentials are valid, the NTLMSSP implementation may be to blame. Error: protocol security negotiation or connection failure Authentication only, exit status 1 Authentication only, exit status 1''', '') err = err.replace('''Authentication only. Don't connect to X. Authentication only, exit status 0 Authentication only, exit status 0''', 'OK') mesg = repr((out + err).strip())[1:-1] trace = '[out]\n%s\n[err]\n%s' % (out, err) return self.Response(code, mesg, timing, trace) # }}} # VNC {{{
Example #13
Source File: patator_ext.py From project-black with GNU General Public License v2.0 | 5 votes |
def execute(self, host, port='500', transform='5,1,1,2', aggressive='0', groupname='foo', vid=''): cmd = ['ike-scan', '-M', '--sport', self.sport, host, '--dport', port, '--trans', transform] if aggressive == '1': cmd.append('-A') if groupname: cmd.extend(['--id', groupname]) for v in vid.split(','): cmd.extend(['--vendor', v]) with Timing() as timing: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = map(B, p.communicate()) code = p.returncode trace = '%s\n[out]\n%s\n[err]\n%s' % (cmd, out, err) logger.debug('trace: %r' % trace) has_sa = 'SA=(' in out if has_sa: mesg = 'Handshake returned: %s (%s)' % (re.search('SA=\((.+) LifeType', out).group(1), re.search('\t(.+) Mode Handshake returned', out).group(1)) else: try: mesg = out.strip().split('\n')[1].split('\t')[-1] except: mesg = ' '.join(repr(s) for s in filter(None, [out, err])) resp = self.Response(code, mesg, timing, trace) if has_sa: endpoint = '%s:%s (%s Mode)' % (host, port, 'Aggressive' if aggressive == '1' else 'Main') resp.rrs = endpoint, transform return resp # }}} # Unzip {{{