K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / share / python3 / debpython /
server ip : 104.21.89.46

your ip : 172.69.130.124

H O M E


Filename/usr/share/python3/debpython/__init__.py
Size1.83 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:50
Last modified23-Mar-2014 16:17
Last accessed05-Jul-2025 20:15
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
try:
from datetime import datetime
except ImportError:
datetime = None
import logging
import re
from subprocess import PIPE, Popen
from pickle import dumps

log = logging.getLogger(__name__)
PUBLIC_DIR_RE = re.compile(r'.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packages')


class memoize:
def __init__(self, func):
self.func = func
self.cache = {}

def __call__(self, *args, **kwargs):
key = dumps((args, kwargs))
if key not in self.cache:
self.cache[key] = self.func(*args, **kwargs)
return self.cache[key]


def execute(command, cwd=None, env=None, log_output=None):
"""Execute external shell commad.

:param cdw: currennt working directory
:param env: environment
:param log_output:
* opened log file or path to this file, or
* None if output should be included in the returned dict, or
* False if output should be redirectored to stdout/stderr
"""
args = {'shell': True, 'cwd': cwd, 'env': env}
close = False
if log_output is False:
pass
elif log_output is None:
args.update(stdout=PIPE, stderr=PIPE)
elif log_output:
if isinstance(log_output, str):
close = True
log_output = open(log_output, 'a')
if datetime:
log_output.write('\n# command executed on {}'.format(datetime.now().isoformat()))
log_output.write('\n$ {}\n'.format(command))
log_output.flush()
args.update(stdout=log_output, stderr=log_output)

log.debug('invoking: %s', command)
with Popen(command, **args) as process:
stdout, stderr = process.communicate()
close and log_output.close()
return dict(returncode=process.returncode,
stdout=stdout and str(stdout, 'utf-8'),
stderr=stderr and str(stderr, 'utf-8'))