Skip to content

Commit

Permalink
debug mode and templates fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1modm committed Nov 28, 2021
1 parent 5caec18 commit b446175
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENV LANGUAGE en_US.UTF-8
RUN apt-get -y install python3 python3-dev python3-pip

# install dependencies
RUN apt-get -y install pipenv texlive-full python3-pypandoc
RUN apt-get -y install pipenv texlive-full texlive-latex-extra python3-pypandoc
RUN apt-get -y install wget
RUN apt-get -y install libpangocairo-1.0-0

Expand Down
4 changes: 2 additions & 2 deletions app/config/petereport_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

DJANGO_CONFIG = {
'secret_key': 'django-insecure-key-CHANGEMEPLEASE-pKj9bd9h7*RMCuU',
'debug': True,
'admin_module': True,
'debug': False,
'admin_module': False,
'allowed_hosts': '[\'*\']',
'server_host': 'http://127.0.0.1:8000'
}
Expand Down
2 changes: 1 addition & 1 deletion app/petereport/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
)
#STATIC_URL = '/static/'

STATIC_DIR = os.path.join(BASE_DIR, 'preport/static')
STATIC_DIR = os.path.join(BASE_DIR, 'static')


MEDIA_ROOT = os.path.join(BASE_DIR, "media")
Expand Down
2 changes: 1 addition & 1 deletion app/preport/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class NewFindingTemplateForm(forms.ModelForm):


severity = forms.ChoiceField(choices=severity_choices, required=True, widget=forms.Select(attrs={'class': 'form-control', 'type': "text", 'required': "required", 'placeholder': "Critical/High/Medium/Low/Info/None"}))
cwe = CWEModelChoiceField(queryset=DB_CWE.objects.all(), empty_label="(Select a CWE)", widget=forms.Select(attrs={'class': 'form-control'}))
cwe = CWEModelChoiceField(queryset=DB_CWE.objects.all(), empty_label="(Select a CWE)", widget=forms.Select(attrs={'class': 'form-control select2CWE'}))

class Meta:
model = DB_Finding_Template
Expand Down
6 changes: 6 additions & 0 deletions app/preport/templates/findings/template_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -771,5 +771,11 @@ <h3 id="MA_Heading" title="This metric measures the impact to the availability o

</script>

<script>
// In your Javascript (external .js resource or <script> tag)
$(document).ready(function() {
$('.select2CWE').select2();
});
</script>

{% endblock javascripts %}
2 changes: 1 addition & 1 deletion app/preport/templates/home/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 0.1
<b>Version</b> 0.3
</div>
<strong>Copyright &copy; 2021 <a href="https://github.com/1modm/petereport">PeTeReport</a>.</strong> All rights reserved.
</footer>
Expand Down
2 changes: 1 addition & 1 deletion app/preport/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
path('attacktree/delete/<int:pk>', views.attacktree_delete, name='attacktree_delete'),
path('attacktree/edit/<int:pk>', views.attacktree_edit, name='attacktree_edit'),
path('attacktree/view/<int:pk>', views.attacktree_view, name='attacktree_view'),
]
]
10 changes: 6 additions & 4 deletions app/preport/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ def index(request):
cwe_categories = []

for key_cwe, value_cwe in cwe_cat.items():
fixed_key_cwe = '\n'.join(key_cwe[i:i+70] for i in range(0, len(key_cwe), 70))
dict_cwe = {
"value": value_cwe,
"name": key_cwe
"name": fixed_key_cwe
}

cwe_categories.append(dict_cwe)
Expand All @@ -186,7 +187,7 @@ def user_list(request):
userList = User.objects.values()
group_list = Group.objects.all()

return render(request, 'configuration/user_list.html', {'group_list': group_list})
return render(request, 'configuration/user_list.html', {'userList': userList, 'group_list': group_list})



Expand Down Expand Up @@ -454,9 +455,10 @@ def report_view(request,pk):
cwe_categories = []

for key_cwe, value_cwe in cwe_cat.items():
fixed_key_cwe = '\n'.join(key_cwe[i:i+70] for i in range(0, len(key_cwe), 70))
dict_cwe = {
"value": value_cwe,
"name": key_cwe
"name": fixed_key_cwe
}
cwe_categories.append(dict_cwe)

Expand Down Expand Up @@ -1200,7 +1202,7 @@ def upload_csv_findings(request,pk):
f_severity = header.index("Severity")
f_cvss_score = header.index("CVSS Base Score")
f_cvss = header.index("CVSS Score")
f_cwe = header.index("CWEid")
f_cwe = header.index("CWE ID")
f_description = header.index("Description")
f_location = header.index("Location")
f_impact = header.index("Impact")
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
pipenv run ./app/manage.py makemigrations &&
pipenv run ./app/manage.py migrate &&
pipenv run ./app/manage.py loaddata ./app/config/cwe-list.json &&
pipenv run gunicorn --chdir ./app petereport.wsgi:application --bind 0.0.0.0:8000"
pipenv run gunicorn --chdir ./app petereport.wsgi:application --timeout 120 --graceful-timeout 60 --bind 0.0.0.0:8000"
volumes:
- .:/opt/petereport
expose:
Expand Down

0 comments on commit b446175

Please sign in to comment.