Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swss-long

Safe Secure Web Server (SSWS)

Important

NOW WITH AN EXTENSION BUILT-IN

A web server implementation similar to NGINX designed to work against unauthorized web scraping.

Project Structure

SSWS/
├── api/
│   └── summarise.go            # API client for webpage summarization
├── cypher/
│   └── encryption.go           # Encryption logic implementation
├── extension/                  # Chrome extension files
│   ├── background.js           # Extension background script
│   ├── content.js              # Content script for webpage modification
│   ├── manifest.json           # Extension manifest
│   ├── popup.html              # Extension popup UI
│   └── popup.js                # Popup UI logic
├── images/
│   └── url.png                 # Image assets
├── keys/                       # Encryption key management
│   ├── keygen.py               # Key generation script
│   ├── keytest.py              # Key testing utilities
│   ├── private_key.pem         # Private key file
│   ├── public_key.pem          # Public key file
│   └── requirements.txt        # Python dependencies
├── public/                     # Server output directory
│   ├── index.html              # Encrypted/jumbled content
│   ├── index.html.json         # Encryption metadata
│   └── summary.html            # Generated summary
├── static/                     # Original content directory
│   └── index.html              # Source webpage
├── utils/                      # Utility scripts
│   ├── webpage-summary.py      # Summary generation
│   └── webscrape.py            # Test scraping script
├── .gitignore                  # Git ignore rules
├── go.mod                      # Go module file
├── go.sum                      # Go dependencies checksum
├── main.go                     # Server entry point
└── README.md                   # Project documentation

Features

  • Serves jumbled/poisoned content to web scraping bots
  • Test scraping script to verify behavior
  • Chrome extension to undo the jumbled content

Working

This project is a simple webserver that jumbles up the content from an input website that we put in the static folder. When the server starts up the contents from the static gets loaded and jumbled (in later version posioned for LLMs) and gets placed in the public folder, a simple web server then serves the files from this directory to address :

http://localhost:8080

The content deliverd to the client will be jumbled (later poisoned) content an examples for this would be:

Original content

<p>Strict regulations are needed to ensure ethical and legal data collection practices.</p>

Jumbled (Later poisoned) content

<s>Vwulfw uhjxodwlrqv duh qhhghg wr hqvxuh hwklfdo dqg ohjdo gdwd froohfwlrq sudfwlfhv.</s>

This can be undone using browser extension, that will unscramble the Jumbled content and converts it back to the Original content.

Note

In the case of poisoned text we plan to implement some way of sending back the original content.

Getting Started

Prerequisites

  • Go 1.20 or later
  • Python 3.x (for testing scraper)
  • Chrome browser (for extension)

Running the Server

  1. Generate keys using the keys/keygen.py, the requirements for the key gen programs is given in the keys/requrements.txt

  2. Public and private keys will be generated and these will be used to encrypt and decrypt the data. The client extension expects the private key named as private_key.py and public_key.py is the public key that the server uses.

  3. Create a folder with the name static and put the content of your website in this folder.

  4. Start the Go server:

    go run .

The server will start on port 8080 by default.

Testing the Scraper

To test the anti-scraping measures:

python webscrape.py

Chrome Extension

The extension component is located in the extension directory and can be loaded into Chrome for additional functionality.

The steps are:

  1. Open the url

    chrome://extensions/
    

Note

This is the extensions page for chrome where you will see all your install extensions

  1. Toggle developer mode

    image

    On the top and right corner of the page there will be a toggle to turn on developer mode, turn this on as we want to load our extension.

  2. Load an upacked extension

    image

    Once this option is choosed a folder picker should open up and then you have to select the extension folder from this project.

  3. Use

    image

    Now you should be able to see the extension on your browser and you can activate it by clicking on it.

Caution

This is the extensions is updating the contents on the website, this will work on all websites but may lead to undesirable results

License

This project is licensed under the MIT License. See the LICENSE file for details.


Note: This server is designed as an educational tool to demonstrate anti-scraping measures and should be used responsibly.

About

Safe Secure Web Server

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages