Exemple #1
0
def impuser(args):
    if args['username'] == None or args['password'] == None:
        logging.error("username or password has to be given")
    else:
        printT("Try to impersonate via creds...")
        imp = Impersonate()
        status = imp.impersonateViaCreds(
            login=args['username'],
            password=args['password'],
            domain=args['domain'],
            logonType=LOGON32_LOGON_INTERACTIVE,
            logonProvider=LOGON32_PROVIDER_DEFAULT)
        if status == True:
            printT("Impersonation success, try to spawn a shell...")
            printT(
                "SE_INCREASE_QUOTA_NAME and SE_ASSIGNPRIMARYTOKEN_NAME should be required"
            )
            imp.printCurrentThreadEffectiveToken(printFull=True,
                                                 printLinked=False)
            imp.executeCMDWithThreadEffectiveToken()
        else:
            logging.error("Impossible to impersonate via creds")
Exemple #2
0
# -*- coding: UTF-8 -*-
# By Quentin HARDY ([email protected]) - bobsecq

import sys
sys.path.append('../')
from impersonate import Impersonate
from utils import *

configureLogging()
imp = Impersonate()
imp.impersonateViaCreds(login='******',
                        password='******',
                        domain="theDOMAIN",
                        logonType=LOGON32_LOGON_INTERACTIVE,
                        logonProvider=LOGON32_PROVIDER_DEFAULT)
imp.printCurrentThreadEffectiveToken(printFull=False, printLinked=False)
imp.terminateImpersonation()