Skip to content

Commit

Permalink
域名列表增加whois域名注册商信息 (#37)
Browse files Browse the repository at this point in the history
* 修改k8s deployment配置

* 域名列表增加whois域名注册商信息

* 域名列表增加whois域名注册商信息

---------

Co-authored-by: 马嘉炜 <[email protected]>
  • Loading branch information
mjwtc0722 and 马嘉炜 authored Jun 30, 2023
1 parent 3ef79ae commit 6c381a7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions domain_admin/model/domain_info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ class DomainInfoModel(BaseModel):
# 域名
domain = CharField(null=False)

# 域名注册商
domain_registrar = CharField(default="")

# 域名注册商地址
domain_registrar_url = CharField(default="")

# 域名注册时间
domain_start_time = DateTimeField(default=None, null=True)

Expand Down
4 changes: 4 additions & 0 deletions domain_admin/service/domain_info_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ def update_domain_info_row(row: DomainInfoModel) -> [str, None]:
if domain_whois:
update_row.domain_start_time = domain_whois['start_time']
update_row.domain_expire_time = domain_whois['expire_time']
update_row.domain_registrar = domain_whois['registrar']
update_row.domain_registrar_url = domain_whois['registrar_url']

DomainInfoModel.update(
domain_start_time=update_row.domain_start_time,
domain_expire_time=update_row.domain_expire_time,
domain_expire_days=update_row.real_domain_expire_days,
domain_registrar=domain_whois['registrar'],
domain_registrar_url=domain_whois['registrar_url'],
update_time=datetime_util.get_datetime()
).where(
DomainInfoModel.id == row.id
Expand Down
16 changes: 15 additions & 1 deletion domain_admin/utils/whois_util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
'whois_server': '', # whois查询服务器
# 'error': 'No match', # 错误信息
'registry_time': 'Creation Date', # 注册时间
'expire_time': 'Registry Expiry Date' # 过期时间
'expire_time': 'Registry Expiry Date', # 过期时间
'registrar': 'Registrar', # 注册商
'registrar_url': 'Registrar URL', # 注册商
}

# https://www.nirsoft.net/whois-servers.txt
Expand All @@ -24,39 +26,51 @@
'whois_server': 'whois.cnnic.cn',
'registry_time': 'Registration Time',
'expire_time': 'Expiration Time',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
},
'hk': {
'whois_server': 'whois.hkirc.hk',
'registry_time': 'Domain Name Commencement Date',
"registry_time_format": '%d-%m-%Y',
'expire_time': 'Expiry Date',
"expire_time_format": '%d-%m-%Y',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
},
'sg': {
'whois_server': 'whois.sgnic.sg',
'registry_time': 'Creation Date',
"registry_time_format": '%d-%m-%Y',
'expire_time': 'Expiration Date',
"expire_time_format": '%d-%m-%Y',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
},
'jp': {
'whois_server': 'whois.jprs.jp',
'registry_time': '[登録年月日]',
"registry_time_format": '%Y/%m/%d',
'expire_time': '[有効期限]',
"expire_time_format": '%Y/%m/%d',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
},

'中国': {
'whois_server': 'cwhois.cnnic.cn',
'registry_time': 'Registration Time',
'expire_time': 'Expiration Time',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
},
'tw': {
'whois_server': 'whois.twnic.net',
'registry_time': 'Record created',
"registry_time_format": '%Y-%m-%d %H:%M:%S (UTC+8)',
'expire_time': 'Record expires',
"expire_time_format": '%Y-%m-%d %H:%M:%S (UTC+8)',
'registrar': 'Registrar',
'registrar_url': 'Registrar URL',
}
}

0 comments on commit 6c381a7

Please sign in to comment.