-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
790 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import print_function, division, absolute_import, unicode_literals | ||
|
||
from rest_framework import viewsets | ||
|
||
from . import models, serializers | ||
|
||
|
||
class ProductViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.Product | ||
serializer_class = serializers.ProductSerializer | ||
filter_fields = ('name',) | ||
|
||
|
||
class DeviceViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.Device | ||
serializer_class = serializers.DeviceSerializer | ||
filter_fields = ('value', 'description', 'product', 'created', 'trusted',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import print_function, division, absolute_import, unicode_literals | ||
|
||
from rest_framework import serializers | ||
|
||
from apps.api.mixins import DynamicFieldsMixin | ||
from . import models | ||
|
||
|
||
class ProductSerializer(DynamicFieldsMixin, serializers.HyperlinkedModelSerializer): | ||
class Meta(object): | ||
model = models.Product | ||
fields = ('id', 'uri', 'name') | ||
|
||
|
||
class DeviceSerializer(DynamicFieldsMixin, serializers.HyperlinkedModelSerializer): | ||
product = ProductSerializer() | ||
|
||
class Meta(object): | ||
model = models.Device | ||
fields = ('id', 'uri', 'value', 'description', 'product', 'created', 'trusted') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{% extends "front/base.html" %} | ||
|
||
{% load i18n %} | ||
{% block title %}{{ title }}{% endblock %} | ||
|
||
{% block hero %} | ||
<h1>{{ title }}</h1> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<h4>{% trans 'Event Info' %}</h4> | ||
|
||
<div class="row"> | ||
<div class="col-md-6"> | ||
<table class="table" border="0"> | ||
<tbody> | ||
<tr> | ||
<td><strong>{% trans 'ID' %}</strong></td> | ||
<td>{{ event.id }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>{% trans 'Device' %}</strong></td> | ||
<td>{{ event.device }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>{% trans 'Timestamp' %}</strong></td> | ||
<td>{{ event.timestamp|date:'M d H:i:s Y' }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>{% trans 'Epoch' %}</strong></td> | ||
<td>{{ event.epoch }}</td> | ||
</tr> | ||
<tr> | ||
<td><strong>{% trans 'EID' %}</strong></td> | ||
<td>{{ event.eid }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<hr> | ||
<h4>{% trans 'Software' %}</h4> | ||
{% if tag_events %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>{% trans "Action" %}</th> | ||
<th>{% trans "Tag ID" %}</th> | ||
<th>{% trans "Record ID" %}</th> | ||
<th>{% trans "Source ID" %}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for te in tag_events %} | ||
<tr> | ||
<td> | ||
{% if te.action == 1 %} | ||
{% trans 'ADDED' %} | ||
{% else %} | ||
{% trans 'REMOVED' %} | ||
{% endif %} | ||
</td> | ||
<td><a href="{% url 'swid:tag_detail' te.tag.pk %}">{{ te.tag.list_repr }}</a></td> | ||
<td>{{ te.record_id }}</td> | ||
<td>{{ te.source_id }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% else %} | ||
<p> | ||
{% trans 'No tags in this event.' %} | ||
</p> | ||
{% endif %} | ||
|
||
</div> | ||
</div> | ||
{% endblock %} |
26 changes: 26 additions & 0 deletions
26
apps/devices/templates/devices/paging/device_report_events.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% load i18n %} | ||
|
||
{% if events.count %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th class="dateWidth">{% trans "Time" %}</th> | ||
<th>{% trans "EID" %}</th> | ||
<th>{% trans "Epoch" %}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for e in events %} | ||
<tr> | ||
<td><a | ||
href="{% url url_name e.pk %}">{{ e.timestamp|date:'M d H:i:s Y' }}</a> | ||
</td> | ||
<td>{{ e.eid }}</td> | ||
<td>{{ e.epoch }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% else %} | ||
<p>{% trans 'No software events reported for this device.' %}</p> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import print_function, division, absolute_import, unicode_literals | ||
|
||
from rest_framework import viewsets | ||
|
||
from . import models, serializers | ||
|
||
|
||
class AlgorithmViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.Algorithm | ||
serializer_class = serializers.AlgorithmSerializer | ||
filter_fields = ('name',) | ||
|
||
|
||
class DirectoryViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.Directory | ||
serializer_class = serializers.DirectorySerializer | ||
filter_fields = ('path',) | ||
|
||
|
||
class FileViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.File | ||
serializer_class = serializers.FileSerializer | ||
filter_fields = ('name', 'directory', 'directory__path',) | ||
|
||
|
||
class FileHashViewSet(viewsets.ReadOnlyModelViewSet): | ||
model = models.FileHash | ||
serializer_class = serializers.FileHashSerializer | ||
filter_fields = ('file', 'file__name', 'file__directory__path', 'version', | ||
'device', 'size', 'algorithm', 'hash', 'mutable',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.