Skip to content
Permalink
Browse files

Bootstrap UI & Namecheap

  • Loading branch information...
Christopher Maddalena
Christopher Maddalena committed Aug 24, 2019
1 parent 0e301b8 commit 2dc075d306155649e98adaa669af0b656c5232e3
Showing with 1,973 additions and 937 deletions.
  1. +10 −1 .envs_template/.local/.django
  2. +10 −0 config/settings/base.py
  3. +39 −2 ghostwriter/home/templates/home/management.html
  4. +8 −1 ghostwriter/home/views.py
  5. +12 −1 ghostwriter/reporting/admin.py
  6. +49 −1 ghostwriter/reporting/forms.py
  7. +68 −0 ghostwriter/reporting/models.py
  8. +1 −0 ghostwriter/reporting/templates/reporting/archives.html
  9. +16 −1 ghostwriter/reporting/templates/reporting/evidence_detail.html
  10. +178 −71 ghostwriter/reporting/templates/reporting/finding_detail.html
  11. +56 −36 ghostwriter/reporting/templates/reporting/finding_form.html
  12. +10 −0 ghostwriter/reporting/templates/reporting/findings_import.html
  13. +104 −40 ghostwriter/reporting/templates/reporting/local_edit.html
  14. +1 −1 ghostwriter/reporting/templates/reporting/report_detail.html
  15. +20 −2 ghostwriter/reporting/urls.py
  16. +148 −4 ghostwriter/reporting/views.py
  17. +10 −0 ghostwriter/rolodex/templates/rolodex/assignment_form.html
  18. +154 −132 ghostwriter/rolodex/templates/rolodex/client_detail.html
  19. +10 −0 ghostwriter/rolodex/templates/rolodex/client_form.html
  20. +10 −0 ghostwriter/rolodex/templates/rolodex/contact_form.html
  21. +351 −315 ghostwriter/rolodex/templates/rolodex/project_detail.html
  22. +10 −0 ghostwriter/rolodex/templates/rolodex/project_form.html
  23. +12 −1 ghostwriter/shepherd/models.py
  24. +99 −2 ghostwriter/shepherd/tasks.py
  25. +11 −0 ghostwriter/shepherd/templates/shepherd/checkout.html
  26. +9 −0 ghostwriter/shepherd/templates/shepherd/checkouts_for_user.html
  27. +260 −215 ghostwriter/shepherd/templates/shepherd/domain_detail.html
  28. +10 −0 ghostwriter/shepherd/templates/shepherd/domain_form.html
  29. +10 −0 ghostwriter/shepherd/templates/shepherd/domain_import.html
  30. +5 −1 ghostwriter/shepherd/templates/shepherd/domain_list.html
  31. +0 −72 ghostwriter/shepherd/templates/shepherd/graveyard.html
  32. +11 −0 ghostwriter/shepherd/templates/shepherd/server_checkout.html
  33. +35 −26 ghostwriter/shepherd/templates/shepherd/server_detail.html
  34. +10 −0 ghostwriter/shepherd/templates/shepherd/server_form.html
  35. +10 −0 ghostwriter/shepherd/templates/shepherd/server_import.html
  36. +44 −9 ghostwriter/shepherd/templates/shepherd/update.html
  37. +2 −0 ghostwriter/shepherd/urls.py
  38. +49 −1 ghostwriter/shepherd/views.py
  39. +121 −2 ghostwriter/static/css/styles.css
@@ -27,4 +27,13 @@ SLACK_URL=https://hooks.slack.com/services/<your_webhook_url>
# ------------------------------------------------------------------------------
COMPANY_NAME=Ghostwriter
COMPANY_TWITTER=@ghostwriter
COMPANY_EMAIL=info@ghostwriter.local
COMPANY_EMAIL=info@ghostwriter.local

# Namecheap
# ------------------------------------------------------------------------------
NAMECHEAP_ENABLE=False
NAMECHEAP_API_KEY=
NAMECHEAP_USERNAME=
NAMECHEAP_API_USERNAME=
CLIENT_IP=
NAMECHEAP_PAGE_SIZE=100
@@ -329,3 +329,13 @@
COMPANY_EMAIL = env("COMPANY_EMAIL", default="info@ghostwriter.local")

TEMPLATE_LOC = env("TEMPLATE_LOC", default=str(APPS_DIR("reporting", "templates", "reports")))

# Namecheap configuration
NAMECHEAP_CONFIG = {
'enable_namecheap': env("NAMECHEAP_ENABLE", default=False),
'namecheap_api_key': env("NAMECHEAP_API_KEY", default=None),
'namecheap_username': env("NAMECHEAP_USERNAME", default=None),
'namecheap_api_username': env("NAMECHEAP_API_USERNAME", default=None),
'client_ip': env("CLIENT_IP", default=None),
'namecheap_page_size': env("NAMECHEAP_PAGE_SIZE", default="100")
}
@@ -33,7 +33,7 @@ <h2>API & Notification Configurations</h2>

