mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-08 22:07:55 +00:00
py-i2phosts-checker: use get_b32()
This commit is contained in:
parent
623134e1a2
commit
adc7a787f5
@ -4,8 +4,6 @@ import os
|
||||
import sys
|
||||
import argparse
|
||||
import datetime
|
||||
import hashlib
|
||||
import base64
|
||||
import configobj
|
||||
|
||||
from i2p import samclasses
|
||||
@ -45,6 +43,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.utils import get_logger
|
||||
from pyi2phosts.lib.utils import validate_config
|
||||
from pyi2phosts.lib.utils import get_b32
|
||||
|
||||
# validate config
|
||||
validate_config(config)
|
||||
@ -75,9 +74,7 @@ for host in all_hosts:
|
||||
log.debug('testing %s', host.name)
|
||||
# get b32 address from full dest key
|
||||
dest = host.b64hash
|
||||
raw_key = base64.b64decode(dest.encode('utf-8'), '-~')
|
||||
hash = hashlib.sha256(raw_key)
|
||||
b32dest = base64.b32encode(hash.digest()).lower().replace('=', '')+'.b32.i2p'
|
||||
b32dest = get_b32(dest)
|
||||
# do name lookup query with b32 address
|
||||
# it success only if host is alive
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user