Jump to content
Sign in to follow this  
sc4ry

DCC and Fish with AutoIt

Recommended Posts

sc4ry

Hello,

can anybody tell me, how i can implement Fish in an AutoIt-Script and how to confirm a dcc-chat request?

thank you very much.

Share this post


Link to post
Share on other sites
trancexx

I had to open three more google tabs just to comprehend the question.

... no I'm lying - two.

I know this guy that's really good with AutoIt but fails miserably using his browser's options (e.g. tabs). He might be able to help you if you could explain better, at least used nouns.

Ok, I lied again.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
sc4ry

Hey,

sorry for the short thread (and for the bad english) ;-)

Ok, here we go.

i want to do a "little" irc script, something like mIRC (for iRC), but without graphic interface. this script should understand main irc-commands (dcc-chat, query, notice).

query and notice is not the problem, but dcc-chat (direct-client-to-client). my script get a request for dcc-chat (and i can proove, if the user is allowed to) ... but how can i tell the requested client, that my script really allows dcc-chat and he can enter a pw?

my second question was about mirc-fish. that is a blowfish crypting script for mirc -> http://fish.secure.la/ (hope this is the correct site).

with this script, incomming and outgoing text is crypted. because a lot of chans (i know), are crypted now, my script can´t read anything, thats why i want to implement it. as i remeber, there are some blowfish scripts for autoit, but ... i don´t know how it really works.

here is the script, i use:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <String.au3>

Global $server = ""
Global $channel = '-1'
Global $nick = ''
Global $port = 
Global $USER, $USER_alt, $text, $txt

TCPStartup ()
Global $sock = _IRCConnect($server, $port, $nick); Verbindung zu IRC und Identifizierung Nickname

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then
        Exit
    EndIf
    $recv = TCPRecv($sock, 8192); Empfängt vom Server
    If @error Then 
        Exit MsgBox(1, "IRC Example", "Server has errored or disconnected"); Verbindung zum Server besteht nicht mehr
    EndIf
    Local $sData = StringSplit($recv, @CRLF); Splittet die Nachrichten, wenn sie vom Server gruppiert werden
    For $i = 1 To $sData[0] Step 1; behandelt jede Nachricht einzeln
        Local $sTemp = StringSplit($sData[$i], " "); Splittet die Nachricht an den Leerzeichen
        If $sTemp[1] = "" Then ContinueLoop; Weiter, wenn leer
        If $sTemp[1] = "PING" Then _IRCPing($sock, $sTemp[2]); Prüft ob PING zurückgegeben wird
        If $sTemp[0] <= 2 Then ContinueLoop; meist nutzlose Informationen
        Switch $sTemp[2]; Splittet die Command Nachricht
            Case "266"; Indikator der zeigt, dass alle Infos gesendet wurden
                _IRCJoinChannel ($sock, $channel)
                _IRCSendMessage($sock, "Hallo!", $channel)
                _IRCChangeMode ($sock, "+i", $nick)
            Case "332" ; Raumthema
                $titel = ''
                For $k = 6 To $sTemp[0]
                    $titel &= $sTemp[$k] & ' '
                Next
                ConsoleWrite('Thema: ' & $titel & @CRLF)
            Case "333" ; Thema von
                ConsoleWrite('Thema von: ' & $sTemp[5] & @CRLF)
            Case "353" ; Userlist
                $text = 'User:' & @CRLF
                For $k = 6 To $sTemp[0]
                    If $k = 6 Then
                        $text &= @TAB & StringTrimLeft($sTemp[$k],1) & @CRLF
                    Else
                        $text &= @TAB & $sTemp[$k] & @CRLF
                    EndIf
                Next
                ConsoleWrite($text & @CRLF)
            Case 'PRIVMSG' ; Nachricht empfangen
                $USER = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                $text = ''
                $txtUSER = ''
                For $k = 4 To $sTemp[0]
                    $text &= $sTemp[$k] & ' '
                Next
                $text = StringTrimLeft($text, 1)
                If StringInStr($text, 'ACTION', 1) Then ; Aktion von USER
                    $text = StringTrimLeft($text, 8)
                    $text = StringLeft($text, StringLen($text)-2)
                    ConsoleWrite('***' & $USER & ' ' & $text & @CRLF)
                ElseIf StringInStr($text, 'DCC CHAT', 1) Then ; Direkt-Chatanfrage
                    $text = 'DCC-Chatanfrage von ' & $USER
                    ConsoleWrite($text & @CRLF)
                Else
                    ConsoleWrite('<' & $USER & '> ' & $text & @CRLF) ; USER spricht
                EndIf
            Case 'JOIN' ; Chatraum wird betreten
                $USER = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                ConsoleWrite('***' & $USER & ' betritt den Raum' & @CRLF)
            Case 'NICK' ; Nick wird gewechselt
                $USER_alt = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                $USER = StringTrimLeft($sTemp[3], 1)
                ConsoleWrite('***' & $USER_alt & ' heißt jetzt: ' & $USER & @CRLF)
            Case 'PART' ; Chatraum wird verlassen
                $USER = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                $txt = $USER & ' verläßt den Chatraum '
                $text = '' 
                If $sTemp[0] > 3 Then
                    For $k = 4 To $sTemp[0]
                        If $k = 4 Then
                            $text &= StringTrimLeft($sTemp[$k], 1) & ' '
                        Else
                            $text &= $sTemp[$k] & ' '
                        EndIf
                    Next
                    $text = StringTrimRight($text, 1)
                EndIf
                ConsoleWrite($txt & $text & @CRLF)
            Case 'QUIT' ; Server wird verlassen
                $USER = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                $txt = $USER & ' verläßt den Chatraum '
                If $sTemp[0] > 3 Then
                    For $k = 4 To $sTemp[0]
                        $text &= $sTemp[$k] & ' '
                    Next
                    $text = StringTrimRight($text, 1)
                    $text = $txt & $text
                EndIf
                ConsoleWrite($txt & $text & @CRLF)
            Case 'NOTICE'
                $USER = StringTrimLeft(StringLeft($sTemp[1], StringInStr($sTemp[1], '!')-1), 1)
                $text = ''
                If $sTemp[0] > 3 Then
                    For $k = 4 To $sTemp[0]
                        If $k = 4 Then
                            $text &= StringTrimLeft($sTemp[$k], 1) & ' '
                        Else
                            $text &= $sTemp[$k] & ' '
                        EndIf
                    Next
                    $text = StringTrimRight($text, 1)
                EndIf
                ;_AuswertungNotiz($USER, $text)
                ConsoleWrite('Befehl von <' & $USER & '> ' & $text & @CRLF) ; USER spricht
            Case Else ; alle Nachrichten, die nicht in andere Kategorien passen, z.B. Server-Infos
                ConsoleWrite('sonstiges: ' & $sData[$i] & @CRLF)
        EndSwitch
    Next
