[TLS] You can now connect the bot over a ssl connection

This commit is contained in:
Julian Marcos 2021-12-19 12:30:31 +00:00
parent 4ffaf93969
commit efbf1299f8
2 changed files with 7 additions and 1 deletions

7
bot.py
View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
import socket, rich, asyncio, time, re
import socket, rich, asyncio, time, re, ssl
from config import *
class bot:
@ -106,7 +106,12 @@ class bot:
readbuffer=""
s = socket.socket()
ctx = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
if tls == True:
s = ctx.wrap_socket(s)
s.connect((HOST, PORT))
asyncio.run(bot.ConnectionSetup())

View File

@ -8,3 +8,4 @@ NICK = fileload('conf/nick')
REALNAME = fileload('conf/realname')
SERVICES_PW = fileload('conf/pw')
CHANNELS = fileload('conf/chans')
tls = fileload('conf/port') == '6697'