def findTargets(path): if path is None: return [] path = tuple(path.split('-')) result = [] if path not in targets.getTargets().groups: log.debug('missing target %s', path) for target in targets.getTargets().groups.get(path, []): keys = [var for var in target.data.itervalues() if var is not None] keys.append('-'.join(target.key)) result.append((target.path, keys)) return result
def loadMacroTargets(self): keys = ('macrodetails', 'universal', 'stature') import targets for i in xrange(3): key = keys[:i+1] for target in targets.getTargets().groups[key]: algos3d.getTarget(self.selectedHuman.meshData, target.path)
def loadMacroTargets(self): keys = ('macrodetails', 'universal', 'stature') import targets for i in xrange(3): key = keys[:i + 1] for target in targets.getTargets().groups[key]: algos3d.getTarget(self.selectedHuman.meshData, target.path)
def findMacroDependencies(path): result = set() if path is None: return result path = tuple(path.split('-')) for target in targets.getTargets().groups.get(path, []): keys = [key for key, var in target.data.items() if var is not None] result.update(keys) return result
def _loadExpressions(): expressions = [] exprTargets = targets.getTargets().findTargets('expression-units') for eComponent in exprTargets: name = eComponent.key # Remove 'expression-units' components from group name name = name[2:] expressions.append('-'.join(name)) return expressions
def findTargets(path): """ Retrieve a list of targets grouped under the specified target path (which is not directly a filesystem path but rather an abstraction with a path being a hierarchic string of atoms separated by a - symbol). The result is a list of tuples, with each tuple as: (targetpath, factordependencies) With targetpath referencing the filepath of the .target file, and factordependencies a list with the names of variables or factors that influence the weight with how much the target file is applied. The resulting weight with which a target is applied is the multiplication of all the factor values declared in the factorDependencies list. Some of these factordependencies come from predeclared macro parameters (such as age, race, weight, gender, ...) and are already supplied by the targets module which automatically extracts known parameters from the target path or filename. Additional factordependencies can be added at will to control the weighting of a target directly (for example to apply the value of this modifier to its targets). The other way of setting modifier values to factors to eventually set the weight of targets (which is used by macro modifiers) is to make sure the xVal variables of the human object are updated, by calling corresponding setters on the human object. getFactors() will by default resolve the values of known xVal variables to known factor variable names. factordependencies can be any name and are not restricted to tokens that occur in the target path. Though for each factordependency, getFactors() will have to return a matching value. """ if path is None: return [] path = tuple(path.split('-')) result = [] if path not in targets.getTargets().groups: log.debug('missing target %s', path) for target in targets.getTargets().groups.get(path, []): keys = [var for var in target.data.itervalues() if var is not None] keys.append('-'.join(target.key)) result.append((target.path, keys)) return result
def loadMacroTargets(self): """ Preload all target files belonging to group macrodetails and its child groups. """ import targets #import getpath for target in targets.getTargets().findTargets('macrodetails'): #log.debug('Preloading target %s', getpath.getRelativePath(target.path)) algos3d.getTarget(self.selectedHuman.meshData, target.path)
def findMacroDependencies(path): result = set() if path is None: return result path = tuple(path.split('-')) for target in targets.getTargets().groups.get(path, []): keys = [key for key, var in target.data.iteritems() if var is not None] result.update(keys) return result
def targets(self): """Load makehuman targets""" if self._targets is None: cwd = os.path.abspath('.') with self.mhpath: global _targets try: _targets == None except NameError: print "loading targets" self._targets = mhtargets.getTargets() else: print "targets preloaded" return self._targets
def findTargets(path): """ Retrieve a list of targets grouped under the specified target path (which is not directly a filesystem path but rather an abstraction with a path being a hierarchic string of atoms separated by a - symbol). The result is a list of tuples, with each tuple as: (targetpath, factordependencies) With targetpath referencing the filepath of the .target file, and factordependencies a list with the names of variables or factors that influence the weight with how much the target file is applied. The resulting weight with which a target is applied is the multiplication of all the factor values declared in the factorDependencies list. Some of these factordependencies come from predeclared macro parameters (such as age, race, weight, gender, ...) and are already supplied by the targets module which automatically extracts known parameters from the target path or filename. Additional factordependencies can be added at will to control the weighting of a target directly (for example to apply the value of this modifier to its targets). The other way of setting modifier values to factors to eventually set the weight of targets (which is used by macro modifiers) is to make sure the xVal variables of the human object are updated, by calling corresponding setters on the human object. getFactors() will by default resolve the values of known xVal variables to known factor variable names. factordependencies can be any name and are not restricted to tokens that occur in the target path. Though for each factordependency, getFactors() will have to return a matching value. """ if path is None: return [] try: targetsList = targets.getTargets().getTargetsByGroup(path) except KeyError: log.debug('missing target %s', path) targetsList = [] result = [] for component in targetsList: targetgroup = '-'.join(component.key) factordependencies = component.getVariables() + [targetgroup] result.append( (component.path, factordependencies) ) return result
def loadMacroTargets(self, human): ''' Preload all target files belonging to group macrodetails and its child groups. ''' import targets #import getpath print('Loading macroTargets :') i = 0 for target in targets.getTargets().findTargets('macrodetails'): print('\t%s' % target.path) #log.debug('Preloading target %s', getpath.getRelativePath(target.path)) algos3d.getTarget(human.meshData, target.path) i = i +1 print('Properly loaded %d macroTargets' % i)
def findImage(name): if name is None: return None name = name.lower() return targets.getTargets().images.get(name, name)
# -*- coding: utf-8 -*- import argparse import os import sys import numpy from PIL import Image import six.moves.cPickle as pickle train_image_dir = "data/bbox_image/" # --------------------------------------------------- # create train.txt import targets targets = targets.getTargets() if os.path.exists("train.txt"): os.remove("train.txt") f = open("train.txt","w") for fileName in os.listdir(train_image_dir): filePath = train_image_dir + fileName try: numpy.asarray(Image.open(filePath)).transpose(2, 0, 1) except: print "broken file" os.remove(filePath) continue wnid = fileName[:fileName.index("_")] print "wnid:%s" % wnid if wnid in targets: print "find target!:%s" % fileName
def initialization(): #check for root privilege if os.getuid() != 0: Color.pl('{!} {R}Error: {O} Wifikill {R} must run as {O} root {W}') Color.pl('{!} {R}R-run with {O} sudo {W}') #check if there is a network card with monito mode enabled command1 = "iwconfig" interfacesOutput = str( subprocess.check_output(command1, shell=True, stderr=subprocess.STDOUT)) interface_list = re.findall('Mode:Monitor', interfacesOutput) if len(interface_list) == 0: Color.pl( "{!} {R}Please make sure you have a {O}wireless card {R}in {O}monitor mode, {R}then try again {W}" ) return else: subprocess.run("iwconfig") time.sleep(0.5) Color.pl( "{+} {G}Enter {GR}name {G}of the {GR}interface {G} to use {D}[should be in monitor mode]{W} {G}: {W}" ) interface = input().strip() #check name of interface is correct try: subprocess.check_output("ifconfig " + interface, shell=True, stderr=subprocess.STDOUT) except: Color.pl("{!} {R}Error: Name of {O}interface {R}is incorrect") Color.pl("{!} {R}Re-run the program") return #check if aircrack-ng is installed try: Color.pl("\n{?} {C}Checking for aicrack-ng") time.sleep(0.5) subprocess.check_output("dpkg -s aircrack-ng", shell=True, stderr=subprocess.STDOUT) except: Color.pl( "{!} {R}Error: Make sure {O}aircrack-ng {R}is installed properly") Color.pl("{+} {G}Aicrack-ng is installed properly {W} \n") #get network to attack time.sleep(1) target_list = targets.getTargets(interface) select_target_text = '' for i in range(len(target_list)): select_target_text += Color.s(' {C}\t' + str(i + 1) + ": {G}" + target_list[i].essid + '\n {W}') print(select_target_text) Color.pl("\n{?} {C}Select target: {W}") target_index = int(input()) - 1 target = target_list[target_index] #get list of clients connected client_list = clients.getClients(target.bssid, target.channel, interface) #get list of clients to remove selected_list = select(target.bssid, target.channel, interface, client_list) Color.pl("{B} Starting deAuth request: {W}") time.sleep(1) deauth(target.bssid, target.channel, interface, selected_list)