mirror of
https://github.com/nichkara/InfinitumBotty.git
synced 2026-06-11 06:36:24 +02:00
Changed Connection to SSL Connection.
This commit is contained in:
@@ -2,6 +2,7 @@ import _thread
|
|||||||
import queue
|
import queue
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
import ssl
|
||||||
from threading import Condition
|
from threading import Condition
|
||||||
|
|
||||||
from FaustBot.Communication.JoinObservable import JoinObservable
|
from FaustBot.Communication.JoinObservable import JoinObservable
|
||||||
@@ -20,7 +21,7 @@ class Connection(object):
|
|||||||
send_queue = queue.Queue()
|
send_queue = queue.Queue()
|
||||||
details = None
|
details = None
|
||||||
irc = None
|
irc = None
|
||||||
|
wraper = None
|
||||||
def sender(self):
|
def sender(self):
|
||||||
while True:
|
while True:
|
||||||
msg = self.send_queue.get()
|
msg = self.send_queue.get()
|
||||||
@@ -135,9 +136,10 @@ class Connection(object):
|
|||||||
"""
|
"""
|
||||||
establish the connection
|
establish the connection
|
||||||
"""
|
"""
|
||||||
|
self.wraper = ssl.create_default_context()
|
||||||
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
socker = socket.create_connection((self.details.get_server(), self.details.get_port()))
|
||||||
self.irc.connect((self.details.get_server(), self.details.get_port()))
|
self.irc =self.wraper.wrap_socket(socker, server_hostname=self.details.get_server())
|
||||||
#print(self.irc.recv(512))
|
#print(self.irc.recv(512))
|
||||||
self.irc.send("NICK ".encode() + self.details.get_nick().encode() + "\r\n".encode())
|
self.irc.send("NICK ".encode() + self.details.get_nick().encode() + "\r\n".encode())
|
||||||
self.irc.send("USER botty botty botty :Botty \n".encode())
|
self.irc.send("USER botty botty botty :Botty \n".encode())
|
||||||
|
|||||||
Reference in New Issue
Block a user