2022-06-06 10:22:14 +00:00
|
|
|
|
import json
|
|
|
|
|
from json.decoder import JSONDecodeError
|
|
|
|
|
from pyrogram import Client
|
2024-09-28 14:35:08 +00:00
|
|
|
|
|
|
|
|
|
from pagermaid.enums import Message
|
2022-06-06 10:22:14 +00:00
|
|
|
|
from pagermaid.listener import listener
|
2024-09-28 14:35:08 +00:00
|
|
|
|
from pagermaid.utils import pip_install
|
2022-12-22 04:13:25 +00:00
|
|
|
|
|
|
|
|
|
pip_install("requests")
|
|
|
|
|
|
|
|
|
|
import requests
|
2022-06-06 10:22:14 +00:00
|
|
|
|
|
|
|
|
|
|
2023-07-01 12:18:58 +00:00
|
|
|
|
@listener(command="bin", description="查询信用卡信息", parameters="[bin(4到8位数字)]")
|
2022-06-06 10:22:14 +00:00
|
|
|
|
async def card(_: Client, message: Message):
|
2023-07-01 12:18:58 +00:00
|
|
|
|
await message.edit("正在查询中...")
|
2022-06-06 10:22:14 +00:00
|
|
|
|
try:
|
|
|
|
|
card_bin = message.arguments
|
|
|
|
|
except ValueError:
|
|
|
|
|
await message.edit("出错了呜呜呜 ~ 无效的参数。")
|
|
|
|
|
return
|
|
|
|
|
try:
|
2022-06-14 07:54:55 +00:00
|
|
|
|
r = requests.get(f"https://lookup.binlist.net/{card_bin}")
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except:
|
|
|
|
|
await message.edit("出错了呜呜呜 ~ 无法访问到binlist。")
|
|
|
|
|
return
|
|
|
|
|
if r.status_code == 404:
|
|
|
|
|
await message.edit("出错了呜呜呜 ~ 目标卡头不存在")
|
|
|
|
|
return
|
|
|
|
|
if r.status_code == 429:
|
|
|
|
|
await message.edit("出错了呜呜呜 ~ 每分钟限额超过,请等待一分钟再试")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
bin_json = json.loads(r.content.decode("utf-8"))
|
|
|
|
|
except JSONDecodeError:
|
|
|
|
|
await message.edit("出错了呜呜呜 ~ 无效的参数。")
|
|
|
|
|
return
|
|
|
|
|
|
2022-06-14 07:54:55 +00:00
|
|
|
|
msg_out = [f"BIN:{card_bin}"]
|
2022-06-06 10:22:14 +00:00
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
msg_out.extend(["卡品牌:" + bin_json["scheme"]])
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
msg_out.extend(["卡类型:" + bin_json["type"]])
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
msg_out.extend(["卡种类:" + bin_json["brand"]])
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
msg_out.extend(["发卡行:" + bin_json["bank"]["name"]])
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
if bin_json["prepaid"]:
|
2022-06-06 10:22:14 +00:00
|
|
|
|
msg_out.extend(["是否预付:是"])
|
|
|
|
|
else:
|
|
|
|
|
msg_out.extend(["是否预付:否"])
|
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
try:
|
2023-07-01 12:18:58 +00:00
|
|
|
|
msg_out.extend(["发卡国家:" + bin_json["country"]["name"]])
|
2022-06-06 10:22:14 +00:00
|
|
|
|
except (KeyError, TypeError):
|
|
|
|
|
pass
|
|
|
|
|
await message.edit("\n".join(msg_out))
|