Task
Model used by Barricane
492760
function Task(task) {
  _.extend(this, task);
  if (task != undefined) this.createId();

  // Short id
  this.__defineGetter__('id', function () {
    return this.__uuid__.substr(0, 8).toString();
  });

  // Keyword
  this.__defineGetter__('keyword', function () {
    return this.labels[0].replace('#', '').toUpperCase();
  });

  // Stemmed
  this.__defineGetter__('stemmed', function () {
    return (this.title+' '+this.body).toLowerCase()
      .split(' ').map(stem).join(' ');
  });

  // All
  this.__defineGetter__('all', function () {
    return '*';
  });
}
194822
def cli():
    """"""
    epilog = ('The actions are:\n'
            '\tnew\t\tCreate a new torn app\n'
            '\trun\t\tRun the app and start a Web server for development\n'
            '\tcontroller\tCreate a new controller\n'
            '\tversion\t\treturns the current version of torn\n')
    parser = ArgumentParser(prog='torn',
                            description='A full fledged MVC framework based on Tornado and Jinja2 templating',
                            formatter_class=RawDescriptionHelpFormatter,
                            epilog=epilog,
                            usage='%(prog)s [action [arguments]]')

    parser.add_argument('action',
                        nargs=1,
                        choices=['new', 'run', 'controller','version'],
                        help='Action to be performed with the application')

    parser.add_argument('--name',
                        type=str,
                        default="sampleApp",
                        help='Name for the given action')
    if len(sys.argv)==1:
        parser.print_help(sys.stderr)
        sys.exit(1)
    args = parser.parse_args()
    console.handler(args)
927045
public static <Result> TaskBuilder<Result> create(Callable<Result> action,
                                                      TaskCallback<Result> callback,
                                                      Object caller) {
        return new TaskBuilder<Result>().action(action).callback(callback).with(caller);
    }
716528
def _apply_concretization_strategies(self, addr, strategies, action):
        

        # we try all the strategies in order
        for s in strategies:
            # first, we trigger the SimInspect breakpoint and give it a chance to intervene
            e = addr
            self.state._inspect(
                'address_concretization', BP_BEFORE, address_concretization_strategy=s,
                address_concretization_action=action, address_concretization_memory=self,
                address_concretization_expr=e, address_concretization_add_constraints=True
            )
            s = self.state._inspect_getattr('address_concretization_strategy', s)
            e = self.state._inspect_getattr('address_concretization_expr', addr)

            # if the breakpoint None'd out the strategy, we skip it
            if s is None:
                continue

            # let's try to apply it!
            try:
                a = s.concretize(self, e)
            except SimUnsatError:
                a = None

            # trigger the AFTER breakpoint and give it a chance to intervene
            self.state._inspect(
                'address_concretization', BP_AFTER,
                address_concretization_result=a
            )
            a = self.state._inspect_getattr('address_concretization_result', a)

            # return the result if not None!
            if a is not None:
                return a

        # well, we tried
        raise SimMemoryAddressError(
            "Unable to concretize address for %s with the provided strategies." % action
        )
635184
function alterneigh(radius, i, b, g, r) {
    var lo = Math.abs(i - radius);
    var hi = Math.min(i + radius, netsize);

    var j = i + 1;
    var k = i - 1;
    var m = 1;

    var p, a;
    while ((j < hi) || (k > lo)) {
      a = radpower[m++];

      if (j < hi) {
        p = network[j++];
        p[0] -= (a * (p[0] - b)) / alpharadbias;
        p[1] -= (a * (p[1] - g)) / alpharadbias;
        p[2] -= (a * (p[2] - r)) / alpharadbias;
      }

      if (k > lo) {
        p = network[k--];
        p[0] -= (a * (p[0] - b)) / alpharadbias;
        p[1] -= (a * (p[1] - g)) / alpharadbias;
        p[2] -= (a * (p[2] - r)) / alpharadbias;
      }
    }
  }
