diff --git a/.env b/.env index a4786c8..f5db948 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ UPLOAD_DIRECTORY="../common/Uploads" -MONGODB_HOST="mongo-service" +MONGODB_HOST="127.0.0.1" MONGODB_PORT=27017 UTILITIES_PATH="../Utilities" REDIS_URL="redis://redis-service:6379" diff --git a/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..6ad7bd8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md @@ -0,0 +1,17 @@ +# Prerequisites + +Please answer the following questions for yourself before submitting an issue. **YOU MAY DELETE THE PREREQUISITES SECTION.** + +- [ ] I am running the latest version +- [ ] I checked the documentation and found no answer +- [ ] I checked to make sure that this issue has not already been filed +- [ ] I'm reporting the issue to the correct repository (for multi-repository projects) + +# Expected Behavior +The delete button has been added to the "Completed Scans" section of the Scan8 tool, and is easily accessible to users. It is labeled with a delete tag match the existing Scan8 user interface. The delete button works as expected, and removes the completed scan files without causing any unintended consequences. + + +# Current Behavior + +Currently, there is no way to delete completed scan files in Scan8, which is problematic for users who want to remove unnecessary scan files from their system. + diff --git a/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d80a111 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,39 @@ +# Description + +Currently, there is no way to delete completed scan files in Scan8, which is problematic for users who want to remove unnecessary scan files from their system. However, I have implemented a delete button that can be used to delete completed scans. When pressed, the button will remove the completed scan files immediately. + + + +Fixes # (issue) + +The delete button has been added to the "Completed Scans" section of the Scan8 tool, and is easily accessible to users. It is labeled with a trash can icon and has been styled to match the existing Scan8 user interface. The delete button works as expected, and removes the completed scan files without causing any unintended consequences. + +## Type of change + +Please delete options that are not relevant. + + +- [ ] New feature (non-breaking change which adds functionality) + + +# Testing + +The application comes with a test suite to help users ensure correct installation and help developers verify any updates. + +The following tests should return **ok** status upon running the unit-test command `python3 app.py -v` from the `/Testing` directory. + +- [ ] `testResultsJSON` +- [ ] `testResults` +- [ ] `testUploads` +- [ ] `testResultsDirectoryPresent` +- [ ] `testUploadsDirectoryPresent` +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/Coordinator/README.md b/Coordinator/README.md index eb140fd..23057f6 100644 --- a/Coordinator/README.md +++ b/Coordinator/README.md @@ -1,2 +1,3 @@ -### Master Node +### Coordinator Node +The Coordinator Node listens to updates for new scans, subsequently creating and adding scan jobs to the Redis Queue. diff --git a/Dashboard/README.md b/Dashboard/README.md index fdb0443..a6a84f4 100644 --- a/Dashboard/README.md +++ b/Dashboard/README.md @@ -1,2 +1,3 @@ ### Dashboard +The Dashboard provides a responsive web interface for uploading files for new scans and tracking the status of all the submitted scans. diff --git a/Dashboard/app.py b/Dashboard/app.py index 3519e97..28243ee 100644 --- a/Dashboard/app.py +++ b/Dashboard/app.py @@ -3,7 +3,7 @@ from werkzeug.utils import secure_filename import os import uuid -from pymongo import MongoClient +from pymongo import MongoClient, errors import json from hurry.filesize import size, si from dotenv import load_dotenv @@ -31,7 +31,7 @@ def index(): queued = queuedScans.find() running = runningScans.find() completed = completedScans.find() - return render_template('index.html', prequeued=prequeued, queued=queued, running=running, completed=completed, newScanUrl=url_for('newScan')) + return render_template('index.html', prequeued=prequeued, queued=queued, running=running, completed=completed, newScanUrl=url_for('newScan'),delete_completed=url_for('deleteCompleted', file='')) def new_scan(): @@ -79,6 +79,17 @@ def generate(): return Response(generate(), mimetype='text/event-stream') +def delete_completed(file): + try: + file = completedScans.find_one({'_id': file}) + if file: + file_id = file['_id'] + completedScans.delete_one({'_id': file_id}) + return redirect(url_for('dashboard')) + except errors.OperationFailure as e: + return {"message": f"Error: {e}"}, 400 + + app.add_url_rule("/", endpoint="dashboard", view_func=index, methods=['GET']) app.add_url_rule("/newScan", endpoint="newScan", view_func=new_scan, methods=['GET']) @@ -86,5 +97,8 @@ def generate(): view_func=progress, methods=['GET']) app.add_url_rule("/upload", endpoint="upload", view_func=upload_files, methods=['GET', 'POST']) +app.add_url_rule("/deleteCompleted/", endpoint="deleteCompleted", + view_func=delete_completed, methods=['GET', 'POST']) + if __name__ == "__main__": app.run(host="0.0.0.0",debug=True) diff --git a/Dashboard/templates/index.html b/Dashboard/templates/index.html index e53bf03..efcc750 100644 --- a/Dashboard/templates/index.html +++ b/Dashboard/templates/index.html @@ -100,6 +100,9 @@
Number of files: {{ item['files']['total'] }}
+
+ +
{% endfor %} diff --git a/README.md b/README.md index 5527a3b..5cdf64f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Scan8 +Scan8 (Open for GSoC and Hacktoberfest) ======== Scan8 is a distributed scanning system for detecting trojans, viruses, malware, and other malicious threats embedded in files. The system will allow one to submit a list of URLs or files and get the scan results in return. diff --git a/Worker/README.md b/Worker/README.md index b52a5e7..47a0446 100644 --- a/Worker/README.md +++ b/Worker/README.md @@ -1,2 +1,3 @@ ### Worker Node +The Worker Node listens to updates for new jobs in Redis Queue and executes them.