<commit_before>#!/bin/sh

# Phone number
PHONE="+79876543210"
# Password from SMS
PASS="<PASSWORD>"

BASE="http://proverkacheka.nalog.ru:8888"

if [ ! -z "${1}" ] && [ ! -z "${2}" ] && [ ! -z "${3}" ]
then
    #./get.sh 8710000100270243 18863 2145745075
    # Fiscal storage (Номер фискального накопителя - ФН)
    FN="${1}"
    # Fiscal document number (Номер фискального документа - ФД)
    FD="${2}"
    # Fiscal sign (Подпись фискального документа - ФП)
    FS="${3}"

    RESULT=` curl -s -G -X GET -H "Device-Id: 1234567890abcdef" -H "Device-OS: Gumanoid 42" -H "Version: 2" -H "ClientVersion: 1.4.1.3" -A "okhttp/3.0.1" -u "${PHONE}:${PASS}" "${BASE}/v1/inns/*/kkts/*/fss/${FN}/tickets/${FD}" -d "fiscalSign=${FS}" -d "sendToEmail=no"`

    DT=`echo "${RESULT}" | jq -r ".document.receipt.dateTime"`
    echo "${RESULT}" | jq "." > "${DT}_${FS}.json"
else
    RESULT=`curl -s -G -X GET -H "Device-Id: 1234567890abcdef" -H "Device-OS: Gumanoid 42" -H "Version: 2" -H "ClientVersion: 1.4.1.3" -A "okhttp/3.0.1" -u "${PHONE}:${PASS}" "${BASE}/v1/extract" -d "sendToEmail=0" -d "fileType=json"`

    URL=`echo "${RESULT}" | jq -r ".url"`
    RESULT=`curl -s -G -X GET -H "Device-Id: 1234567890abcdef" -H "Device-OS: Gumanoid 42" -H "Version: 2" -H "ClientVersion: 1.4.1.3" -A "okhttp/3.0.1" -u "${PHONE}:${PASS}" "${BASE}${URL}"`<commit_msg>Изменены HTTP-заголовки, т.к. похоже налоговая опомнилась и начала фильтровать запросы по ним, отвечая таймаутами. Добавлены переменные для заголовков для упрощения их дальнейшей смены на случай продолжения борьбы. Реализована генерация псевдослучайного идентификатора устройства для борьбы с фильтрацией.<commit_after>#!/bin/sh

# Phone number
PHONE="+79876543210"
# Password from SMS
PASS="<PASSWORD>"
# Random device ID
DEVID=`uuidgen | tr -d '-'`
# DeviceID
DEVOS="Adnroid 4.4.4"
# Protocol version
PROTO="2"
# Client version
CLIENT="1.4.1.3"
# User agent
UAGENT="okhttp/3.0.1"
# Base URL
BASE="http://proverkacheka.nalog.ru:8888"


if [ ! -z "${1}" ] && [ ! -z "${2}" ] && [ ! -z "${3}" ]
then
    #./get.sh 8710000100270243 18863 2145745075
    # Fiscal storage (Номер фискального накопителя - ФН)
    FN="${1}"
    # Fiscal document number (Номер фискального документа - ФД)
    FD="${2}"
    # Fiscal sign (Подпись фискального документа - ФП)
    FS="${3}"

    RESULT=` curl -s -G -X GET -H "Device-Id: ${DEVID}" -H "Device-OS: ${DEVOS}" -H "Version: ${PROTO}" -H "ClientVersion: ${CLIENT}" -A "${UAGENT}" -u "${PHONE}:${PASS}" "${BASE}/v1/inns/*/kkts/*/fss/${FN}/tickets/${FD}" -d "fiscalSign=${FS}" -d "sendToEmail=no"`

    DT=`echo "${RESULT}" | jq -r ".document.receipt.dateTime"`
    echo "${RESULT}" | jq "." > "${DT}_${FS}.json"
else
    RESULT=`curl -s -G -X GET -H "Device-Id: ${DEVID}" -H "Device-OS: ${DEVOS}" -H "Version: ${PROTO}" -H "ClientVersion: ${CLIENT}" -A "${UAGENT}" -u "${PHONE}:${PASS}" "${BASE}/v1/extract" -d "sendToEmail=0" -d "fileType=json"`

    URL=`echo "${RESULT}" | jq -r ".url"`
    RESULT=`curl -s -G -X GET -H "Device-Id: ${DEVID}" -H "Device-OS: ${DEVOS}" -H "Version: ${PROTO}" -H "ClientVersion: ${CLIENT}" -A "${UAGENT}" -u "${PHONE}:${PASS}" "${BASE}${URL}"`
{'fraction_non_alphanumeric': 0.22733037412809132, 'fraction_numerical': 0.057387444514901714, 'mean_word_length': 3.7019374068554396, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2412001', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1369, 'n_words': 323}