Added a settings to disable SSL certificate validation for Podnapisi. Be careful as it's causing a security risk for a man in the middle (MitM) attack. #1565

pull/1581/head v0.9.10-beta.11
morpheus65535 3 years ago
parent 9fff275f1c
commit d851c16da7

@ -134,6 +134,9 @@ defaults = {
'username': '', 'username': '',
'password': '' 'password': ''
}, },
'podnapisi': {
'verify_ssl': 'True'
},
'legendasdivx': { 'legendasdivx': {
'username': '', 'username': '',
'password': '', 'password': '',

@ -147,6 +147,7 @@ def get_providers_auth():
'podnapisi' : { 'podnapisi' : {
'only_foreign': False, # fixme 'only_foreign': False, # fixme
'also_foreign': False, # fixme 'also_foreign': False, # fixme
'verify_ssl': settings.podnapisi.getboolean('verify_ssl')
}, },
'subscene' : { 'subscene' : {
'username' : settings.subscene.username, 'username' : settings.subscene.username,

@ -135,7 +135,17 @@ export const ProviderList: Readonly<ProviderInfo[]> = [
use_hash: "Use Hash", use_hash: "Use Hash",
}, },
}, },
{ key: "podnapisi" }, {
key: "podnapisi",
name: "Podnapisi",
defaultKey: {
verify_ssl: true,
},
keyNameOverride: {
verify_ssl:
"Verify SSL certificate (disabling introduce a MitM attack risk)",
},
},
{ {
key: "regielive", key: "regielive",
name: "RegieLive", name: "RegieLive",

@ -109,10 +109,12 @@ class PodnapisiSubtitle(_PodnapisiSubtitle):
return matches return matches
class PodnapisiAdapter(HTTPAdapter): class PodnapisiAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False): def init_poolmanager(self, connections, maxsize, block=False):
ctx = ssl.create_default_context() ctx = ssl.create_default_context()
ctx.set_ciphers('DEFAULT@SECLEVEL=1') ctx.set_ciphers('DEFAULT@SECLEVEL=1')
ctx.check_hostname = False
self.poolmanager = poolmanager.PoolManager( self.poolmanager = poolmanager.PoolManager(
num_pools=connections, num_pools=connections,
maxsize=maxsize, maxsize=maxsize,
@ -121,6 +123,7 @@ class PodnapisiAdapter(HTTPAdapter):
ssl_context=ctx ssl_context=ctx
) )
class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin): class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
languages = ({Language('por', 'BR'), Language('srp', script='Latn'), Language('srp', script='Cyrl')} | languages = ({Language('por', 'BR'), Language('srp', script='Latn'), Language('srp', script='Cyrl')} |
{Language.fromalpha2(l) for l in language_converters['alpha2'].codes}) {Language.fromalpha2(l) for l in language_converters['alpha2'].codes})
@ -130,12 +133,14 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
server_url = 'https://podnapisi.net/subtitles/' server_url = 'https://podnapisi.net/subtitles/'
only_foreign = False only_foreign = False
also_foreign = False also_foreign = False
verify_ssl = True
subtitle_class = PodnapisiSubtitle subtitle_class = PodnapisiSubtitle
hearing_impaired_verifiable = True hearing_impaired_verifiable = True
def __init__(self, only_foreign=False, also_foreign=False): def __init__(self, only_foreign=False, also_foreign=False, verify_ssl=True):
self.only_foreign = only_foreign self.only_foreign = only_foreign
self.also_foreign = also_foreign self.also_foreign = also_foreign
self.verify_ssl = verify_ssl
if only_foreign: if only_foreign:
logger.info("Only searching for foreign/forced subtitles") logger.info("Only searching for foreign/forced subtitles")
@ -145,6 +150,7 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin):
def initialize(self): def initialize(self):
super().initialize() super().initialize()
self.session.mount('https://', PodnapisiAdapter()) self.session.mount('https://', PodnapisiAdapter())
self.session.verify = self.verify_ssl
def list_subtitles(self, video, languages): def list_subtitles(self, video, languages):
if video.is_special: if video.is_special:

Loading…
Cancel
Save