Script for monitoring reports of the Revisor blocked sites control system

Roskomnadzor does not provide an official API for auditing the Revisor (blocking sites control system checking that the access to blacklisted sites is denied) reports, and operator access to such reports is protected by captcha. For the convenience of reports monitoring, we suggest using this script:

Installation instructions:

1. Download and dearchive the script to the directory, for example /home/revmon/

cd /home/revmon
wget http://vasexperts.ru/upload/revmon.tgz
tar xvzf revmon.tgz

2. Install the mail client mutt. This command is applicable for CentOS and VEOS, the way of installation in other operating systems will differ

yum install mutt

3. Specify the e-mail for sending reports

in the CONF/emails.txt file specify one or more space separated e-mails
vasya@example.org

4. Specify the session cookie to load the reports using a script without reauthorizing

in the CONF/cookie.txt file specify cookie using the following format
PHPSESSID=u53r9cn7d9f4hl9ro2odul51k3

Here's one way to get the value of a session cookie using the Chrome browser:

Go to the Revisor portal https://portal.rfc-revizor.ru/ using Chrome browser
Log in typing in the captcha
Select "Additional Tools" -> "Developer Tools" from the Chrome menu (three dots)
Go to the "My Reports" page
Select the "Network" menu item in the horizontal menu, then the first item in the list of pages "myclaims-reports" and then the "Cookies" option in the optional horizontal menu
Copy the value of this cookie and put it into CONF/cookie.txt using the specified format
Also, you can copy the cookies from the "Headers" menu

5. Configure cron to run the script every 5 minutes. Its is responsible for maintaining the session activity so that it does not expire and for loading reports once they are created

*/5 * * * * /home/revmon/revmon.sh > /dev/null 2>&1

6. Configure the cron in order to request the Revisor reports at the time you specify

50 07,23 * * * /home/revmon/revmon.sh order > /dev/null 2>&1

7. Configure the reports cleaning being stored for more than a month in order to avoid disk overflow

15 4 * * * /bin/find /home/revmon/ARCHIVE/ -name \*zip -cmin +44640 -delete > /dev/null 2>&1

Downloaded reports are stored in the ARCHIVE directory
Application log is kept in the exec.log file
Types of messages:
PING OK 31.05.2018 18:50 - request for a session
REQUEST REPORT 31.05.2018 15:32 - request for the report
SEND REPORT 793546 31.05.2018 18:45 - report is sent
SESSION EXPIRED - the session expired, you need to update the session cookie, as specified in item 4