alejandro5042 / Run-IrcBot

IRC Bot Toolkit for PowerShell
MIT License
13 stars 4 forks source link

Possible to use with SSL #12

Open ArduinoMasterInfernal opened 5 years ago

ArduinoMasterInfernal commented 5 years ago

Hi, nice job for this bot, it work fine without SSL on IRc Server.

When i try to use this bot with an ssl irc server i got :

Run-Bot : System.Management.Automation.MethodInvocationException: Exception lors de l'appel de «Flush» avec «0» argument(s): «Impossible d'écrire les données sur la connexion de transport : Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte.» ---> System.IO.IOException: Impossible d'écrire les données sur la connexion de transport : Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte. ---> System.Net.Sockets.SocketException: Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte à System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) --- Fin de la trace de la pile d'exception interne --- à System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) à System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) à CallSite.Target(Closure , CallSite , Object ) --- Fin de la trace de la pile d'exception interne --- à System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) à System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) à System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) à System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) Au caractère C:\Users\mytestenvuser\Documents\Ircd\powershell.ps1:603 : 17

** Disconnected [15/02/2019 11:12:43]

Exception lors de l'appel de «Peek» avec «0» argument(s): «Impossible de lire les données de la connexion de transport : Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte.» Au caractère C:\Users\mytestenvuser\Documents\Ircd\powershell.ps1:809 : 24

Do you have any idea how to use your bot with ssl irc server ?

alejandro5042 commented 5 years ago

Hey! Thanks for posting this issue.

Underneath the hood, the bot uses the TcpClient class to establish a connection with the IRC server. It seems that you can add SSL quite easily by using the SslStream class. The 2nd example on that page has relevant code.

If you make it work, please post a PR and I'll accept it!