<!-- Domain Health Section -->
<tr>
<th class="form_th"><i class="far fa-heart"></i> Domain Health Checks</th>
<th class="form_th"><i class="fas fa-heart"></i> Domain Health Checks</th>
<th class="form_th"></th>
</tr>
<tr>
@@ -56,7 +56,7 @@ <h2>API & Notification Configurations</h2>

<!-- Notification Section -->
<tr>
<th class="form_th"><i class="far fa-bell"></i> Notifications</th>
<th class="form_th"><i class="fas fa-bell"></i> Notifications</th>
<th class="form_th"></th>
</tr>
<tr>
@@ -85,5 +85,42 @@ <h2>API & Notification Configurations</h2>
<td>{{ slack_alert_target }}</td>
</tr>
{% endif %}

<!-- Spacer -->
<tr>
<td class="hidden-table">&nbsp;</th>
</tr>

<!-- Registrar Section -->
<tr>
<th class="form_th"><i class="fas fa-cloud-download-alt"></i> Domain Registar API</th>
<th class="form_th"></th>
</tr>
<tr>
<td><i class="fas fa-code"></i> Namecheap API Enabled</td>
<td>{{ enable_namecheap }}</td>
</tr>
{% if enable_namecheap %}
<tr>
<td><i class="fas fa-laptop-code"></i> Namecheap Whitelisted IP</td>
<td>{{ namecheap_client_ip }}</td>
</tr>
<tr>
<td><i class="fas fa-key"></i> Namecheap API Key</td>
<td>{{ namecheap_api_key }}</td>
</tr>
<tr>
<td><i class="fas fa-user"></i> Namecheap Username</td>
<td>{{ namecheap_username }}</td>
</tr>
<tr>
<td><i class="fas fa-users-cog"></i> Namecheap API Username</td>
<td>{{ namecheap_api_username }}</td>
</tr>
<tr>
<td><i class="fas fa-hashtag"></i> Namecheap Page Size</td>
<td>{{ namecheap_page_size }}</td>
</tr>
{% endif %}
</table>
{% endblock %}
@@ -121,6 +121,7 @@ def management(request):
# Get the *_CONFIG dictionaries from settings.py
config = {}
config.update(settings.SLACK_CONFIG)
config.update(settings.NAMECHEAP_CONFIG)
config.update(settings.DOMAINCHECK_CONFIG)
# Pass the relevant settings to management.html
context = {
@@ -132,6 +133,12 @@ def management(request):
'slack_username': config['slack_username'],
'slack_webhook_url': config['slack_webhook_url'],
'virustotal_api_key': config['virustotal_api_key'],
'slack_alert_target': config['slack_alert_target']
'slack_alert_target': config['slack_alert_target'],
'namecheap_client_ip': config['client_ip'],
'enable_namecheap': config['enable_namecheap'],
'namecheap_api_key': config['namecheap_api_key'],
'namecheap_username': config['namecheap_username'],
'namecheap_page_size': config['namecheap_page_size'],
'namecheap_api_username': config['namecheap_api_username']
}
return render(request, 'home/management.html', context=context)
@@ -2,7 +2,8 @@

from django.contrib import admin
from .models import (Finding, Report, Severity, FindingType,
ReportFindingLink, Evidence, Archive)
ReportFindingLink, Evidence, Archive, FindingNote,
LocalFindingNote)


# Define the admin classes and register models
@@ -60,3 +61,13 @@ class FindingTypeAdmin(admin.ModelAdmin):
@admin.register(Archive)
class ArchiveAdmin(admin.ModelAdmin):
pass


@admin.register(FindingNote)
class FindingNoteAdmin(admin.ModelAdmin):
pass


@admin.register(LocalFindingNote)
class LocalFindingNoteAdmin(admin.ModelAdmin):
pass
@@ -4,7 +4,9 @@

from crispy_forms.helper import FormHelper

from .models import Finding, Report, ReportFindingLink, Evidence
from .models import (
Finding, Report, ReportFindingLink, Evidence, LocalFindingNote,
FindingNote)


class FindingCreateForm(forms.ModelForm):
@@ -119,3 +121,49 @@ def __init__(self, *args, **kwargs):
self.helper.form_method = 'post'
self.helper.field_class = \
'h-100 justify-content-center align-items-center'


class FindingNoteCreateForm(forms.ModelForm):
"""Form used with the FindingNote CreateView in views.py."""
class Meta:
"""Modify the attributes of the form."""
model = FindingNote
fields = ('__all__')
widgets = {
'timestamp': forms.HiddenInput(),
'operator': forms.HiddenInput(),
'finding': forms.HiddenInput(),
}

def __init__(self, *args, **kwargs):
"""Override the `init()` function to set some attributes."""
super(FindingNoteCreateForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-inline'
self.helper.form_method = 'post'
self.helper.field_class = \
'h-100 justify-content-center align-items-center'
self.helper.form_show_labels = False


class LocalFindingNoteCreateForm(forms.ModelForm):
"""Form used with the LocalFindingNote CreateView in views.py."""
class Meta:
"""Modify the attributes of the form."""
model = LocalFindingNote
fields = ('__all__')
widgets = {
'timestamp': forms.HiddenInput(),
'operator': forms.HiddenInput(),
'finding': forms.HiddenInput(),
}

def __init__(self, *args, **kwargs):
"""Override the `init()` function to set some attributes."""
super(LocalFindingNoteCreateForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-inline'
self.helper.form_method = 'post'
self.helper.field_class = \
'h-100 justify-content-center align-items-center'
self.helper.form_show_labels = False
@@ -419,3 +419,71 @@ class Meta:
def __str__(self):
"""String for representing the model object (in Admin site etc.)."""
return self.report_archive.name


class FindingNote(models.Model):
"""Model representing notes for findings added to a report.
There are foreign keys for the `Finding` and `User` models.
"""
# This field is automatically filled with the current date
timestamp = models.DateField(
'Timestamp',
auto_now_add=True,
max_length=100,
help_text='Creation timestamp')
note = models.TextField(
'Notes',
null=True,
blank=True,
help_text='Use this area to add a note to this finding - it can be '
'anything you want others to see/know about the finding')
# Foreign Keys
finding = models.ForeignKey(
'Finding', on_delete=models.CASCADE, null=False)
operator = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True)

class Meta:
"""Metadata for the model."""
ordering = ['finding', '-timestamp']
verbose_name = 'Local finding note'
verbose_name_plural = 'Local finding notes'

def __str__(self):
"""String for representing the model object (in Admin site etc.)."""
return f'{self.finding} {self.timestamp}: {self.note}'


class LocalFindingNote(models.Model):
"""Model representing notes for findings added to a report.
There are foreign keys for the `ReportFindingLink` and `User` models.
"""
# This field is automatically filled with the current date
timestamp = models.DateField(
'Timestamp',
auto_now_add=True,
max_length=100,
help_text='Creation timestamp')
note = models.TextField(
'Notes',
null=True,
blank=True,
help_text='Use this area to add a note to this finding - it can be '
'anything you want others to see/know about the finding')
# Foreign Keys
finding = models.ForeignKey(
'ReportFindingLink', on_delete=models.CASCADE, null=False)
operator = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, blank=True)

class Meta:
"""Metadata for the model."""
ordering = ['finding', '-timestamp']
verbose_name = 'Local finding note'
verbose_name_plural = 'Local finding notes'

def __str__(self):
"""String for representing the model object (in Admin site etc.)."""
return f'{self.finding} {self.timestamp}: {self.note}'
@@ -7,6 +7,7 @@
<nav aria-label="breadcrumb" style="padding-left: 20px;">
<ul class="breadcrumb" style="margin: 0;">
<li class="breadcrumb-item"><a href="{% url 'home:dashboard' %}">Dashboard</a></li>
<li class="breadcrumb-item"><a href="{% url 'reporting:reports' %}">Reports</a></li>
<li class="breadcrumb-item active" aria-current="page">Archives</li>
</ul>
</nav>
@@ -1,5 +1,18 @@
{% extends 'base_generic.html' %}

{% block pagetitle %}Evidence Detail{% endblock %}

{% block breadcrumbs %}
<nav aria-label="breadcrumb" style="padding-left: 20px;">
<ul class="breadcrumb" style="margin: 0;">
<li class="breadcrumb-item"><a href="{% url 'home:dashboard' %}">Dashboard</a></li>
<li class="breadcrumb-item"><a href="{% url 'rolodex:client_detail' evidence.finding.report.project.client.id %}">{{ evidence.finding.report.project.client.name }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'rolodex:project_detail' evidence.finding.report.project.id %}">{{ evidence.finding.report.project }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Evidence</li>
</ul>
</nav>
{% endblock %}

{% block content %}
<h2>
{{ evidence.friendly_name }}
@@ -48,7 +61,9 @@ <h4><i class="far fa-file-image"></i> File Contents</h4>
{% elif filetype == 'text' %}
{% if file_content %}
{% for line in file_content %}
<p style="margin-left:15%; text-align: left">{{ line }}</p>
<p style="margin-left:15%; text-align: left; max-width: 800px; word-wrap: break-word;">
{{ line|linebreaksbr }}
</p>
{% endfor %}
{% endif %}
{% else %}

0 comments on commit 2dc075d

Please sign in to comment.
You can’t perform that action at this time.