Skip to content

Commit 8044978

Browse files
Merge branch 'dev' into 'master'
Fix: 2.2 RC1 Bug Fixes See merge request ghostmanager/Ghostwriter!113
2 parents 81d2943 + 3e1f06a commit 8044978

File tree

6 files changed

+73
-13
lines changed

6 files changed

+73
-13
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 3.0.10 on 2021-04-06 00:58
2+
3+
# Django Imports
4+
from django.db import migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("sites", "0003_set_site_domain_and_name"),
11+
]
12+
13+
operations = [
14+
migrations.AlterModelOptions(
15+
name="site",
16+
options={
17+
"ordering": ["domain"],
18+
"verbose_name": "site",
19+
"verbose_name_plural": "sites",
20+
},
21+
),
22+
]

ghostwriter/modules/linting_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
],
8484
"objective": "Discover Kenneth Parcell's true identity",
8585
"description": '<p>It is unclear if this is a jest and part of an HR-related "flag" or a real request. The client was light on details. The objective is wide open; asking the team to find any and all information related to Kenneth Parcel, a member of NBC\'s Page Program.</p>',
86+
"description_rt": "",
8687
"complete": False,
8788
"marked_complete": "",
8889
"position": 1,
@@ -102,6 +103,7 @@
102103
],
103104
"objective": "Access hosts and files containing celebrity PII",
104105
"description": "<p>The team may find methods of accessing data related to celebrities that appear on NBC programs. Use any discovered methods to access this information and capture evidence.</p>",
106+
"description_rt": "",
105107
"complete": False,
106108
"marked_complete": "",
107109
"position": 1,
@@ -121,6 +123,7 @@
121123
],
122124
"objective": "Escalate privileges in the NBC domain to Domain Administrator or equivalent",
123125
"description": "<p>Active Directory is a key component of the assessment, and client is keen to learn how many attack paths may be discovered to escalate privileges within the network.</p>",
126+
"description_rt": "",
124127
"complete": False,
125128
"marked_complete": "",
126129
"position": 2,
@@ -131,6 +134,7 @@
131134
"ip_address": "12.31.13.90",
132135
"hostname": "PP00001.NBC.LOCAL",
133136
"note": "<p>Computer known to be used by Kenneth Parcell. May contain celebrity PII (Parcell performs tasks for Tracy Morgan) or provide information for the Parcell objective.</p>",
137+
"note_rt": "",
134138
"compromised": False,
135139
}
136140
],
@@ -140,6 +144,7 @@
140144
"scope": ["10.6.0.125"],
141145
"name": "Executive Computer",
142146
"description": "<p>This is Jack Donaghy's computer and should not be touched.</p>",
147+
"description_rt": "",
143148
"disallowed": True,
144149
"requires_caution": False,
145150
},
@@ -148,6 +153,7 @@
148153
"scope": ["192.168.1.0/24", "10.100.0.0/16", "*.nbc.com", "NBC.LOCAL"],
149154
"name": "NBC Allowlist",
150155
"description": "<p>All hosts and domains in this list are allowed and related to core objectives.</p>",
156+
"description_rt": "",
151157
"disallowed": False,
152158
"requires_caution": False,
153159
},
@@ -156,6 +162,7 @@
156162
"scope": ["12.31.13.0/24"],
157163
"name": "NBC Page Program",
158164
"description": "<p>Client advises caution while accessing this network and avoid detection. It is unclear why, but they have said it is related to the Kenneth Parcell objective.</p>",
165+
"description_rt": "",
159166
"disallowed": False,
160167
"requires_caution": True,
161168
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# 3rd Party Libraries
2+
import factory
3+
4+
5+
class FindingFactory(factory.django.DjangoModelFactory):
6+
class Meta:
7+
model = "reporting.Finding"
8+
django_get_or_create = ("title",)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Django Imports
2+
from django.test import TestCase
3+
4+
from .factories import FindingFactory
5+
6+
7+
class FindingModelsTestCase(TestCase):
8+
@classmethod
9+
def setUpTestData(cls):
10+
cls.Finding = FindingFactory._meta.model
11+
12+
def test_crud_finding(self):
13+
# Create
14+
finding = FindingFactory(title="Awful Finding")
15+
16+
# Read
17+
self.assertEqual(finding.title, "Awful Finding")
18+
self.assertEqual(finding.pk, finding.id)
19+
self.assertQuerysetEqual(
20+
self.Finding.objects.all(), ["<Finding: [None] Awful Finding>"]
21+
)
22+
23+
# Update
24+
finding.title = "Not so Bad Finding"
25+
finding.save()
26+
self.assertQuerysetEqual(
27+
self.Finding.objects.all(), ["<Finding: [None] Not so Bad Finding>"]
28+
)
29+
30+
# Delete
31+
finding.title = "Not so Bad Finding"
32+
finding.delete()
33+
assert not self.Finding.objects.all().exists()

ghostwriter/rolodex/forms_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ def __init__(self, *args, **kwargs):
988988
def clean_end_date(self):
989989
end_date = self.cleaned_data["end_date"]
990990
start_date = self.cleaned_data["start_date"]
991-
# Check if end_date comes before the start_date
991+
# Check if ``end_date`` comes before the ``start_date``
992992
if end_date < start_date:
993993
raise ValidationError(
994994
_("The provided end date comes before the start date"),

ghostwriter/rolodex/signals.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.dispatch import receiver
99

1010
# Ghostwriter Libraries
11-
from ghostwriter.rolodex.models import Project, ProjectAssignment
11+
from ghostwriter.rolodex.models import Project
1212
from ghostwriter.shepherd.models import History, ServerHistory
1313

1414
# Using __name__ resolves to ghostwriter.rolodex.signals
@@ -23,7 +23,7 @@ def update_project(sender, instance, **kwargs):
2323
"""
2424
domain_checkouts = History.objects.filter(project=instance)
2525
server_checkouts = ServerHistory.objects.filter(project=instance)
26-
project_assignments = ProjectAssignment.objects.filter(project=instance)
26+
2727
for domain in domain_checkouts:
2828
if domain.start_date > instance.start_date or domain.end_date > instance.end_date:
2929
if domain.start_date > instance.start_date:
@@ -38,13 +38,3 @@ def update_project(sender, instance, **kwargs):
3838
if server.end_date > instance.end_date:
3939
server.end_date = instance.end_date
4040
server.save()
41-
for assignment in project_assignments:
42-
if (
43-
assignment.start_date > instance.start_date
44-
or assignment.end_date > instance.end_date
45-
):
46-
if assignment.start_date > instance.start_date:
47-
assignment.start_date = instance.start_date
48-
if assignment.end_date > instance.end_date:
49-
assignment.end_date = instance.end_date
50-
assignment.save()

0 commit comments

Comments
 (0)