1286769
def main():

    parser = argparse.ArgumentParser(description="An interface to CarbonBlack environments")

    #profiles = auth.CredentialStore("response").get_profiles()
    parser.add_argument('-e', '--environment', choices=auth.CredentialStore("response").get_profiles(),
                        help='specify a specific instance you want to work with. If not defined \'-t production\' will be used implicitly.')
    parser.add_argument('-t', '--envtypes', type=str, 
                        help='specify any combination of envtypes. Default=All \'production\' envtypes. Ignored if -e is set.',
                        default='production')
    #parser.add_argument('--debug', action='store_true', help='print debugging info')
    #parser.add_argument('--warnings', action='store_true',
    #                         help="Warn before printing large executions")

    subparsers = parser.add_subparsers(dest='command') #title='subcommands', help='additional help')
    cbinterface_commands = [ 'query', 'proc', 'collect', 'remediate', 'enumerate_usb', 'vxdetect']

    parser_vx = subparsers.add_parser('vxdetect', help="search cbsandbox for processes in vxstream report, show detections")
    parser_vx.add_argument('vxstream_report', help='path to vxstream report')
    parser_vx.add_argument('-p', '--print-process-tree', action='store_true', help='print the process tree')

    parser_usb = subparsers.add_parser('enumerate_usb', help="Show recent removable drive activity on the sensor")
    parser_usb.add_argument('sensor', help='hostname of the sensor')
    parser_usb.add_argument('-s', '--start-time', action='store',
                            help='how far back to query (default:ALL time)')

    parser_proc = subparsers.add_parser('proc', help="analyze a process GUID. 'proc -h' for more")
    parser_proc.add_argument('process', help="the process GUID to analyze")
    parser_proc.add_argument('--warnings', action='store_true',
                             help="Warn before printing large executions")
    parser_proc.add_argument('-w', '--walk-tree', action='store_true',
                             help="walk and analyze the process tree")
    parser_proc.add_argument('-wp', '--walk-parents', action='store_true',
                             help="print details on the process ancestry")
    #parser_proc.add_argument('-d', '--detection', action='store_true',
    #                         help="show detections that would result in ACE alerts")
    parser_proc.add_argument('-i', '--proc-info', action='store_true',
                             help="show binary and process information")
    parser_proc.add_argument('-c','--show-children', action='store_true',
                             help="only print process children event details")
    parser_proc.add_argument('-nc', '--netconns', action='store_true',
                             help="print network connections")
    parser_proc.add_argument('-fm', '--filemods', action='store_true',
                             help="print file modifications")
    parser_proc.add_argument('-rm', '--regmods', action='store_true',
                             help="print registry modifications")
    parser_proc.add_argument('-um', '--unsigned-modloads', action='store_true',
                             help="print unsigned modloads")
    parser_proc.add_argument('-ml', '--modloads', action='store_true',
                             help="print modloads")
    parser_proc.add_argument('-cp', '--crossprocs', action='store_true',
                             help="print crossprocs")
    #parser_proc.add_argument('-intel', '--intel-hits', action='store_true',
    #                         help="show intel (feed/WL) hits that do not result in ACE alerts")
    parser_proc.add_argument('--no-analysis', action='store_true',
                             help="Don't fetch and print process activity")
    parser_proc.add_argument('--json', action='store_true', help='output process summary in json')
    parser_proc.add_argument('--segment-limit', action='store', type=int, default=None,
                             help='stop processing events into json after this many process segments')

    facet_args = [
        'process_name', 'childproc_name', 'username', 'parent_name', 'path', 'hostname',
        'parent_pid', 'comms_ip', 'process_md5', 'start', 'group', 'interface_ip',
        'modload_count', 'childproc_count', 'cmdline', 'regmod_count', 'process_pid',
        'parent_id', 'os_type', 'rocessblock_count', 'crossproc_count', 'netconn_count',
        'parent_md5', 'host_type', 'last_update', 'filemod_count'
        ]
 
    parser_query = subparsers.add_parser('query',
                                         help="execute a process search query. 'query -h' for more")
    parser_query.add_argument('query', help="the process search query you'd like to execute")
    parser_query.add_argument('-s', '--start-time', action='store',
                              help="Only return processes with events after given date/time stamp\
 (server’s clock). Format:'Y-m-d H:M:S' eastern time")
    parser_query.add_argument('-e', '--end-time', action='store',
                              help="Set the maximum last update time. Format:'Y-m-d H:M:S' eastern time")
    parser_query.add_argument('--facet', action='store', choices=facet_args,
                              help='stats info on single field accross query results (ex. process_name)')
    parser_query.add_argument('--no-warnings', action='store_true',
                             help="Don't warn before printing large query results")
    parser_query.add_argument('-lh', '--logon-history', action='store_true', help="Display available logon history for given username or hostname")

    parser_collect = subparsers.add_parser('collect', help='perform LR collection tasks on a host')
    parser_collect.add_argument('sensor', help="the hostname/sensor to collect from")
    parser_collect.add_argument('-f', '--filepath', action='store', help='collect file')
    parser_collect.add_argument('-c', '--command-exec', action='store', help='command to execute')
    parser_collect.add_argument('-p', '--process-list', action='store_true', 
                                help='show processes running on sensor')
    parser_collect.add_argument('-m', '--memdump', action='store', const='ALLMEM', nargs='?',
                                help='dump memory on a specific process-id')
    parser_collect.add_argument('-lr', '--regkeypath', action='store',
                                help='List all registry values from the specified registry key.')
    parser_collect.add_argument('-r', '--regkeyvalue', action='store',
                                help='Returns the associated value of the specified registry key.')
    parser_collect.add_argument('-i', '--info', action='store_true', help='print sensor information')
    parser_collect.add_argument('-gst', '--get-task', action='store_true', help='get scheduled tasks or specifc task')
    parser_collect.add_argument('-mc', '--multi-collect', action='store', help='path to ini file listing files and regs to collect')

    remediate_file_example = """Example remediate ini file:
    [files]
    file1=C:\\Users\\user\\Desktop\\testfile.txt 

    [process_names]
    proc1=cmd.exe
    proc2=notepad++.exe
     
    [directories]
    directory1=C:\\Users\\user\\Desktop\\nanocore
     
    [scheduled_tasks]
    task1=\\monkey_task
    task1=\\Microsoft\\windows\\some\\flake\\task

    [pids]
    pid1=10856
     
    [registry_paths]
    reg1=HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\calc
    reg2=HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\hippo"""

    parser_remediate = subparsers.add_parser('remediate', help='remediate a host')
    parser_remediate.add_argument('sensor', help="the hostname/sensor needing remediation")
    parser_remediate.add_argument('-i', '--isolate', help='toggle host isolation', default=False, action='store_true')
    parser_remediate.add_argument('-f', '--remediation-filepath',
                                  help="path to the remediation ini file; 'help' as the filepath for example")
    parser_remediate.add_argument('-dst', '--delete-scheduled-task',
                                  help="path of scheduled task to delete")
    parser_remediate.add_argument('-kpname', '--kill-process-name', help="kill all processes with this name")
    parser_remediate.add_argument('-kpid', '--kill-pid', help="a process id to kill")
    parser_remediate.add_argument('-df', '--delete-file', help="path to file needing deletion")
    parser_remediate.add_argument('-dr', '--delete-regkey', help="path to regkey value needing deletion")
    parser_remediate.add_argument('-dd', '--delete-directory', help="path to directory needing deletion")
    args = parser.parse_args()

    if args.command == 'remediate' and args.remediation_filepath == 'help':
        print(remediate_file_example)
        parser.parse_args(['remediate', '-h'])

    if args.command is None:
        print("\n\n*****")
        print("You must specify one of the following commands:\n")
        print(cbinterface_commands)
        print("\n*****\n\n")
        parser.parse_args(['-h'])

    #args.debug = True
    #if args.debug:
    # configure some more logging
    root = logging.getLogger()
    root.addHandler(logging.StreamHandler())
    logging.getLogger("cbapi").setLevel(logging.ERROR)
    logging.getLogger("lerc_api").setLevel(logging.WARNING)

    '''  '''
    if args.command == 'vxdetect':
        cb = CbResponseAPI(profile='vxstream')
        process_list = parse_vxstream_report(cb, args.vxstream_report)
        if args.print_process_tree:
            print()
            print(process_list)
        print()
        return 0


    # Set up environment profiles
    profile = None
    profiles = []
    if args.environment: 
        print("Using {} environment ..".format(args.environment))
        profiles.append(args.environment)
    else:
        # a little hack for getting our environment type variable defined
        default_profile = auth.default_profile
        default_profile['envtype'] = 'production'
        query_envtype = set(args.envtypes.lower().split(','))
        for profile in auth.CredentialStore("response").get_profiles():
            credentials = auth.CredentialStore("response").get_credentials(profile=profile)
            profile_envtype = set(credentials['envtype'].lower().split(','))
            if(query_envtype.issubset(profile_envtype)):
                profiles.append(profile)
        
        


    # Process Quering #
    if args.command == 'query':
        for profile in profiles:
            handle_proxy(profile)
            print("\nSearching {} environment..".format(profile))
            q = CBquery(profile=profile)
            q.process_query(args)
        return 0


    # Select correct environment by sensor hostname and get the sensor object
    sensor = None
    if args.command == 'collect' or args.command == 'remediate' or args.command == 'enumerate_usb':
        cb_results = sensor_search(profiles, args.sensor)
        if not isinstance(cb_results, list):
            # an error occured
            return cb_results
        else:
            if not cb_results:
                LOGGER.info("A sensor with hostname {} wasn't found in any environments".format(args.sensor))
                return 0
            elif len(cb_results) > 1:
                LOGGER.error("A sensor by hostname {} was found in multiple environments".format(args.sensor))
                for r in cb_results:
                    print("Results:")
                    print("Profile {}: {} (SID:{})".format(r[1],r[0].hostname,r[0].id))
                return 1
            results = cb_results[0]
            profile = results[1]
            sensor = results[0]


    # Show USB Regmod activity
    if args.command == 'enumerate_usb':
        enumerate_usb(sensor, args.start_time)


    # lerc install arguments can differ by company/environment
    # same lazy hack to define in cb config
    config = {}
    try:
        default_profile = auth.default_profile
        default_profile['lerc_install_cmd'] = None
        config = auth.CredentialStore("response").get_credentials(profile=profile)
    except:
        pass


    # Collection #
    if args.command == 'collect':
        hyper_lr = hyperLiveResponse(sensor)

        if args.info:
            print(hyper_lr)
            return True

        # start a cb lr session
        lr_session = hyper_lr.go_live()

        if args.multi_collect:
            filepaths = regpaths = full_collect = None
            config = ConfigParser()
            config.read(args.multi_collect)
            try:
                filepaths = config.items("files")
            except:
                filepaths = []
            try:
                regpaths = config.items("registry_paths")
            except:
                regpaths = []
            try:
                full_collect = config.get('full_collect', 'action')
            except:
                pass

            if regpaths is not None:
                for regpath in regpaths:
                    if isinstance(regpath, tuple):
                        regpath = regpath[1]
                    print("~ Trying to get {}".format(regpath))
                    try:
                        result = lr_session.get_registry_value(regpath)
                        if result:
                            localfname = args.sensor + '_regkey_' + result['value_name'] + ".txt"
                            with open(localfname,'wb') as f:
                                f.write(bytes(result['value_data'], 'UTF-8'))
                            print("\t+ Data written to: {}".format(localfname))
                    except Exception as e:
                        print("[!] Error: {}".format(str(e)))
            if filepaths is not None:
                for filepath in filepaths:
                    try:
                        hyper_lr.getFile_with_timeout(filepath[1])
                    except Exception as e:
                        print("[!] Error: {}".format(str(e)))
            if full_collect == 'True':
               return False #LR_collection(hyper_lr, args)
            return True

        elif args.filepath:
            hyper_lr.getFile_with_timeout(args.filepath)

        elif args.process_list:
            hyper_lr.print_processes()

        elif args.memdump:
            # get config items
            config = ConfigParser()
            config.read(CONFIG_PATH)
            #if config.has_section('memory'):
            #    if 
            cb_compress = config['memory'].getboolean('cb_default_compress')
            custom_compress = config['memory'].getboolean('custom_compress')
            custom_compress_file = config['memory']['custom_compress_file']
            auto_collect_mem = config['memory'].getboolean('auto_collect_mem_file')
            lerc_collect_mem = config['memory'].getboolean('lerc_collect_mem')
            path_to_procdump = config['memory']['path_to_procdump']
            
            if args.memdump == "ALLMEM":
                return hyper_lr.dump_sensor_memory(cb_compress=cb_compress, custom_compress=custom_compress,
                                                   custom_compress_file=custom_compress_file,
                                                   auto_collect_result=auto_collect_mem)
            else:
                return hyper_lr.dump_process_memory(args.memdump, path_to_procdump=path_to_procdump)

        elif args.command_exec:
            print("executing '{}' on {}".format(args.command_exec, args.sensor))
            result = lr_session.create_process(args.command_exec, wait_timeout=60, wait_for_output=True)
            print("\n-------------------------")
            result = result.decode('utf-8')
            print(result + "\n-------------------------")
            print()

        elif args.regkeypath:
            print("\n\t{}".format(args.regkeypath))
            results = lr_session.list_registry_keys(args.regkeypath)
            for result in results:
                print("\t-------------------------")
                print("\tName: {}".format(result['value_name']))
                print("\tType: {}".format(result['value_type']))
                print("\tData: {}".format(result['value_data']))
                print()

        elif args.regkeyvalue:
            print("\n\t{}".format(args.regkeyvalue))
            result = lr_session.get_registry_value(args.regkeyvalue)
            print("\t-------------------------")
            print("\tName: {}".format(result['value_name']))
            print("\tType: {}".format(result['value_type']))
            print("\tData: {}".format(result['value_data']))
            print()

        elif args.get_task:
            return hyper_lr.get_scheduled_tasks()

        else:
            # perform full live response collection
            if config['lerc_install_cmd']:
                result = hyper_lr.get_lerc_status()
                if not result or result == 'UNINSTALLED' or result == 'UNKNOWN':
                   if not hyper_lr.deploy_lerc(config['lerc_install_cmd']):
                       LOGGER.warn("LERC deployment failed")
            else:
                LOGGER.info("{} environment is not configrued for LERC deployment".format(profile))
            return LR_collection(hyper_lr, args)

    # Remediation #
    if args.command == 'remediate':
        return Remediation(sensor, args)


    # Process Investigation #
    process_tree = None
    if args.command == 'proc':
        proc = proc_search_environments(profiles, args.process)
        if not proc:
            return 1
        sp = SuperProcess(proc)
        if args.proc_info:
            print(sp)
        elif args.walk_tree:
            sp.walk_process_tree()
            print()
            print(sp.process_tree)

            for process in sp.process_tree:
                if process.is_suppressed:
                    print("+  [DATA SUPPRESSED] {} (PID:{}) - {}".format(process.name, process.pid,
                                                                         process.id))
                    continue

                print("+  {} (PID:{}) - {}".format(process.name, process.pid, process.id))
                if args.filemods:
                    process.print_filemods()
                    args.no_analysis = True
                if args.netconns:
                    process.print_netconns()
                    args.no_analysis = True
                if args.regmods:
                    process.print_regmods()
                    args.no_analysis = True
                if args.unsigned_modloads:
                    process.print_unsigned_modloads()
                    args.no_analysis = True
                if args.modloads:
                    process.print_modloads()
                    args.no_analysis = True
                if args.crossprocs:
                    process.print_crossprocs()
                    args.no_analysis = True
                if args.walk_parents:
                    sp.show_ancestry()
                    args.no_analysis = True
                if args.no_analysis != True:
                    if args.json:
                        if args.segment_limit:
                            print(process.events_to_json(segment_limit=args.segment_limit))
                        else:
                            print(process.events_to_json())
                    else:
                        process.default_print()
        else:
            print()
            print(sp.process_tree)
            if args.walk_parents:
                sp.show_ancestry()
                args.no_analysis = True
            if args.filemods:
                sp.print_filemods()
                args.no_analysis = True
            if args.netconns:
                sp.print_netconns()
                args.no_analysis = True
            if args.regmods:
                sp.print_regmods()
                args.no_analysis = True
            if args.unsigned_modloads:
                sp.print_unsigned_modloads()
                args.no_analysis = True
            if args.modloads:
                sp.print_modloads()
                args.no_analysis = True
            if args.crossprocs:
                sp.print_crossprocs()
                args.no_analysis = True
            if args.show_children:
                sp.print_child_events()
                args.no_analysis = True

            if args.no_analysis != True:
                if args.json:
                    if args.segment_limit:
                        print(sp.events_to_json(segment_limit=args.segment_limit))
                    else:
                        print(sp.events_to_json())
                else:
                    sp.default_print()

        
    print()
    return True
