GithubHelp home page GithubHelp logo

yazmani / autoblockiplist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kichetof/autoblockiplist

0.0 0.0 0.0 83 KB

Update Synology DSM Auto Block list from file or url

License: Apache License 2.0

Python 100.00%

autoblockiplist's Introduction

AutoBlockIPList

This script allows you to automate the update of the IP block list on the Synology NAS from a list of IP's (custom user or external list).

This script was tested with Synology DSM 6 (6.2.4) and 7 (7.0 and 7.1.1)

⚠️ After Synology update, if you encounter any issue, re-run install requirements

Table of contents

Usage

AutoBlockIPList [-h] [-f [IN_FILE ...]] [-u [IN_URL ...]]
                       [-e EXPIRE_IN_DAY] [--remove-expired] [-b BACKUP_TO]
                       [--clear-db] [--dry-run] [-v] [--version]

optional arguments:

-h, --help            show this help message and exit

-f [IN_FILE ...], --in-file [IN_FILE ...]
                    Local list file separated by a space (eg.
                    /home/user/list.txt custom.txt)
                    
-u [IN_URL ...], --in-url [IN_URL ...]
                    External list url separated by a space (eg
                    https://example.com/list.txt
                    https://example.com/all.txt)
                    
-e EXPIRE_IN_DAY, --expire-in-day EXPIRE_IN_DAY
                    Expire time in day. Default 0: no expiration
                    
--remove-expired      Remove expired entry

-b BACKUP_TO, --backup-to BACKUP_TO
                    Folder to store a backup of the database
                    
--clear-db            Clear ALL deny entry in database before filling

--dry-run             Perform a run without any modifications

-v, --verbose         Increase output verbosity

--version             show program's version number and exit

Requirements

In DSM 6, install package python3.

Connect to your NAS though SSH and execute following commands:

sudo python3 -m ensurepip

Go to AutoBlockIPList folder and run

sudo python3 -m pip install -r requirements.txt


First use

Before to run this script in your schedule tasks, perform some single run in SSH.

First one with --backup-to and --dry-run to get a backup of your database.

Next with --in-file or --in-url and --dry-run.


Synology DSM

Manual usage (recommended for first use)
  • Connect to your NAS though SSH
  • execute script like: sudo python3 /volume1/scripts/AutoBlockIPList.py -v --dry-run --backup-to . --in-file /volume1/homes/user/custom.txt
Schedule task
  • Go to Control Panel -> Task scheduler Task scheduler
  • Setting up the task as "root" user Task settings

Enjoy 😎

autoblockiplist's People

Contributors

kichetof avatar yazmani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.