Skip to content

Commit

Permalink
Merge pull request ZeroNetX#173 from zeronet-conservancy/reduce_finge…
Browse files Browse the repository at this point in the history
…rprinting

Reduce fingerprinting available to sites

refs ZeroNetX#163
  • Loading branch information
caryoscelus authored Nov 15, 2022
2 parents 21699d0 + f2884f3 commit 8c99af1
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 35 deletions.
1 change: 1 addition & 0 deletions src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(self, argv):
self.user_agent = "conservancy"
# DEPRECATED ; replace with git-generated commit
self.rev = 5036
self.user_agent_rev = 8192
self.argv = argv
self.action = None
self.test_parser = None
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def getHandshakeInfo(self):
"fileserver_port": self.server.port,
"port_opened": self.server.port_opened.get(self.ip_type, None),
"target_ip": self.ip,
"rev": 8192,
"rev": config.user_agent_rev,
"crypt_supported": crypt_supported,
"crypt": self.crypt,
"time": int(time.time())
Expand Down
114 changes: 80 additions & 34 deletions src/Ui/UiWebsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,14 @@ def formatSiteInfo(self, site, create_user=True):
del(content["signers_sign"])

settings = site.settings.copy()
del settings["wrapper_key"] # Dont expose wrapper key
# remove fingerprinting information for non-admin sites
if 'ADMIN' not in self.site.settings['permissions']:
del settings['wrapper_key']
settings['added'] = 0
settings['serving'] = True
settings['ajax_key'] = ''
settings['peers'] = 1
settings['cache'] = {}

ret = {
"auth_address": self.user.getAuthAddress(site.address, create=create_user),
Expand All @@ -281,49 +288,88 @@ def formatSiteInfo(self, site, create_user=True):
"workers": len(site.worker_manager.workers),
"content": content
}
if 'ADMIN' not in self.site.settings['permissions']:
ret.update({
"content_updated": 0,
"bad_files": len(site.bad_files), # ?
"size_limit": site.getSizeLimit(), # ?
"next_size_limit": site.getNextSizeLimit(), # ?
"peers": 1,
"started_task_num": 0,
"tasks": 0,
"workers": 0,
})
if site.settings["own"]:
ret["privatekey"] = bool(self.user.getSiteData(site.address, create=create_user).get("privatekey"))
if site.isServing() and content:
if site.isServing() and content and "ADMIN" in self.site.settings['permissions']:
ret["peers"] += 1 # Add myself if serving
return ret

def formatServerInfo(self):
import main
file_server = main.file_server
if file_server.port_opened == {}:
ip_external = None
# unprivileged sites should not get any fingerprinting information
if "ADMIN" in self.site.settings['permissions']:
import main
file_server = main.file_server
if file_server.port_opened == {}:
ip_external = None
else:
ip_external = any(file_server.port_opened.values())
back = {
'ip_external' : ip_external,
'port_opened' : file_server.port_opened,
'platform' : sys.platform,
'dist_type' : config.dist_type,
'fileserver_ip' : config.fileserver_ip,
'fileserver_port' : config.fileserver_port,
'tor_enabled' : file_server.tor_manager.enabled,
'tor_status' : file_server.tor_manager.status,
'tor_has_meek_bridges' : file_server.tor_manager.has_meek_bridges,
'tor_use_bridges' : config.tor_use_bridges,
'ui_ip' : config.ui_ip,
'ui_port' : config.ui_port,
'version' : config.version,
'rev' : config.rev,
'timecorrection' : file_server.timecorrection,
'language' : config.language,
'debug' : config.debug,
'offline' : config.offline,
'plugins' : PluginManager.plugin_manager.plugin_names,
'plugins_rev' : PluginManager.plugin_manager.plugins_rev,
'user_settings' : self.user.settings,
'lib_verify_best' : CryptBitcoin.lib_verify_best
}
else:
ip_external = any(file_server.port_opened.values())
back = {
"ip_external": ip_external,
"port_opened": file_server.port_opened,
"platform": sys.platform,
"fileserver_ip": config.fileserver_ip,
"fileserver_port": config.fileserver_port,
"tor_enabled": file_server.tor_manager.enabled,
"tor_status": file_server.tor_manager.status,
"tor_has_meek_bridges": file_server.tor_manager.has_meek_bridges,
"tor_use_bridges": config.tor_use_bridges,
"ui_ip": config.ui_ip,
"ui_port": config.ui_port,
"version": config.version,
"rev": config.rev,
"timecorrection": file_server.timecorrection,
"language": config.language,
"debug": config.debug,
"offline": config.offline,
"plugins": PluginManager.plugin_manager.plugin_names,
"plugins_rev": PluginManager.plugin_manager.plugins_rev,
"user_settings": self.user.settings
}
if "ADMIN" in self.site.settings["permissions"]:
# back["updatesite"] = config.updatesite
back["dist_type"] = config.dist_type
back["lib_verify_best"] = CryptBitcoin.lib_verify_best
back = {
'ip_external' : None,
'port_opened' : False,
'platform' : 'generic',
'dist_type' : 'generic',
'fileserver_ip' : '127.0.0.1',
'fileserver_port' : 15441,
'tor_enabled' : True,
'tor_status' : 'OK',
'tor_has_meek_bridges' : True,
'tor_use_bridges' : True,
'ui_ip' : '127.0.0.1',
'ui_port' : 43110,
'version' : config.user_agent,
'rev' : config.user_agent_rev,
'timecorrection' : 0.0,
'language' : config.language, #?
'debug' : False,
'offline' : False,
'plugins' : [],
'plugins_rev' : {},
'user_settings' : self.user.settings #?
}
return back

def formatAnnouncerInfo(self, site):
return {"address": site.address, "stats": site.announcer.stats}
if "ADMIN" in self.site.settings['permissions']:
stats = site.announcer.stats
else:
stats = {}
return {"address": site.address, "stats": stats}

# - Actions -

Expand Down

0 comments on commit 8c99af1

Please sign in to comment.