|
|
@ -505,3 +505,21 @@ class varsShare:
|
|
|
|
reRes = reVer.search(kernelVersion)
|
|
|
|
reRes = reVer.search(kernelVersion)
|
|
|
|
if reRes:
|
|
|
|
if reRes:
|
|
|
|
return reRes.group()
|
|
|
|
return reRes.group()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reChroot = re.compile("^(?:_=.*bin/chroot|CHROOT=on)$",re.S)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def isChroot(self,pid):
|
|
|
|
|
|
|
|
"""Recursive detect chroot mode"""
|
|
|
|
|
|
|
|
if not os.access('/proc/%d/environ'%pid,R_OK):
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
if filter(self.reChroot.match,
|
|
|
|
|
|
|
|
open('/proc/%d/environ'%pid,'r').read().split('\x00')):
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
ppid = filter(lambda x:x.startswith('PPid:'),
|
|
|
|
|
|
|
|
open('/proc/%d/status'%pid,'r').readlines())[0]
|
|
|
|
|
|
|
|
ppid = int(ppid.strip().partition('\t')[2])
|
|
|
|
|
|
|
|
if ppid == 0:
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return self.isChroot(ppid)
|
|
|
|