Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search in payloads page #518

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/mhn/common/clio.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def _clean_query(cls, dirty):
'$gte': datetime.datetime.utcnow() - datetime.timedelta(hours=int(dirty['hours_ago']))
}

if 'payload' in dirty and 'payload' in clean:
queryObj = 'payload.' + dirty.get('column')
clean[queryObj] = dirty.get('payload')
del clean['payload']

return clean

@classmethod
Expand Down
23 changes: 18 additions & 5 deletions server/mhn/templates/ui/feeds.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,36 @@ <h4>Search Filters</h4>
</div>
<form id="payload-filter" action="" method="get">
<div class="row">
<div class="small-4 columns">
<div class="small-3 columns">
<label>Payload</label>
</div>
<div class="small-4 pull-4 columns">
<div class="small-3 columns">
<label>Field</label>
</div>
<div class="small-4 columns">
<label>Regex Term</label>
</div>
<div class="small-2 columns">
<label></label>
</div>
</div>
<div class="row">
<div class="small-4 columns">
<select name="channel">
<div class="small-3 columns">
<select onchange="document.getElementById('payload').value = '';" name="channel">
{% for c in channel_list %}
<option {% if c == channel %}selected{% endif %} value="{{ c }}">{{ c }}</option>
{% endfor %}
</select>
</div>
<div class="small-3 columns">
<select name="column">
{% for c in columns %}
<option {% if c == column %}selected{% endif %} value="{{ c }}">{{ c }}</option>
{% endfor %}
</select>
</div>
<div class="small-4 columns">
<input type="text" name="payload" value="{{ payload }}" placeholder="pcre regex" />
<input type="text" id='payload' name="payload" value="{{ payload }}" placeholder="pcre regex" />
</div>
<div class="small-2 columns">
<input class="tiny button" type="submit" value="GO" />
Expand Down