implement binary patching for multimystery (for now no gui/cli support)

This commit is contained in:
Fabian Dill
2020-03-06 00:48:23 +01:00
parent 9b82f220bb
commit d44acfdaaf
7 changed files with 118 additions and 37 deletions

View File

@@ -151,3 +151,18 @@ class Hint(typing.NamedTuple):
location: int
item: int
found: bool
def get_public_ipv4() -> str:
import socket
import urllib.request
import logging
ip = socket.gethostbyname(socket.gethostname())
try:
ip = urllib.request.urlopen('https://checkip.amazonaws.com/').read().decode('utf8').strip()
except Exception as e:
try:
ip = urllib.request.urlopen('https://v4.ident.me').read().decode('utf8').strip()
except:
logging.exception(e)
pass # we could be offline, in a local game, so no point in erroring out
return ip