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