I used Python colleagues calculated the ID number | Force program


Author | ZHU Xiao five

Edit | yugao

Source | CSDN (ID: CSDNnews)

For a cup of tea.

That's what happened:

My colleague David Lee recently on a business trip.

Last night before going to sleep rolled his circle of friends,

I told him happily (mutual hate) exchange up.

 

It is estimated that he remembered me ZHU Xiao five never fight uncertain bet, behind it counsels.

Well cup of tea, you can also accept,

As happy as Jiuhaola Jay.

start.

Take a look at the circle of friends in Dawei made a picture.

(The train from other parallel world, scanning the strange phenomenon may occur)

Individual ticket information is exposed:

3302211993 **** 4914 Li Dawei

Missing only the date four months.

So that is a total of 365 kinds possible.

Science Time:

According to the former 6 "330 221" ID information of Li Dawei

Easily available:

Ningbo, Zhejiang Province, in 1993 drops

I first have to build it all dates in 1993 with python

 1import time
 2
 3#生成出生当年所有日期
 4def dateRange(year):
 5    fmt = '%Y-%m-%d'
 6    bgn = int(time.mktime(time.strptime(year+'-01-01',fmt)))
 7    end = int(time.mktime(time.strptime(year+'-12-31',fmt)))
 8    list_date = [time.strftime(fmt,time.localtime(i)) for i in range(bgn,end+1,3600*24)]
 9    return [i.replace('-','') for i in list_date]
10
11data_time  = dateRange('1993')

Successfully obtain a list of dates.

Just then the checksum calculation rule

Reverse verify which dates match myself!

Write your own calculation rules?

NONONO, too much trouble!

Introducing a library for everyone: id-validator

Installation: pip install id-validator

Can be used to verify the validity of the ID number, ID number obtaining information generated by dummy data check, ID card upgrade.

Then we use the identity card number in order to check id-validator earlier generation.

 1from id_validator import validator
 2
 3#遍历所有日期,print通过校验的身份证号码
 4
 5def vali_dator(id1,id2,id3):
 6    for i in dateRange(id2):
 7        theid = id1 + i + id3
 8        if validator.is_valid(theid):
 9            print(theid)
10
11vali_dator('330221','1993','4914')

operation result:

amount

33 are in line checking logic, only 90% screened out ah

This awkward

How to pick a date in 33 out of the true date of birth Dawei it?

Thought about

(In fact, Baidu wave)

Here we need everyone used 12306.

 

12306 Open's official website,

Add favorite contacts in 12306,

Sequentially inputted Dawei + ID number.

If the same ID and name will be displayed by check;

If not passed, then the ID and name do not match.

 

Ultimately measured Dawei date of birth: 19,930,608

knock off,

Tea hand.

You are not want to know in the end I tried many times before success?

Just came back Dawei said want to know.

In fact, a useless test.

Now I buy tea drinking Li Dawei

Code with the text

Open nail

Li Dawei looked nickname

 

And my heart laughed pig called.

Text characters, identity card number is purely fictitious and any similarity is my copy.

Original link:

https://blog.csdn.net/zhuxiao5/article/details/104469652

声明:本文仅用于学术交流,禁止用于商业用途。

【end】

精彩推荐

中国「远程办公」大考·线上峰会
10+位来自华为、阿里、微软、CODING等名企的专家大牛为大家做全天直播!
在线答疑、吐槽评论、现场抽奖等与大咖多维互动,不出家门,用程序员的方式来共同“抗”疫!
扫码或者点击阅读原文,限时免费报名。

推荐阅读

    你点的每个“在看”,我都认真当成了AI

发布了1336 篇原创文章 · 获赞 1万+ · 访问量 596万+

Guess you like

Origin blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/104568091