Skip to content

Conduct real-name verification of Chinese National ID(中国身份证) with a Telegram bot

License

Notifications You must be signed in to change notification settings

songyuew/cnid_telegram_checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cnid_telegram_checker

Conduct real-name verification of Chinese National ID(中国身份证) with a Telegram bot

  • Whether an ID # exists in MPS(Ministry of Public Security) system
  • Whether the name provided matches the record in MPS system
  • Shows the household register(户口) area of the holder

demo

Getting Started

  1. Install requests and python-telegram-bot

    pip install requests
    
    pip install python-telegram-bot
    
  2. Buy real-name verification service at Aliyun Marketplace here You may use another API interface. Simply modify cnid_checker.py

  3. Replace APP_CODE in cnid_checker.py with your own Aliyun appcode You can find your appcode in Aliyun Console

  4. Replace API_TOKEN in guard_id_checker.py with your Telegram bot API key

  5. Fill the Telegram ID(s) of Telegram client account(s) that is going to use this bot in authorized in guard_id_checker.py This avoids unauthorized people using your bot and Aliyun Marketplace API(API calls are charged by the provider). If you don't know your Telegram ID, search Get My ID in Telegram, this bot will send you the user ID.

    userid

Usage

Run the guard_id_checker.py script to start the bot

python guard_id_checker.py

Input

Check an ID card number by sending this message to the bot:

[CNID]-CNID_NUMBER-CHN_NAME

Replace CNID_NUMBER and CHN_NAME with ID number and name in simplified Chinese(简体中文)

Reply from Bot

After you send the message in correct format to the bot, it will process the checking and reply:

  1. 实名认证通过 Real-name verification passed! - ID # and name is successfully verified
  2. 实名认证失败 Real-name verification failed! - No record in MPS system or name/ID # does no match
  3. 姓名格式不正确 Incorrect name format! - Name is not in correct format
  4. 身份证格式不正确 Incorrect ID format! - ID # is not in correct format
  5. 系统维护 System maintenance - API interface provider's system is under maintenance

Authorization

If you send message to the bot with an unauthorized client account, the request will not be processed and you will get Not authorized message.

License

Distributed under the MIT License. See LICENSE.md for more information.

Contact

Project Link: https://github.com/songyuew/cnid_telegram_checker

Acknowledgments

About

Conduct real-name verification of Chinese National ID(中国身份证) with a Telegram bot

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages