def run(client, module): dest = module.get('mapLogin') mod = { 'grep': dest, 'args': { 'pattern': 'OnConnected|OnRspUserLogin|OnDisconnected' } } return grep.run(client, mod)
def run(client, module): dest = module.get('uftLogin') if dest: mod = { 'grep': dest, 'args': { 'pattern': 'InitUftApi|HsUftLogin 5 Login rtn' } } return grep.run(client, mod)
def search(): # TODO: Expose multi-channel search form = SearchForm(request.args, csrf_enabled=False) valid = form.validate() network = form.network.data channel = form.channel.data if config.SEARCH_AJAX_ENABLED: if not valid: # TODO: Improve this? abort(404) try: dates = paths.channels_dates(network, [channel]) except exceptions.NoResultsException: abort(404) except exceptions.MultipleResultsException: return render_template('error/multiple_results.html', network=network, channel=channel) max_segment = grep.max_segment(dates[-1]['date_obj']) return render_template('search_ajax.html', valid=valid, form=form, network=network, channel=channel, author=form.author.data, query=form.text.data, max_segment=max_segment) else: # We should have another copy of this to use... if not valid: results = [] else: results = grep.run( channels=[channel], network=network, author=form.author.data, query=form.text.data, ) return render_template('search.html', valid=valid, form=form, network=network, channel=channel, results=results)
def search(): form = SearchForm(request.args, csrf_enabled=False) valid = form.validate() network = form.network.data channels = request.args.getlist('channel') if config.SEARCH_AJAX_ENABLED: if not valid: # TODO: Improve this? abort(404) try: dates = paths.channels_dates(network, channels) except exceptions.NoResultsException: abort(404) except exceptions.MultipleResultsException: return render_template('error/multiple_results.html', network=network, channel=channels[0]) max_segment = grep.max_segment(dates[-1]['date_obj']) return render_template( 'search_ajax.html', valid=valid, form=form, network=network, channels=channels, author=form.author.data, query=json.dumps(form.text.data), max_segment=max_segment, ) else: # We should have another copy of this to use... if not valid: results = [] else: results = grep.run( channels=channels, network=network, author=form.author.data, query=form.text.data, ) return render_template('search.html', valid=valid, form=form, network=network, channel=channels[0], results=results)
def search_ajax_chunk(): form = AjaxSearchForm(request.args, csrf_enabled=False) valid = form.validate() date_start, date_end = grep.segment_bounds(form.segment.data) # We should have another copy of this to use... if not valid: results = [] else: results = grep.run( channels=[form.channel.data], network=form.network.data, author=form.author.data, query=form.text.data, date_range=[date_start, date_end], ) return render_template('search_result.html', network=form.network.data, channels=[form.channel.data], results=results)
def run(client, module): dest = module.get('customLog') key_words = module.get('key_words') if key_words: if isinstance(key_words, dict): key_words = '|'.join(key_words.values()) elif isinstance(key_words, list): key_words = '|'.join(key_words) else: raise Exception("Invalid module define.") else: raise Exception("Invalid module define.") if isinstance(client, SSHClient): import grep else: import wingrep as grep mod = { 'grep': dest, 'args': { 'pattern': key_words } } return grep.run(client, mod)