WEnd

Func _AuswertungNotiz($USER, $text)
    
EndFunc

#region IRC-Func
;===============================================================================
;
; Description:      Connects you to a IRC Server, and gives your chosen Nick
; Parameter(s):     $server - IRC Server you wish to connect to
;                   $port - Port to connect to (Usually 6667)
;                   $nick - Nick you choose to use (You can change later)
; Requirement(s):   TCPStartup () to be run
; Return Value(s):  On Success - Socket identifer
;                   On Failure - It will exit on error
; Author(s):        Chip
; Note(s):          English only
;
;===============================================================================
Func _IRCConnect ($server, $port, $nick)
    Local $i = TCPConnect(TCPNameToIP($server), $port)
    If $i = -1 Then Exit MsgBox(1, "IRC.au3 Error", "Server " & $server & " is not responding.")
    TCPSend($i, "NICK " & $nick & @CRLF)
    $ping = tcprecv($i,2048)
    if stringleft($ping,4) = "PING" Then
        $pong = stringreplace($ping,"PING :","")
        tcpsend($i,"PONG " & $pong & @LF)
    EndIf
    TCPSend($i, "USER " & $nick & " 0 0 " & $nick &@CRLF)
    Return $i
EndFunc

;===============================================================================
;
; Description:      Close the IRC Connection
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $msg - Message to send with quit
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        BugFix
; Note(s):          English only
;
;===============================================================================
Func _IRCQuit($irc, $msg="")
    If $irc = -1 Then Return 0
    TCPSend($irc, "QUIT :" & $msg & @CRLF)
    Return 1
EndFunc

;===============================================================================
;
; Description:      Leave the IRC Channel
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $msg - Message to send with part
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        BugFix
; Note(s):          English only
;
;===============================================================================
Func _IRCLeaveChannel ($irc, $msg="", $chan="")
    If $irc = -1 Then Return 0
    TCPSend($irc, "PART " & $chan & " :" & $msg & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

;===============================================================================
;
; Description:      Joins an IRC Channel
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $chan - Channel you wish to join
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):          English only
;
;===============================================================================
Func _IRCJoinChannel ($irc, $chan)
    If $irc = -1 Then Return 0
    TCPSend($irc, "JOIN " & $chan & @CRLF)
    If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

