diff --git a/script_library/index.json b/script_library/index.json index 51f5a99..5b07698 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 88, - "updated": "2026-04-11T21:12:50.787Z", + "data_version": 89, + "updated": "2026-04-12T05:10:38Z", "announcement": null, "categories": [ { @@ -1490,6 +1490,30 @@ "updated": null, "status": "active", "lines": 236 + }, + { + "id": "community_身份证核验__by_霞飞路", + "name": "身份证核验 — by 霞飞路", + "name_en": "身份证核验 — by 霞飞路", + "desc": "[投稿] 身份证核验 — by 霞飞路", + "desc_en": "[投稿] 身份证核验 — by 霞飞路", + "category": "basic", + "file": "scripts/basic/script_mnul4nuo.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "社区投稿", + "author_en": "社区投稿", + "tags": [ + "community", + "basic" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-04-12", + "updated": null, + "status": "active", + "lines": 17 } ] } diff --git a/script_library/scripts/basic/script_mnul4nuo.py b/script_library/scripts/basic/script_mnul4nuo.py new file mode 100644 index 0000000..c55291d --- /dev/null +++ b/script_library/scripts/basic/script_mnul4nuo.py @@ -0,0 +1,17 @@ +import re +def check_id_card(id_str): + if len(id_str) != 18 : return False + last = id_str[17].upper() + if not (last.isdigit() or last == 'X') : return False + try: + if not re.search(r"^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$",id_str).group():pass + except: + return False + weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] + codes = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'] + total = sum(int(id_str[i]) * weights[i] for i in range(17)) + mod = total % 11 + expected = codes[mod] + return last == expected +if __name__ == "__main__": + print(check_id_card(input("输入18位完整sfz号码:"))) \ No newline at end of file