def do_cat(self, arg): """View artifact details or list API keys Usage: cat apikeys cat <artifact name>""" if arg == 'apikeys': data = json.load(open(common.API_CONF, 'rb')) print json.dumps(data, indent=2) else: is_key, value = lookup_key(self.session, arg) if is_key and value is None: error('Unable to find artifact key in session (%s)' % arg) return elif is_key and value is not None: arg = value else: pass artifact_type = detect_type(arg) result = self.db.find(artifact_type, {'name': arg}, one=True) if len(result) == 0: info('No entry found for artifact (%s)' % arg) else: print json.dumps(result, indent=2, separators=(',', ':'))
def do_cat(self, arg): """View artifact details or list API keys Usage: cat apikeys cat <artifact name>""" if arg == 'apikeys': data = json.load(open(common.API_CONF, 'rb')) print json.dumps(data, indent=2) else: is_key, value = lookup_key(self.session, arg) if is_key and value is None: error('Unable to find artifact key in session (%s)' % arg) return elif is_key and value is not None: arg = value else: pass artifact_type = detect_type(arg) result = self.db.find(artifact_type, {'name': arg}, one=True) if len(result) == 0: info('No entry found for artifact (%s)' % arg) else: print json.dumps(result, indent=2, separators=(',', ':'))
def do_wipe(self, arg): """Clear currently active artifacts """ if self.session is not None: info('Clearing active artifacts from cache ...') self.session.flush() success('Artifact cache cleared') else: warning('No active session; start a new session by running the "session" command')
def do_wipe(self, arg): """Clear currently active artifacts """ if self.session is not None: info('Clearing active artifacts from cache ...') self.session.flush() success('Artifact cache cleared') else: warning('No active session; start a new session by running the "session" command')
def do_ls(self, arg): """View current sessions artifacts""" if self.session is None: warning('No active session') return count = 0 keys = self.session.db.scan_iter() for key in keys: value = self.session.get(key) print('[%s] %s' % (key, value)) count += 1 info('Active Artifacts: %d' % count)
def do_ls(self, arg): """View current sessions artifacts""" if self.session is None: warning('No active session') return count = 0 keys = self.session.db.scan_iter() for key in keys: value = self.session.get(key) print('[%s] %s' % (key, value)) count += 1 info('Active Artifacts: %d' % count)
def do_redirect(self, arg): """ Show redirection command help """ info('Omnibus supports command redirection to output files using the ">" character. For example, "cat host zeroharbor.org > zh.json" will pipe the output of the cat command to ./zh.json on disk.')
action='store', default='%s/reports' % os.path.dirname(os.path.realpath(__file__)), required=False) ob_group.add_argument('-d', '--debug', help='enable full traceback on exceptions', action='store_true', default=False, required=False) args = parser.parse_args() config = '%s/etc/omnibus.conf' % os.path.dirname(os.path.realpath(__file__)) output_dir = args.output DEBUG = args.debug info('Using configuration file (%s) ...' % config) info('Debug: %s' % DEBUG) if os.path.exists(output_dir): if not os.path.isdir(output_dir): error('Specified report output location is not a directory; exiting ...') sys.exit(1) else: info('Creating report output directory (%s) ...' % output_dir) mkdir(output_dir) console = Console() console.cmdloop()
def do_redirect(self, arg): """ Show redirection command help """ info('Omnibus supports command redirection to output files using the ">" character. For example, "cat host zeroharbor.org > zh.json" will pipe the output of the cat command to ./zh.json on disk.')
action='store', default='%s/reports' % os.path.dirname(os.path.realpath(__file__)), required=False) ob_group.add_argument('-d', '--debug', help='enable full traceback on exceptions', action='store_true', default=False, required=False) args = parser.parse_args() config = '%s/etc/omnibus.conf' % os.path.dirname(os.path.realpath(__file__)) output_dir = args.output DEBUG = args.debug info('Using configuration file (%s) ...' % config) info('Debug: %s' % DEBUG) if os.path.exists(output_dir): if not os.path.isdir(output_dir): error('Specified report output location is not a directory; exiting ...') sys.exit(1) else: info('Creating report output directory (%s) ...' % output_dir) mkdir(output_dir) console = Console() console.cmdloop()