;===============================================================================
;
; Description:      Sends a message using IRC
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $msg - Message you want to send
;                   $chan - Channel/Nick you wish to send to
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):          English only
;
;===============================================================================
Func _IRCSendMessage ($irc, $msg, $chan="")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, $msg & @CRLF)
        If @error Then 
            MsgBox(1, "IRC.au3", "Server has disconnected.")
            Return -1
        EndIf
        Return 1
    EndIf
    TCPSend($irc, "PRIVMSG " & $chan & " :" & $msg & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

;===============================================================================
;
; Description:      Sends a message as ACTION using IRC
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $msg - Message you want to send
;                   $chan - Channel/Nick you wish to send to
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        BugFix
; Note(s):          English only
;
;===============================================================================
Func _IRCSendAction ($irc, $msg, $chan="")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, $msg & @CRLF)
        If @error Then 
            MsgBox(1, "IRC.au3", "Server has disconnected.")
            Return -1
        EndIf
        Return 1
    EndIf
    TCPSend($irc, "PRIVMSG " & $chan & " :" & Chr(1) & "ACTION " & $msg & Chr(1) & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

;===============================================================================
;
; Description:      Changes a MODE on IRC
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $mode - Mode you wish to change
;                   $chan - Channel/Nick you wish to send to
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):          English only
;
;===============================================================================
Func _IRCChangeMode ($irc, $mode, $chan="")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, "MODE " & $mode & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
    EndIf
    TCPSend($irc, "MODE " & $chan & " " & $mode & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

;===============================================================================
;
; Description:      Returns a PING to Server
; Parameter(s):     $irc - Socket Identifer from _IRCConnect ()
;                   $ret - The end of the PING to return
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                   On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):          English only
;
;===============================================================================
Func _IRCPing($irc, $ret)
    If $irc = -1 Then Return 0
    If $ret = "" Then Return -1
    TCPSend($irc, "PONG " & $ret & @CRLF)
    If @error Then
        MsgBox(1, "irc.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc 
#endregion IRC-Func
#region IRC-Syntax
#cs
Common recieves:
Nick = User who the message is from
Name = Settable by user, set in the USER command
host = ISP host

~~~~PRIVMSG~~~~
You recieve this when someone has sent a message in a channel, 
gives you there Nick, host, the channel it was said in and the message.

SYNTAX:
:Nick!Name@host PRIVMSG #Channel :Message

EXAMPLE:
:Chip!Chip@OMN-8243F63D.dsl.bell.ca PRIVMSG #Chip :Hey guy's
Would be a message from Chip to say 'Hey guy's' in the channel #Chip

:Chip!Chip@OMN-8243F63D.dsl.bell.ca PRIVMSG Bob :Hey Bob!
Would be a Personal Message from Chip to Bob saying 'Hey Bob!'
~~~~~~~~~

~~~~MODE~~~~
You recieve this when a mode is changed, a mode can give/take access change certain
things like who can join a channel etc..

SYNTAX:
:Nick!Name@host MODE #Channel +/- MODE (USER)

EXAMPLES:
:ChanServ!services@host MODE #Chip +o Chip
This says ChanServ (usually a service bot) has given Chip Operator access in the channel #Chip

:ChanServ!services@host MODE #Chip +i
This makes #Chip invite only, so only OPs can invite users in the channel.

:Chip!Chip@OMN-8243F63D.dsl.bell.ca MODE Chip +i
This will make Chip invisible to WHOIS. These are usermodes.
~~~~~~~~~

~~~~PING~~~~
You recieves these at random to make sure your still online and
not disconnected. 

SYNTAX:
PING :Randomletters

Usually a PING has random letters that you have to respond with.

EXAMPLE:
PING :29809dj0d

You would respond with
PONG 29809dj0d
~~~~~~~~~~~

~~~~JOIN~~~~
You recieve this when someone joins a channel.

SYNTAX:
:Nick!Name@Host JOIN :#Channel

EXAMPLE:
:Chip!Chip@OMN-8243F63D.dsl.bell.ca JOIN :#Chip
This would be sent to everybody in #Chip to show that Chip has joined the channel #Chip
~~~~~~~~~~~~~

~~~~KICK~~~~
You recieve this when someone gets kicked (Including yourself!)

SYNTAX:
:Nick!Name@Host KICK #Channel User :Reason

EXAMPLE:
:Chip!Name@Host KICK #Chip Bob :Talk in private
Would kick Bob from #Chip and say 'Talk in private' in the reason
~~~~~~~~~~~~~~

~~~~QUIT~~~~
You recieve this when someone disconnects from IRC.

SYNTAX:
:Nick!Name@Host QUIT :Reason

EXAMPLE:
:Chip!Chip@OMN-8243F63D.dsl.bell.ca QUIT :I'm bored
Would be sent to everyone in the channels Chip was in to say that he left IRC because He was bored.
~~~~~~~~~~~~~~

#ce
#endregion IRC-Syntax

Edited by sc4ry

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.