Skip to content
/ satva Public

SATVA is an advanced spam analysis tool integrating Spam Classification, NER Extraction, Sentiment Analysis, and Blacklisted URL Tagging. It offers Telegram bot integration and a Streamlit web application, providing detailed, AI-generated responses. Ideal for enhancing security and understanding message content with comprehensive analysis.

Notifications You must be signed in to change notification settings

ansh0105/satva

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SATVA: Spam Analysis and Tagging with Virtual Assistant

Overview

SATVA is an advanced spam detection and analysis tool that integrates multiple layers of text analysis, including Spam Classification, Named Entity Recognition (NER) Extraction, Sentiment Analysis, and Blacklisted URL Tagging. It also leverages Generative AI to produce detailed responses based on the analysis. The project offers two main utilities:

  1. Telegram Bot Integration: Users can interact with a registered Telegram bot to analyze messages and receive detailed spam analysis.
  2. Streamlit Web Application: Users can input text for analysis via a web interface with built-in authentication features.

Features

  • Spam Classification: Detects and categorizes different types of spam (e.g., phishing, promotional).
  • NER Extraction: Identifies key entities and personal information within the text.
  • Sentiment Analysis: Analyzes the sentiment (subjectivity and polarity) of the message.
  • Blacklisted URL Tagging: Checks URLs against a blacklist to flag malicious links.
  • Generative AI Response: Provides a human-readable explanation and detailed analysis of the message.

Getting Started

Prerequisites

  • Python 3.9 (or above)
  • Virtual Environment (optional but recommended)
  • Telegram API credentials
  • Azure OpenAI credentials

Installation

  1. Clone the Repository:
    git clone <repository_url>
  2. Create a Python Virtual Environment:
    python -m venv env
    source env/bin/activate  # On Windows use `env\Scripts\activate`
  3. Install Dependencies:
    pip install -r requirements.txt

Configuration

  1. Update the .env File:

    • Navigate to the satva directory.
    • Update the .env file with your Telegram API_ID and API_HASH. Obtain these credentials from here.

    Example .env file:

    API_ID=<your_telegram_api_id>
    API_HASH=<your_telegram_api_hash>
  2. Update NER and Spam Classification Config Files:

    • In the nlp_pipeline folder, update the .env, ner.cfg and spam_classification.cfg files with your Azure OpenAI credentials. Obtain these credentials from here.

    Example configuration for .env:

    AZURE_OPENAI_API_KEY=<your_azure_openai_api_key>
    OPENAI_API_TYPE=<your_azure_openai_type e.g azure>
    OPENAI_API_VERSION=<your_azure_openai_version>
    AZURE_OPENAI_ENDPOINT=<your_azure_openai_endpoint>
    

    Example configuration for .cfg:

    deployment_name=<your_azure_openai_model_name e.g gpt-35-turbo, gpt-4, gpt-4-turbo>
    name=<your_azure_openai_model_name e.g gpt-35-turbo, gpt-4, gpt-4-turbo>
    model_type=<your_azure_openai_model_type e.g chat,instruct>
    api_version=<your_azure_openai_version>
    base_url=<your_azure_openai_endpoint>
    

Running the Telegram Bot Integration

  1. Create a Telegram Session File:

    cd telegram
    python create_telegram_sessionfile.py
    • Follow the steps to create a session file using your Telegram credentials.
  2. Start the Telegram Session:

    python message_handler.py
    • Now, you can send messages to the registered Telegram channel, and SATVA will analyze them.

    Note: To receive a response, start your message with:

    SATVA: <your_message_content>
    

Here is few screenshots of SATVA Telegram Bot in action:

Image 1

Image 2 Image 3

Running the Streamlit Web Application

  1. Navigate to the Streamlit Package Directory:

    cd streamlit_package
  2. Start the Application:

    python start_app.py
    • Open the application in your web browser.

    Default Login Credentials:

    After logging in, you can update your username and password using the "Update User Details" feature.

Here is a demonstration video of SATVA Web Application in action:

satwa_webapp_compressed.mp4

Notes

  • Security: Ensure that your API credentials are kept secure and not exposed in public repositories.
  • Scalability: The architecture can be expanded with additional layers or integrated with other messaging platforms.

About

SATVA is an advanced spam analysis tool integrating Spam Classification, NER Extraction, Sentiment Analysis, and Blacklisted URL Tagging. It offers Telegram bot integration and a Streamlit web application, providing detailed, AI-generated responses. Ideal for enhancing security and understanding message content with comprehensive analysis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages