def main(command): try: load_off = command.split(' ', 1)[1] if load_off == 'all': if config.scout_values['Windows'][0] == 'True': config.loaded_components = collections.OrderedDict() config.loaded_components['-'] = 'windows/base' print '[+]Unloaded all loaded windows components' else: config.loaded_components = collections.OrderedDict() config.loaded_components['-'] = 'linux/base' print '[+]Unloaded all loaded linux components' else: if key_from_val.main(config.loaded_components, load_off) == '-' or load_off == '-': raise KeyError try: name = config.loaded_components[load_off] del (config.loaded_components[load_off]) print '[+]Unloaded : ' + name return except KeyError: del (config.loaded_components[key_from_val.main( config.loaded_components, load_off)]) print '[+]Unloaded : ' + load_off return raise KeyError except KeyError: print '[-]Please specify a valid component to unload or "all" to load all components. Note : the default component, */base cannot be unloaded'
def main(command): try: load_on = command.split(' ', 1)[1] if load_on == 'all': if config.scout_values['Windows'][0] == 'True': for i in [i for i in config.win_components.values() if not i.startswith('windows/bases/')]: config.loaded_components[key_from_val.main(config.win_components, i)] = i print config.pos + 'Loaded : ' + i print config.pos + 'Loaded all windows components' else: for i in [i for i in config.lin_components.values() if not i.startswith('linux/bases/')]: config.loaded_components[key_from_val.main(config.lin_components, i)] = i print config.pos + 'Loaded : ' + i print config.pos + 'Loaded all linux components' else: if config.scout_values['Windows'][0] == 'True': if load_on in config.win_components.keys(): if config.win_components[load_on].startswith('windows/bases/') and config.win_components[load_on] not in config.loaded_components.values(): config.win_base_to_use = config.win_components[load_on] print config.pos + 'Replaced the loaded on base with new base : ' + config.win_components[ load_on] return else: load_on = config.win_components[load_on] if load_on in config.loaded_components.values(): print config.neg + 'Component already loaded' else: id = key_from_val.main(config.win_components, load_on) if not id: raise KeyError if load_on.startswith('windows/bases/'): config.win_base_to_use = load_on print config.pos + 'Replaced the loaded on base with new base : ' + load_on return else: config.loaded_components[id] = load_on print config.pos + 'Loaded : ' + load_on else: if load_on in config.lin_components.keys(): if config.lin_components[load_on].startswith('linux/bases/') and config.lin_components[load_on] not in config.loaded_components.values(): config.lin_base_to_use = config.lin_components[load_on] print config.pos + 'Replaced the loaded on base with new base : ' + config.lin_components[ load_on] return else: load_on = config.lin_components[load_on] if load_on in config.loaded_components.values(): print config.neg + 'Component already loaded' else: id = key_from_val.main(config.lin_components, load_on) if not id: raise KeyError if load_on.startswith('linux/bases/'): config.win_base_to_use = load_on print config.pos + 'Replaced the loaded on base with new base : ' + load_on return config.loaded_components[id] = load_on print config.pos + 'Loaded : ' + load_on except (KeyError, IndexError): print config.neg + 'Please specify a valid component to load or "all" to load all components. Note : the default component, */base is loaded by default'
def unload_com(load_off): if load_off == 'all': if config.scout_values['Windows'][0] == 'True': config.loaded_components = collections.OrderedDict() config.loaded_components['base'] = config.win_base_to_use print config.pos + 'Unloaded all loaded windows components' else: config.loaded_components = collections.OrderedDict() config.loaded_components['base'] = config.lin_base_to_use print config.pos + 'Unloaded all loaded linux components' else: if load_off == 'base' or key_from_val.main(config.loaded_components, load_off) == 'base': print config.war + 'Do not unload base components, loading another base component will automatically replaces the already loaded base components as there can only be one base components' raise KeyError try: name = config.loaded_components[load_off] del (config.loaded_components[load_off]) print config.pos + 'Unloaded : ' + name return except KeyError: del (config.loaded_components[key_from_val.main( config.loaded_components, load_off)]) print config.pos + 'Unloaded : ' + load_off return raise KeyError
def main(command): try: load_off = command.split(' ', 1)[1] if load_off == 'all': if config.scout_values['Windows'][0] == 'True': config.loaded_components = collections.OrderedDict() config.loaded_components['base'] = config.win_base_to_use print config.pos + 'Unloaded all loaded windows components' else: config.loaded_components = collections.OrderedDict() config.loaded_components['base'] = config.lin_base_to_use print config.pos + 'Unloaded all loaded linux components' else: if key_from_val.main(config.loaded_components, load_off) == 'base' or load_off == 'base': print config.war + 'Do not unload base components, loading another base component will automatically replaces the already loaded base components as there can only be one base components' raise KeyError try: name = config.loaded_components[load_off] del (config.loaded_components[load_off]) print config.pos + 'Unloaded : ' + name return except KeyError: del (config.loaded_components[key_from_val.main(config.loaded_components, load_off)]) print config.pos + 'Unloaded : ' + load_off return raise KeyError except (KeyError, IndexError): print config.neg + 'Please specify a valid component to unload or "all" to load all components. Note : "base" component cannot be unloaded'
def load_com(load_on): if config.scout_values['Windows'][0] == 'True': if load_on in config.win_components.keys(): if config.win_components[load_on].startswith('windows/bases/') and config.win_components[load_on] not in config.loaded_components.values(): config.win_base_to_use = config.win_components[load_on] print config.pos + 'Replaced the loaded on base with new base : ' + config.win_components[ load_on] return else: load_on = config.win_components[load_on] if load_on in config.loaded_components.values(): print config.neg + 'Component already loaded' else: id = key_from_val.main(config.win_components, load_on) if not id: raise KeyError if load_on.startswith('windows/bases/'): config.win_base_to_use = load_on print config.pos + 'Replaced the loaded on base with new base : ' + load_on return else: config.loaded_components[id] = load_on print config.pos + 'Loaded : ' + load_on else: if load_on in config.lin_components.keys(): if config.lin_components[load_on].startswith('linux/bases/') and config.lin_components[load_on] not in config.loaded_components.values(): config.lin_base_to_use = config.lin_components[load_on] print config.pos + 'Replaced the loaded on base with new base : ' + config.lin_components[ load_on] return else: load_on = config.lin_components[load_on] if load_on in config.loaded_components.values(): print config.neg + 'Component already loaded' else: id = key_from_val.main(config.lin_components, load_on) if not id: raise KeyError if load_on.startswith('linux/bases/'): config.win_base_to_use = load_on print config.pos + 'Replaced the loaded on base with new base : ' + load_on return config.loaded_components[id] = load_on print config.pos + 'Loaded : ' + load_on
def main(command): try: load_on = command.split(' ', 1)[1] if load_on == 'all': if config.scout_values['Windows'][0] == 'True': for i in config.win_components.values(): config.loaded_components[key_from_val.main( config.win_components, i)] = i print '[+]Loaded : ' + i print '[+]Loaded all windows components' else: for i in config.lin_components.values(): config.loaded_components[key_from_val.main( config.lin_components, i)] = i print '[+]Loaded : ' + i print '[+]Loaded all linux components' else: if config.scout_values['Windows'][0] == 'True': if load_on in config.win_components.keys(): load_on = config.win_components[load_on] if load_on in config.loaded_components.values(): print '[-]Component already loaded' else: id = key_from_val.main(config.win_components, load_on) if not id: raise KeyError config.loaded_components[id] = load_on print '[+]Loaded : ' + load_on else: if load_on in config.lin_components.keys(): load_on = config.lin_components[load_on] if load_on in config.loaded_components.values(): print '[-]Component already loaded' else: id = key_from_val.main(config.lin_components, load_on) if not id: raise KeyError config.loaded_components[id] = load_on print '[+]Loaded : ' + load_on except KeyError: print '[-]Please specify a valid component to load or "all" to load all components. Note : the default component, */base is loaded by default'
def main(command): try: to_show = command.split(' ', 1)[1] if to_show == 'options': header = [[' Option', 'Value', 'Info'], [' ======', '=====', '====']] for o, v in config.scout_values.items(): header.append([' ' + o, str(v[0]), v[1]]) print '\n' l = [len(max(i, key=len)) for i in zip(*header)] print('\n'.join(' '.join(item[i].ljust(l[i]) for i in range(len(l))) for item in header)) + '\n' elif to_show == 'components': if config.scout_values['Windows'][0] == 'True': print '\n[*]Generator is set to generate Windows scout' print '[*]All loadable Windows components :' for i in config.win_components: print ' [' + i + '] ' + config.win_components[i] print ' [-] windows/base\n' else: print '\n[*]Generator is set to generate Linux scout' print '[*]All loadable Linux components :' for i in config.lin_components: print ' [' + i + '] ' + config.lin_components[i] print ' [-] linux/base\n' elif to_show == 'loaded': if config.scout_values['Windows'][0] == 'True': print '\n[*]Generator is set to generate Windows specific scout' else: print '[*]Generator is set to generate Linux specific scout' print '[*]Loaded library : ' for i in config.loaded_components.values(): if i.endswith('/base'): print ' [-] ' + i else: print ' [' + str( key_from_val.main(config.loaded_components, i)) + '] ' + i print '' else: print '[-]Please specify a valid argument, ["options"|"components"|"loaded"]' except IndexError: print '[-]Please specify what to show, ["options"|"components"|"loaded"]'