Jump to content

Search the Community

Showing results for tags 'irc console'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi Everyone, here again a POC (as always). Today a irc server which can take command from an irc client and execute functions and reply with answers. it is very basic so you can modify to your needs, enjoy. you will need the by the marvelous Kip for it to work. #include "TCP.au3" $hServer = _TCP_Server_Create(6667); A IRC server. Tadaa! Global $GLOBAL_hSocket, $connected, $motd = False, $username AdlibRegister("pingpong", 60000) AdlibRegister("sendmodt", 1000) _TCP_RegisterEvent($hServer, $TCP_NEWCLIENT, "NewClient") _TCP_RegisterEvent($hServer, $TCP_DISCONNECT, "Disconnect") _TCP_RegisterEvent($hServer, $TCP_RECEIVE, "Received") While 1 WEnd Func NewClient($hSocket, $iError) ConsoleWrite("New Client: " & $hSocket & @CRLF) $connected = True $motd = True $GLOBAL_hSocket = $hSocket EndFunc ;==>NewClient Func Disconnect($hSocket, $iError) ConsoleWrite("!Disconnect: " & $hSocket & @CRLF) $connected = False $GLOBAL_hSocket = False EndFunc ;==>Disconnect Func Received($hSocket, $sReceived, $iError) Local $msg = StringSplit($sReceived, @LF) For $i = 0 To UBound($msg) - 1 Step 1 rcv_msg($hSocket, $msg[$i], $iError) Next EndFunc ;==>Received Func rcv_msg($hSocket, $msg, $iError) ConsoleWrite("+receive:" & $msg & @CRLF) If StringLeft($msg, 4) = "ping" Then ircsend($hSocket, StringReplace($msg, "ping", "pong") & @CRLF) If StringLeft($msg, 4) = "NICK" Then $username = StringTrimLeft($msg, 5) If StringLeft($msg, 17) = "PRIVMSG #autoit :" Then ircsend($hSocket, ":root!root PRIVMSG #autoit :" & StringTrimLeft($msg, 17) & @CRLF) commands(StringTrimLeft($msg, 17)) EndIf EndFunc ;==>rcv_msg Func pingpong() If $connected Then ircsend($GLOBAL_hSocket, "PING :" & Random(1000, 9999, 1) & @CRLF) EndFunc ;==>pingpong Func sendmodt() If $motd Then For $i = 1 To 1 ircsend($GLOBAL_hSocket, ":localhost 001 " & $username & " :Welcome to the AutoIT Internet Relay Chat Network " & $username & "" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 002 " & $username & " :Your host is localhost[localhost/6667], running version AutoIT-Console v0.1" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 375 " & $username & " :- localhost Message of the Day -" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 372 " & $username & " :- Welcome to AutoIT - The Open and Free Management System" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 376 " & $username & " :End of /MOTD command." & @CRLF) ircsend($GLOBAL_hSocket, ":" & $username & "!" & $username & " JOIN :#autoit" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 332 " & $username & " #autoit :Welcome to the AutoIT Console v0.1" & @CRLF) ircsend($GLOBAL_hSocket, ":localhost 353 " & $username & " @ #autoit :root " & $username & "" & @CRLF) ircsend($GLOBAL_hSocket, "366 " & $username & " #bitlbee :End of /NAMES list." & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :Hi" & $username & @CRLF) Next EndIf $motd = False EndFunc ;==>sendmodt Func ircsend($GLOBAL_hSocket, $msg) ConsoleWrite("-output :" & $msg) TCPSend($GLOBAL_hSocket, $msg) EndFunc ;==>ircsend Func commands($command) Switch $command Case "status" ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :|----------------------------STATUS----------------------------|" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("Computername: " & @ComputerName) & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("IPAdress1: " & @IPAddress1) & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("Username: " & @UserName) & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) Case "help" ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :|-----------------------------HELP-----------------------------|" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("List of commands that can be issued against root") & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("help you are looking at it") & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :" & padmsg("status shows the current status of the server") & @CRLF) ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :+--------------------------------------------------------------+" & @CRLF) Case Else ircsend($GLOBAL_hSocket, ":root!root PRIVMSG #autoit :command unknown, try help" & @CRLF) EndSwitch EndFunc ;==>commands Func padmsg($msg) Local $len = StringLen($msg) Local $res = "| " $res &= $msg For $i = $len To 60 $res &= " " Next $res &= "|" Return $res EndFunc ;==>padmsg Best Regards, JR.
×
×
  • Create New...