53427
private List<String> buildLaunchTaskArgs(TaskControllerContext context) {
    List<String> commandArgs = new ArrayList<String>(3);
    String taskId = context.task.getTaskID().toString();
    String jobId = getJobId(context);
    LOG.debug("getting the task directory as: " 
        + getTaskCacheDirectory(context));
    commandArgs.add(getDirectoryChosenForTask(
        new File(getTaskCacheDirectory(context)), 
        context));
    commandArgs.add(jobId);
    if(!context.task.isTaskCleanupTask()) {
      commandArgs.add(taskId);
    }else {
      commandArgs.add(taskId + TaskTracker.TASK_CLEANUP_SUFFIX);
    }
    return commandArgs;
  }
522190
def bf(items, targets, **kwargs):
    
    bins = [(target, []) for target in targets]
    skip = []

    for item in items:
        containers = []
        capacities = []
        for target, content in bins:
            capacity = target - sum(content)
            if item <= capacity:
                containers.append(content)
                capacities.append(capacity - item)

        if len(capacities):
            weighted = zip(containers, weight(capacities, **kwargs))
            content, _ = min(weighted, key=operator.itemgetter(1))
            content.append(item)
        else:
            skip.append(item)
    return bins, skip
595323
def cli(ctx, list, verbose, exe):
    """"""

    if list:  # pragma: no cover
        profile = Profile()
        profile.list()
    elif verbose:  # pragma: no cover
        profile = Profile()
        profile.add_config('verbose', verbose)
    elif exe:  # pragma: no cover
        profile = Profile()
        profile.add_config('exe', exe)
    else:
        click.secho(ctx.get_help())
