Fixed error reporting: now respects -j.

Removed -all option as it is no longer relevant with the variety of subjects possible.

--all made more sense when Palo, Bluecat and DNS were the only working functions. But with the addition of searches in Aruba, LDAP and VMWare a strictly IP subject base is more rare. Therefore I've removed the option.
This commit is contained in:
Daniel Dayley 2020-10-05 16:59:29 -06:00
parent e2fb3454ee
commit 3fad4d87b2

View File

@ -55,20 +55,15 @@ if __name__ == '__main__':
if arguments and len(arguments) == 4 :
parser.add_argument(arguments[0],arguments[1],action=arguments[2],help=arguments[3])
parser.add_argument('-v', '--debug', action='count', help='Include debug information in the output. Add \'v\'s for more output.')
# parser.add_argument('-a', '--all', action='store_true', help='Return all searchable information about the subject')
parser.add_argument('subjects', metavar='subjects', nargs='+', help='IP\'s, hostnames, MAC\'s, usernames, or other strings to look up.')
args = parser.parse_args()
# Load plugins based on submitted args
selected_plugins = []
if 'all' in vars(args) and vars(args)['all'] :
for delegate in available_plugins.values() :
for name,delegate in available_plugins.items() :
argument = delegate().get_arguments()[1].split('--')[-1]
if argument in vars(args) and vars(args)[argument] :
selected_plugins.append(delegate)
else :
for name,delegate in available_plugins.items() :
argument = delegate().get_arguments()[1].split('--')[-1]
if argument in vars(args) and vars(args)[argument] :
selected_plugins.append(delegate)
search.use_plugins(selected_plugins)
# Configure subjects
@ -116,7 +111,11 @@ if __name__ == '__main__':
if plugin_name not in total_config.keys() :
error_info.update({'config': 'Config file is missing information for plugin ' + plugin_name})
if error_info != {} :
print(subjects,{'error':error_info})
error_doc = {'error':error_info}
if args.json :
print(json.dumps(error_doc))
else :
yaml.dump(error_doc,sys.stdout)
exit(1)
search.configure(total_config)
search.set_debug_level(args.debug)