gcivil-nyu-org / wed-fall24-team2

4 stars 2 forks source link

analysis of chat moderation and sound moderation feature #158

Closed soniasusanto closed 3 days ago

soniasusanto commented 1 week ago
thejaswinidm commented 5 days ago

Chat Moderation:Packages: django-moderation: A reusable application that provides a generic, extensible comment-moderation system. It allows you to moderate any model objects, including chat messages. django-comments: A Django application that provides a basic comment system. It includes moderation features, such as automatic spam filtering and manual moderation. Key Concepts: Moderation Queue: A system that holds pending chat messages until a moderator approves or rejects them. Moderator: A user or role responsible for reviewing and approving/rejecting chat messages. Moderation Options: Customizable settings for each model or chat message type, defining how moderation should be applied (e.g., automatic approval for trusted users). Notification: Email or in-app notifications sent to moderators when new chat messages require review.

sample documentation:https://django-moderation.readthedocs.io/en/latest/getting_started.html#

thejaswinidm commented 5 days ago

Virus Scan: Using VirusTotal API: Another approach is to use the VirusTotal API, which scans files using multiple antivirus engines.

Steps to integrate VirusTotal: Sign Up for VirusTotal: Go to VirusTotal and sign up for an API key.

Install Requests Package: Install the Python requests package to interact with the VirusTotal API.

bash Copy code pip install requests File Scanning with VirusTotal API: Here’s how to integrate the VirusTotal API into your Django view:

python Copy code import requests from django.conf import settings from django.core.exceptions import ValidationError from django.http import JsonResponse

def scan_file_with_virustotal(file_path): api_key = settings.VIRUSTOTAL_API_KEY url = "https://www.virustotal.com/api/v3/files" headers = { "x-apikey": api_key } with open(file_path, 'rb') as file: response = requests.post(url, headers=headers, files={"file": file})

if response.status_code == 200:
    result = response.json()
    if result['data']['attributes']['last_analysis_stats']['malicious'] > 0:
        raise ValidationError("Malware detected!")
else:
    raise ValidationError("VirusTotal scan failed.")

def upload_file_view(request): if request.method == 'POST' and request.FILES['file']: uploaded_file = request.FILES['file'] file_path = f'uploads/{uploaded_file.name}'

    with open(file_path, 'wb') as f:
        for chunk in uploaded_file.chunks():
            f.write(chunk)

    # Scan the file with VirusTotal
    try:
        scan_file_with_virustotal(file_path)
        # Save the file in the database
        new_file = UploadedFile(file=file_path)
        new_file.save()
        return JsonResponse({"message": "File uploaded and scanned successfully."})
    except ValidationError as e:
        return JsonResponse({"error": str(e)}, status=400)
thejaswinidm commented 5 days ago

I prefer Virus Scan because it uses an API for malware detection not our local or server. As it'll cost less and protect our servers from another malware attack

thejaswinidm commented 5 days ago

Detection of inappropriate sounds is a bit complicated requires ML algos to be written which will take a lot of time, it might be out of scope for this course. But if we have time we can use Google APIs to transcribe the audios and parse it to a profanity filter check.