1307918
def do_job(args)
      @cd = CovData.new
      model_files = process_args args
      usage 'Missed model file', USAGE_INFO if model_files.empty?
      parse_models model_files
      @cd.set_processing_date
      @cd.type = CoverageDataType::TEMPLATE
      @cd.save(@template_file)
    end
1056261
function task() {

	// generate commit using default global release environment options
	var commitTask = coopt._getCommitTask();
	var commit = commitTask.commit;

	// register or run the release task (depends on task runner)
	rbot.task(commitTask.commitOpts.pluginName, commitTask.commitOpts.pluginDesc,
			function releaseTask() {
				var options = this.options(commitTask.defaultTaskOptions);
				if (options.gitHostname && commit.username) {
					options.hideTokenRegExp = new RegExp('(' + commit.username + ':)([0-9a-f]+)(@'
							+ options.gitHostname + ')');
				}
				release(this, options);
			});

	/**
	 * When a release commit message is received a release is performed and a
	 * repository web site is published
	 * 
	 * @param task
	 *            the currently running task
	 * @param options
	 *            the task options
	 */
	function release(task, options) {
		var doneAsync = null;

		// validate commit
		if (!commit.versionValidate()) {
			return;
		}
		rbot.log.info('Preparing release: ' + commit.version + ' (last release: '
				+ (commit.prev.versionTag ? commit.prev.versionTag : 'N/A') + ')');
		var useGitHub = options.gitHostname.toLowerCase() === github.hostname;

		var tmpltData = genTemplateData('name', 'pkgCurrVerBumpMsg', 'pkgNextVerBumpMsg', 'distBranchPubMsg');

		var chgLogRtn = '', athrsRtn = '', pubHash = '', distAssets = [];
		var distZipAsset = '', distTarAsset = '', distZipAssetName = '', distTarAssetName = '';
		var pubSrcDir = options.distDir ? path.join(commit.buildDir, options.distDir) : commit.buildDir;
		var pubDistDir = options.distBranch ? commit.buildDir.replace(commit.reponame, options.distBranch) : '';

		// initialize library instances
		var rollCall = new RollCall(options);
		var cmdObj = new Cmd(commit, options, rollCall);
		var cmd = cmdObj.cmd;
		var chkoutRun = cmdObj.chkoutRun;
		var pack = new Pack(commit, options, rollCall, cmdObj);

		// start work
		rollCall.then(remoteSetup).then(pkgUpdate).then(changeLog).then(authorsLog).then(addAndCommitDistDir).then(
				genDistAssets);
		rollCall.then(function() {
			if (useGitHub) {
				doneAsync = task.async();
				rollCall.then(gitHubRelease);
			} else {
				rollCall.then(gitRelease);
			}
		});
		// begin release
		rollCall.start(function(rbcnt) {
			var ecnt = rollCall.errorCount();
			var msg = ecnt > 0 ? 'Processed ' + rbcnt + ' rollback action(s)' : 'Released ' + commit.versionTag;
			rbot.log.info(msg);

			// non-critical cleanup
			try {
				if (ecnt <= 0 && tmpltData.pkgNextVerBumpMsg) {
					// bump to next version
					pkgUpdate(null, null, false, true, true);
				}
			} catch (e) {
				rollCall.error('Failed to bump next release version', e);
			}
			try {
				// update the commit task
				coopt._cloneAndSetCommitTask(commitTask);
			} catch (e) {
				rollCall.error('Failed to set global commit result properties', e);
			}

			// complete
			if (doneAsync) {
				doneAsync(ecnt <= 0);
			} else if (ecnt > 0) {
				throw new Error('Release failed');
			}
		});

		/**
		 * Generates an object that contains each of the passed arguments as a
		 * property with a value of an option with the same name. Each property
		 * will have a value for that option that is parsed using the template
		 * processor.
		 * 
		 * @returns the parsed template data
		 */
		function genTemplateData() {
			var templateData = {
				data : {
					process : process,
					commit : commit,
					env : commitTask.commitOpts,
					options : options
				}
			};
			var rtn = {};
			var arr = Array.prototype.slice.call(arguments, 0);
			arr.forEach(function genIntMsgs(s) {
				rtn[s] = options[s] ? rbot.processTemplate(options[s], templateData) : '';
				if (rtn[s]) {
					rbot.log.verbose(s + ' = ' + rtn[s]);
				}
			});
			return rtn;
		}

		/**
		 * Remote Git setup to permit pushes
		 */
		function remoteSetup() {
			var link = '${GH_TOKEN}@' + options.gitHostname + '/' + commit.slug + '.git';
			cmd('git config --global user.email "' + options.repoEmail + '"');
			cmd('git config --global user.name "' + options.repoUser + '"');
			cmd('git remote rm ' + options.repoName);
			cmd('git remote add ' + options.repoName + ' https://' + commit.username + ':' + link);
		}

		/**
		 * Updates the package file version using the current {Commit} version
		 * and commits/pushes it to remote
		 * 
		 * @param altPkgPath
		 *            the alternative path to the package that will be updated
		 * @param altPkgBowerPath
		 *            the alternative path to the bower package that will be
		 *            updated
		 * @param noPush
		 *            true to only update the package file
		 * @param isNext
		 *            true when the version should be updated to the next
		 *            version versus the default current one
		 * @param noRollback
		 *            true to exclude a rollback for the update
		 */
		function pkgUpdate(altPkgPath, altPkgBowerPath, noPush, isNext, noRollback) {
			chkoutRun(commit.branch, upkg, false, isNext);
			if (!noRollback) {
				rollCall.addRollback(function pkgUpdateRollback() {
					chkoutRun(commit.branch, upkg, true);
				});
			}
			function upkg(revert, next) {
				commit.versionPkg({
					replacer : options.pkgJsonReplacer,
					space : options.pkgJsonSpace,
					revert : revert,
					next : next,
					altWrite : pkgWritable,
					altPkgPath : altPkgPath,
					altPkgPathBower : altPkgBowerPath
				}, pkgPush);
			}
			function pkgWritable(pkgData) {
				pkgLog(pkgData, true);
				return pkgData.pkgStr;
			}
			function pkgPush(pd, pdBower) {
				// TODO : check to make sure there isn't any commits ahead of
				// this one
				if (!noPush && (pd.u || pd.r || pd.n)) {
					cmd('git commit -q -m "' + (pd.r ? 'Rollback: ' : '')
							+ (pd.n ? tmpltData.pkgNextVerBumpMsg : tmpltData.pkgCurrVerBumpMsg) + '" ' + pd.p);
					cmd('git push ' + options.repoName + ' ' + commit.branch);
				}
				pkgLog(pd, false);
				pkgLog(pdBower, false);
			}
			function pkgLog(pd, beforeWrite) {
				if (!pd) {
					return;
				}
				var skip = !pd.n && !pd.r && !pd.u;
				var m = (skip ? 'Skip' : pd.r ? 'Revert' : 'Bump') + (beforeWrite ? 'ing' : (skip ? 'p' : '') + 'ed')
						+ (skip ? ' write:' : pd.n ? ' next' : '') + ' version from ' + pd.oldVer + ' to '
						+ pd.pkg.version + ' in ' + pd.path;
				if (pd.r) {
					rbot.log.verbose(m);
				} else {
					rbot.log.info(m);
				}
			}
		}

		/**
		 * Generates/Writes a change log for the current release using all
		 * messages since last tag/release
		 */
		function changeLog() {
			// Generate change log for release using all messages since last
			// tag/release
			if (!options.chgLog) {
				if (options.chgLogRequired) {
					throw new Error('Invalid "options.chgLog": "' + options.chgLog + '" ("options.chgLogRequired": '
							+ options.chgLogRequired + '"');
				}
				return;
			}
			var chgLogPath = path.join(options.distDir, options.chgLog);
			var lastGitLog = commit.prev && !commit.prev.versionVacant() ? commit.prev.versionTag + '..HEAD' : 'HEAD';
			chgLogRtn = cmd('git --no-pager log ' + lastGitLog + ' --pretty=format:"' + options.chgLogLineFormat
					+ '" > ' + chgLogPath, null, false, chgLogPath, options.chgLogSkipRegExps, '<!-- Commit '
					+ commit.hash + ' -->\n')
					|| '';
			utils.validateFile(chgLogPath, rollCall);
		}

		/**
		 * Generates/Writes an authors log for the current release using all
		 * authors since last tag/release
		 */
		function authorsLog() {
			// Generate list of authors/contributors since last tag/release
			if (!options.authors) {
				if (options.authorsRequired) {
					throw new Error('Invalid "options.authors": "' + options.authors + '" ("options.authorsRequired": '
							+ options.authorsRequired + '"');
				}
				return;
			}
			var athrsPath = path.join(options.distDir, options.authors);
			athrsRtn = cmd('git --no-pager shortlog -sen HEAD > ' + athrsPath, null, false, athrsPath,
					options.authorsSkipLineRegExp)
					|| '';
			utils.validateFile(athrsPath, rollCall);
		}

		/**
		 * Adds/Commits everything in the distribution directory for tracking
		 */
		function addAndCommitDistDir() {
			if (commit.pkgPath && options.distDir && !/^(?:\.|\/)[^\.]/.test(options.distDir)) {
				// need to update the package included in the distribution
				pkgUpdate(path.join(options.distDir, commit.pkgPath), commit.pkgPathBower ? path.join(options.distDir,
						commit.pkgPathBower) : null, true, false);
			}
			if (options.distDir || athrsRtn || chgLogRtn) {
				if (options.distDir) {
					cmd('git add --force ' + options.distDir);
				}
				// Commit changes (needed to generate archive asset)
				cmd('git commit -q -m "' + tmpltData.distBranchPubMsg + '"');
			}
		}

		/**
		 * Generates distribution archive assets (i.e. zip/tar)
		 */
		function genDistAssets() {
			if (!options.distDir) {
				rbot.log.info('Skipping generation of distribution assets (no distDir)');
				return;
			}
			if (!options.distAssetDir) {
				rbot.log.info('Skipping generation of distribution assets (no distAssetDir)');
				return;
			}
			// give taskateers a chance to update branch file contents
			utils.updateFiles(options.distAssetUpdateFiles, options.distAssetUpdateFunction, commit.buildDir,
					rollCall.error);
			// Create distribution assets
			distZipAssetName = commit.reponame + '-' + commit.version + '-dist.zip';
			distZipAsset = genAsset(distZipAssetName, 'zip', true, 'application/zip');
			distTarAssetName = commit.reponame + '-' + commit.version + '-dist.tar.gz';
			distTarAsset = genAsset(distTarAssetName, 'tar.gz', false, 'application/x-compressed');

			/**
			 * Generates an Git archive asset and pushes an object
			 * w/path/name/contentType to the distribution assets {Array}
			 * 
			 * @param name
			 *            the name of the asset file
			 * @param type
			 *            the type/format the asset represents
			 * @param compress
			 *            true to add the compression ratio to the Git command
			 * @param ct
			 *            the Content-Type
			 * @returns the file path to the asset
			 */
			function genAsset(name, type, compress, ct) {
				var a = path.resolve(options.distAssetDir, name);
				cmd('git archive -o "' + a + '" --format=' + type
						+ (compress ? ' -' + options.distAssetCompressRatio : '') + ' HEAD:' + options.distDir);
				if (rbot.log.verboseEnabled) {
					rbot.log.verbose('Created ' + a + ' (size: ' + fs.statSync(a).size + ')');
				}
				distAssets.push({
					path : a,
					name : name,
					contentType : ct
				});
				return a;
			}
		}

		/**
		 * Tags release via standard Git CLI
		 */
		function gitRelease() {
			// Tag release
			rbot.log.info('Tagging release ' + commit.versionTag + ' via ' + options.gitHostname);
			cmd('git tag -f -a ' + commit.versionTag + ' -m "'
					+ (chgLogRtn ? chgLogRtn.replace(coopt.regexLines, '$1 \\') : commit.message) + '"');
			cmd('git push -f ' + options.repoName + ' ' + commit.versionTag);
			commit.releaseId = commit.versionTag;
			// TODO : upload asset?
			rollCall.addRollback(rollbackTag);
			rollCall.then(publish);
		}

		/**
		 * Calls the GitHub Release API to tag release and upload optional
		 * distribution asset
		 */
		function gitHubRelease() {
			rbot.log.info('Releasing ' + commit.versionTag + ' via ' + options.gitHostname);
			// GitHub Release API will not remove the tag when removing a
			// release
			github.releaseAndUploadAsset(distAssets, coopt.regexLines, commit, tmpltData.name, chgLogRtn
					|| commit.message, options, rollCall, rollbackTag, function() {
				rollCall.then(publish);
			});
		}

		/**
		 * Publish repository pages to distribution branch (commit should have a
		 * valid ID)
		 */
		function publish() {
			if (!options.distBranch) {
				rbot.log.info('Skipping publishing from "' + pubSrcDir + '" to ' + pubDistDir + ' (no distBranch)');
				return;
			} else if (!commit.releaseId) {
				rbot.log.info('Skipping publishing from "' + pubSrcDir + '" to "' + pubDistDir + '" in branch "'
						+ options.distBranch + '" (no releaseId/tag)');
				return;
			}
			rbot.log.info('Publishing to branch "' + options.distBranch + '"');
			rbot.log.info('Copying publication directories/files from "' + pubSrcDir + '" to "' + pubDistDir + '"');
			// copy all directories/files over that need to be published
			// so that they are not removed by the following steps
			rbot.log.info(utils.copyRecursiveSync(pubSrcDir, pubDistDir, options.distExcludeDirRegExp,
					options.distExcludeFileRegExp).toString());
			// cmd('cp -r ' + path.join(pubSrcDir, '*') + ' ' + pubDistDir);
			chkoutRun(null, publishRun);
			function publishRun() {
				try {
					cmd('git fetch ' + options.repoName + ' ' + options.distBranch);
					pubHash = cmd('git rev-parse HEAD');
				} catch (e) {
					if (util.isRegExp(options.distBranchCreateRegExp) && options.distBranchCreateRegExp.test(e.message)) {
						cmd('git checkout -q --orphan ' + options.distBranch);
					} else {
						throw e;
					}
				}
				if (pubHash) {
					cmd('git checkout -q --track ' + options.repoName + '/' + options.distBranch);
				}
				cmd('git rm -rfq .');
				cmd('git clean -dfq .');
				rbot.log.info('Copying publication directories/files from "' + pubDistDir + '" to "' + commit.buildDir
						+ '"');
				rbot.log.info(utils.copyRecursiveSync(pubDistDir, commit.buildDir).toString());
				// cmd('cp -r ' + path.join(pubDistDir, '*') + '
				// .');

				// give taskateers a chance to update branch file
				// contents
				utils.updateFiles(options.distBranchUpdateFiles, options.distBranchUpdateFunction, commit.buildDir,
						rollCall.error);

				cmd('git add -A');
				cmd('git commit -q -m "' + tmpltData.distBranchPubMsg + '"');
				cmd('git push -f ' + options.repoName + ' ' + options.distBranch);

				rollCall.addRollback(rollbackPublish);
				rollCall.then(pack.publish);
			}
		}

		/**
		 * Deletes tag using Git CLI
		 */
		function rollbackTag() {
			cmd('git push --delete ' + options.repoName + ' ' + commit.versionTag);
		}

		/**
		 * Reverts published branch
		 */
		function rollbackPublish() {
			try {
				chkoutRun(options.distBranch, function() {
					var cph = cmd('git rev-parse HEAD');
					if (pubHash && pubHash !== cph) {
						cmd('git checkout -qf ' + pubHash);
						cmd('git commit -q -m "Rollback: ' + tmpltData.distBranchPubMsg + '"');
						cmd('git push -f ' + options.repoName + ' ' + options.distBranch);
					} else if (!pubHash) {
						cmd('git push ' + options.repoName + ' --delete ' + options.distBranch);
					} else {
						rbot.log.verbose('Skipping rollback for ' + options.distBranch + ' for hash "' + pubHash
								+ '" (current hash: "' + cph + '")');
					}
				});
			} catch (e) {
				var msg = 'Failed to rollback publish branch changes!';
				rollCall.error(msg, e);
			}
		}
	}
}
1145065
function(data, callback) {
		var set = _assembleTask(data, workFlow[meth][url].merg);
		if (set.err) throw new Error('Invalid workflow: ' + set.tasks);
		async.series(set.tasks, function(err, results) {
			return callback(err, {
				'sync': data.sync,
				'async': data.async,
				'merg': results
			});
		});
	}
