Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Toperlock authored Nov 7, 2023
1 parent 102c4c6 commit a05fbcc
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions parsers/https.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
def parse(data):
info = data[:]
server_info = urlparse(info)
'''
try:
remark = (tool.b64Decode(server_info.netloc)).decode().rsplit("/#", 1)
except UnicodeDecodeError:
remark = (tool.b64Decode(server_info.netloc+server_info.path)).decode().rsplit("/#", 1)
remark = unquote(remark[1]) if len(remark) > 1 else tool.genName() + '_http'
_netloc = remark[0].rsplit("@", 1)
netquery = dict(
(k, v if len(v) > 1 else v[0])
for k, v in parse_qs(server_info.query).items()
)
'''
remark = server_info.fragment
netloc = (tool.b64Decode(server_info.netloc)).decode()
if '@' in netloc:
_netloc = netloc.rsplit("@", 1)
server_port = _netloc[1]
else:
server_port = netloc
node = {
'tag': unquote(remark[1]) if len(remark) > 1 else tool.genName() + '_http',
'tag': remark,
'type': 'http',
'server': re.sub(r"\[|\]", "", _netloc[1].rsplit(":", 1)[0]),
'server_port': int(_netloc[1].rsplit(":", 1)[1]),
'username': _netloc[0].split(":")[0],
'password': _netloc[0].split(":")[1],
'server': re.sub(r"\[|\]", "", server_port.rsplit(":", 1)[0]),
'server_port': int(server_port.rsplit(":", 1)[1]),
'tls': {
'enabled': True
'enabled': True,
'insecure': True
}
}
if netquery.get('insecure') and netquery['insecure'] == '1' :
node['tls']['insecure'] = True
if '@' in netloc:
node['username'] = _netloc[0].split(":")[0]
node['password'] = _netloc[0].split(":")[1]
return (node)

0 comments on commit a05fbcc

Please sign in to comment.