[ SEA-GHOST MINI SHELL]
#!/usr/bin/env python2.7
from __future__ import print_function
import mmap
import os.path
def mapcount(filename):
f = open(filename, "r+")
try:
buf = mmap.mmap(f.fileno(), 0)
lines = 0
readline = buf.readline
while readline():
lines += 1
return lines
except:
return 0
with open('/etc/localdomains') as f:
localdomains = f.read().splitlines()
domainusers = {}
with open('/etc/userdomains') as f:
for line in f:
(key, val) = line.split(':')
domainusers[key] = val.strip()
filter = set(localdomains).intersection(domainusers.keys())
result = 0
for domain, user in domainusers.items():
if domain in filter:
fname = "~{0}/etc/{1}/passwd".format(user, domain)
fullpath = os.path.expanduser(fname)
if os.path.isfile(fullpath):
result += mapcount(fullpath)
print(result)
SEA-GHOST - SHELL CODING BY SEA-GHOST