included defusedxml package for parsestring & cleaned upnp schema

This commit is contained in:
anand k 2024-02-27 17:56:38 +05:30
parent dd64a7b507
commit 5af8b8d3f7
No known key found for this signature in database
GPG Key ID: 515AC24FA525DDE0
3 changed files with 7 additions and 5 deletions

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,