Added support for multiple clients, and a filter count display at the bottom-right of the page
This commit is contained in:
+4
-2
@@ -1,18 +1,20 @@
|
||||
from app import db
|
||||
|
||||
class target(db.Model):
|
||||
__tablename__ = 'targets'
|
||||
__tablename__ = "targets"
|
||||
id = db.Column(db.Integer, primary_key = True)
|
||||
os = db.Column(db.String())
|
||||
hostname = db.Column(db.String())
|
||||
address = db.Column(db.String())
|
||||
ports = db.Column(db.String())
|
||||
clientId = db.Column(db.String())
|
||||
|
||||
def __init__(self, os, hostname, address, ports):
|
||||
def __init__(self, os, hostname, address, ports, clientId):
|
||||
self.os = os
|
||||
self.hostname = hostname
|
||||
self.address = address
|
||||
self.ports = ports
|
||||
self.clientId = clientId
|
||||
|
||||
def __repr__(self):
|
||||
return '<address %r>' % self.address
|
||||
|
||||
@@ -92,8 +92,9 @@ a:hover, a:link, a:visited, a:active{
|
||||
|
||||
input[type=text]{
|
||||
background: transparent;
|
||||
color: var(--header-text);
|
||||
border: 0;
|
||||
border-bottom: 2px solid var(--accent-color);
|
||||
color: var(--header-text);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
@@ -108,4 +109,15 @@ input[type=text]{
|
||||
}
|
||||
::-ms-input-placeholder { /* Microsoft Edge */
|
||||
color: var(--header-text);
|
||||
}
|
||||
|
||||
.result-count {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: 0.8vw;
|
||||
font-size: 1vw;
|
||||
border-radius: 15px;
|
||||
padding: 1vw;
|
||||
background: var(--accent-color);
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
<thead>
|
||||
<tr class="table-header">
|
||||
<form method="POST">
|
||||
<input type="text" name="clientId" id="clientId" placeholder="Client Id" value="{{ clientId }}">
|
||||
<input type="submit" value="Submit Query" hidden>
|
||||
<th><input type="text" name="os" id="os" placeholder="OS" value="{{ os }}"></th>
|
||||
<th><input type="text" name="hostname" id="hostname" placeholder="HOSTNAME" value="{{ hostname }}"></th>
|
||||
@@ -29,4 +30,5 @@
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='result-count'>{{targets|count}}</div>
|
||||
{% endblock %}
|
||||
|
||||
+7
-1
@@ -15,6 +15,12 @@ def post_home():
|
||||
"""Render website's home page with applied filters."""
|
||||
targets = db.session.query(target)
|
||||
|
||||
clientId = request.form.get("clientId")
|
||||
if clientId:
|
||||
targets = targets.where(target.clientId == clientId)
|
||||
else:
|
||||
clientId = "default"
|
||||
|
||||
os = request.form.get("os")
|
||||
if os:
|
||||
targets = targets.where(target.os == os)
|
||||
@@ -33,7 +39,7 @@ def post_home():
|
||||
targets = targets.filter(target.ports.like('%|'+port+'|%'))
|
||||
|
||||
|
||||
return render_template('home.html', targets=targets.all(), os=os,hostname=hostname,address=address,ports=ports)
|
||||
return render_template('home.html', targets=targets.all(), os=os,hostname=hostname,address=address,ports=ports,clientId=clientId)
|
||||
|
||||
|
||||
@app.after_request
|
||||
|
||||
Reference in New Issue
Block a user