760834
def _make_callsites(self, stack_pointer_tracker=None):
        

        # Computing reaching definitions
        rd = self.project.analyses.ReachingDefinitions(func=self.function, func_graph=self.graph, observe_all=True)

        for key in self._blocks:
            block = self._blocks[key]
            csm = self.project.analyses.AILCallSiteMaker(block, reaching_definitions=rd)
            if csm.result_block:
                ail_block = csm.result_block
                simp = self.project.analyses.AILBlockSimplifier(ail_block, stack_pointer_tracker=stack_pointer_tracker)
                self._blocks[key] = simp.result_block

        self._update_graph()
454678
def task(*args, **kwargs):
	''' '''

	# support @task
	if args and hasattr(args[0], '__call__'):
		return _taskify(args[0])

	# as well as @task(), @task('default'), etc.
	else:
		def wrapper(func):
			global DEFAULT, SETUP, TEARDOWN
			func = _taskify(func)

			if 'default' in args:
				DEFAULT = func

			if 'setup' in args:
				SETUP = func

			if 'teardown' in args:
				TEARDOWN = func

			if 'private' in args:
				TASKS.remove(func)

			if 'method' in args:
				func.method = True
				func.args = func.args[1:]

			if 'consume' in args:
				func.consume = True

			if 'reqs' in kwargs:
				func.reqs = _tuplify(kwargs['reqs'])
				func.file_reqs = [req for req in func.reqs if type(req) is str]
				func.task_reqs = [req for req in func.reqs if type(req) is not str]

			if 'gens' in kwargs:
				func.gens = kwargs['gens']
				GENERATES[kwargs['gens']] = func

			if 'alias' in kwargs:
				func.aliases = _tuplify(kwargs['alias'])

			if 'namespace' in kwargs:
				func.ns = kwargs['namespace'] + '.' if kwargs['namespace'] else ''

			return func

		return wrapper
1311023
def task(name, *dependencies, &block)
      if block.nil?
        Task.new(name, *dependencies)
      else
        Task.new(name, *dependencies) do |task|
          task.define(&block)
        end
      end
    end
1349603
function(action, weight) {
      if(weight===undefined) {
        weight=0;
      }
      this.tasks.push({ name: action, weight: weight});
    }
300475
function interceptTask(task, asyncTeardown) {
    var doneCallback;

    function interceptCallback(err, value) {
        function onTeardown(newErr) {
            doneCallback(err || newErr, value);
        }

        asyncTeardown(onTeardown);
    }

    if (typeof task === 'function') {
        doneCallback = task;
        return interceptCallback;
    } else {
        doneCallback = task.end.bind(task);
        task.end = interceptCallback;
        return task;
    }
}