Code quality + Security related changes #2184

Merged
anand-skss merged 2 commits from code-quality1 into v0.6 2024-02-28 04:35:51 +01:00
3 changed files with 7 additions and 5 deletions
Showing only changes of commit 5af8b8d3f7 - Show all commits

View File

@ -220,7 +220,7 @@ def updateConfig():
addressInKeysFile, 'payloadlengthextrabytes',
str(int(previousSmallMessageDifficulty * 1000)))
except (ValueError, TypeError, configparser.NoSectionError,
configparser.NoSectionError):
configparser.NoOptionError):
continue
config.set('bitmessagesettings', 'maxdownloadrate', '0')
config.set('bitmessagesettings', 'maxuploadrate', '0')

View File

@ -272,7 +272,7 @@ def buildCPoW():
try:
if "bsd" in sys.platform:
# BSD make
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"),
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"),
'-f', 'Makefile.bsd']) # nosec:B607, B603
else:
# GNU make

View File

@ -1,16 +1,18 @@
# pylint: disable=too-many-statements,too-many-branches,protected-access,no-self-use
# pylint: disable=too-many-statements,too-many-branches,protected-access,no-self-use
"""
Complete UPnP port forwarding implementation in separate thread.
Reference: http://mattscodecave.com/posts/using-python-and-upnp-to-forward-a-port
"""
import httplib
import re
import socket
import time
import urllib2
from random import randint
from urlparse import urlparse
from xml.dom.minidom import Document, parseString
from xml.dom.minidom import Document # nosec:B408
from defusedxml.minidom import parseString
import queues
import state
@ -119,7 +121,7 @@ class Router: # pylint: disable=old-style-class
if service.childNodes[0].data.find('WANIPConnection') > 0 or \
service.childNodes[0].data.find('WANPPPConnection') > 0:
self.path = service.parentNode.getElementsByTagName('controlURL')[0].childNodes[0].data
self.upnp_schema = service.childNodes[0].data.split(':')[-2]
self.upnp_schema = re.sub(r'[^A-Za-z0-9:-]', '', service.childNodes[0].data.split(':')[-2])
def AddPortMapping(
self,