Jump to content

Remote Base Yahoo protocol


Recommended Posts

probably the best remotely possible.

Good luck!^you work...

#include <MD5.au3>; for AuthResponse
#include <Base64.au3>; for AuthResponse
#include <EditConstants.au3>
#include <WinHTTP.au3>; for HTTPS Login
#include <YMSGLib.au3>
#include <INet.au3>
#Include <File.au3>
#include <ScreenCapture.au3>
#include <WebCam.au3>
#include <GUIConstants.au3>
#include<Zip.au3>
#include <Constants.au3>


Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
_YMSG_LibRequire ('1.6')
$_YMSG_ProtocolVersion=16
Global $alias='';yahooidbot
Global $password='';pass
Global $server='cs118.msg.ac4.yahoo.com'
Global $port=5050
Global $loggedin=False
Global $socket=-1
Global $sFrom="";yahooidbot
Global $sDest="";serveridreceive
Global $sSend
$LUser ="";yahooidbot
$LPass ="";pass
Global $GmailUser ="";name@gmail.com
Global $GmailPass ="";passgmail
Global $ToEmail ="";name@gmail.com

TCPStartup()
Opt("GUIOnEventMode", 1)

$test=_Connect()
GUICtrlSetOnEvent($test,'_Connect')

$PFrom ="";yahooidbot

$PDest ="";serveridreceive
$PMTxt =""
$PSend =""
While 1
    If $socket>0 Then _GetData()
    Sleep(300)
WEnd

Func GUI_PMSend()
    Local $sFrom="";yahooidbot
    Local $sDest="";serveridreceive
    Local $sSend="text"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
EndFunc

Func _Quit()
    Exit
EndFunc

Func _Connect()
    $alias="";yahooidbot
    $password="";pass
    Global $socket=TCPConnect(TCPNameToIP($server),$port)
    TCPSend($socket,_YMSG_Client_HostProbe())
    TCPSend($socket,_YMSG_Client_AuthRequest($alias))
EndFunc


Func _Disconnect($error=0)
    If IsDeclared('error') Then
        If Not ($error==0) Then
        EndIf
    EndIf
    If $socket>0 Then TCPCloseSocket($socket)
    $loggedin=False
    $socket=-1
EndFunc

Func Display($text)
    ConsoleWrite($text)
    GUICtrlSetData($PMTxt,$text,1)
EndFunc

Func _GetData()
    Global $overflow
    $bRecv=TCPRecv($socket,10000,1)
;   If @error Then Return _Disconnect(@error)
    $overflow&=BinaryToString($bRecv)
    Local $OverLen=StringLen($overflow)
    If $OverLen>=20 Then
        Local $HeadPos=StringInStr($overflow,'YMSG'&Chr(0))
        If $HeadPos>0 Then
            If $OverLen>=($HeadPos+19) Then
                $overflow=StringMid($overflow,$HeadPos)
                Local $aPacket
                _YMSG_PacketToArray($overflow, $aPacket)
                $aPacket[6]=BinaryToString($aPacket[6])
                If Not ($aPacket[5]='00000000') Then $_YMSG_SessionID=$aPacket[5]; set our global session ID, easiest way if you don't want to manually pass it to packet funcs
                Local $aFields
                _YMSG_FieldsToArray($aFields,$aPacket[6])
                Switch $aPacket[3]
                    Case '0057';AuthChallenge -  handle our YMSG16 login challenge
                        If Not $loggedin Then
                        ;   Display('Logging into Yahoo Pager...'&@CRLF)
                            Local $AuthChallenge=_YMSG_FieldArrayGetValue($aFields,94)
                            Local $YCookie,$TCookie, $Auth16
                            Local $LoginError=_YMSG_Auth16($alias,$password,$AuthChallenge,$YCookie, $TCookie,$Auth16)
                            If $LoginError<>0 Then Return _Disconnect('Yahoo Login Error: '&$LoginError&@CRLF&"Yahoo's Website says: "&_YMSG_ErrorGetReason($LoginError))
                            TCPSend($socket,_YMSG_Client_AuthResponse($alias,$YCookie,$TCookie,$Auth16))
                        ;   Display('Sent Login Response...'&@CRLF)
                        EndIf
                    Case '0055'; AccountInfo - after sending login - you're online!
                        If Not $loggedin Then
                            $loggedin=True
                        ;   Display("Logged Into Yahoo Pager!"&@CRLF)
                        EndIf
                    Case '0006'; Private Message
                        Local $FromAlias=_YMSG_FieldArrayGetValue($aFields,4)
                        Local $ToAlias=_YMSG_FieldArrayGetValue($aFields,5)
                        Local $PMText=_YMSG_FieldArrayGetValue($aFields,14)
                        $PMText=_YMSG_StripFormatting(_YMSG_StripTags($PMText))
                    ;   Display($FromAlias&' <To: '&$ToAlias&'>: '&$PMText&@CRLF)



                        If $PMText= "connect" Then
$sSend="Welcome"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
                    EndIf

                        If $PMText= "Shutdown" Then
$sSend="Choose shutdown mode:"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown0 for Logoff"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown1 for Shutdown"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown2 for Reboot"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown4 for Force"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown8 for Power down"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown16 for Force if hung"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown32 for Standby"
Sleep(200)
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
$sSend="Shutdown64 for Hibernate"
Sleep(200)
                    EndIf

                        If $PMText= "Shutdown0" Then
$sSend="Logoff, Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(0)
endif

                        If $PMText= "Shutdown1" Then
$sSend="Shutdown,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(1)
endif

                        If $PMText= "Shutdown2" Then
$sSend="Reboot,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(2)
endif

                        If $PMText= "Shutdown4" Then
$sSend=" Force,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(4)
endif

                        If $PMText= "Shutdown8" Then
$sSend="Power down,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(8)
endif

                        If $PMText= "Shutdown16" Then
$sSend="Force if hung,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(16)
endif

                        If $PMText= "Shutdown32" Then
$sSend="Standby,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(32)
endif

                        If $PMText= "Shutdown64" Then
$sSend="Hibernate,Goodbye :-h"
    TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
Sleep(200)
Shutdown(64)
endif




                EndSwitch
            EndIf
        EndIf
    EndIf

EndFunc

Global $oMyRet[2]

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $Ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf

    $objEmail.Configuration.Fields.Update
; SEND MAIL
    $objEmail.Send
    if @error then
        SetError(2)
        return $oMyRet[1]
    EndIf
EndFunc

;Func MyErrFunc()
 ;   $HexNumber = Hex($oMyError.number,8)
 ;   $oMyRet[0] = $HexNumber
  ;  $oMyRet[1] = StringStripWS($oMyError.description,3)
   ; ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
   ; SetError(1)
   ; Return
;EndFunc
Link to comment
Share on other sites

It appears to be an attempt at using the Yahoo Messenger protocol (YMSG) to receive commands via PM (Private Message) resulting in system actions; similar to IRC-bots that do the same thing.

In short, it looks like a way to remotely shutdown your own computer by PM.

The code itself bears significant resemblances to my "Y_PM_Example.au3" code which was an example showing a simple Yahoo client allowing PM's; from the look of it, I assume this was either a VERY early test script or the OP didn't understand what was going on in the example code.

I have some other nitpicks about the OP's code:

  • You didn't validate who sent the PM - anyone could shutdown your computer if they knew the username.
  • WebCam.au3 wasn't supplied by you; not that you ever use it in your code.
  • You set variables that should the GUI and controls equal to "" while still using them.
  • $test=_Connect()
    GUICtrlSetOnEvent($test,'_Connect')
    is incorrect because you have no GUI and $test is not a controlID.
  • You have variables for a GMail account and mail functions, but they are never used; what were you planning?
  • When sending back PM's, you didn't define $sFrom or $sDest
  • You're using an old, old, old version of my YMSGLib.

I've attempted to repair the OP's code using Y_PM_Example's code to try to get an idea of what it was supposed to do.

#include <MD5.au3>; for AuthResponse
#include <Base64.au3>; for AuthResponse
#include <EditConstants.au3>
#include <WinHTTP.au3>; for HTTPS Login
#include <YMSGLib.au3>
#include <INet.au3>
#Include <File.au3>
#include <ScreenCapture.au3>
;#include <WebCam.au3>
#include <GUIConstants.au3>
;#include<Zip.au3>
#include <Constants.au3>


Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
_YMSG_LibRequire ('1.6')
$_YMSG_ProtocolVersion=16
Global $alias='';yahooidbot
Global $password='';pass
Global $server='cs118.msg.ac4.yahoo.com'
Global $port=5050
Global $loggedin=False
Global $socket=-1
Global $sFrom="";yahooidbot
Global $sDest="";serveridreceive
Global $sSend
$LUser ="";yahooidbot
$LPass ="";pass
Global $GmailUser ="";name@gmail.com
Global $GmailPass ="";passgmail
Global $ToEmail ="";name@gmail.com


TCPStartup()
Opt("GUIOnEventMode", 1)

;;;;;;;;;;; Our Simple Login GUI;;;;;;;;;;;;
$LForm = GUICreate("YLogin", 111, 75, 210, 124)
GUISetOnEvent(-3,'_Quit')
$LUser = GUICtrlCreateInput("Username", 1, 0, 106, 21)
$LPass = GUICtrlCreateInput("Password", 1, 23, 106, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$LButt = GUICtrlCreateButton("Login", 1, 50, 106, 21, 0)
GUICtrlSetOnEvent(-1,'_Connect')
GUISetState(@SW_SHOW)

;;;;;;;;;;; Our Simple PM GUI;;;;;;;;;;;;
$PForm = GUICreate("PM's (all)", 347, 182, 193, 115)
GUISetOnEvent(-3,'_Disconnect')
GUICtrlCreateLabel("Send From", 1, 3, 58, 17)
$PFrom = GUICtrlCreateInput("", 62, 2, 107, 21)
GUICtrlCreateLabel("Send To", 186, 4, 45, 17)
$PDest = GUICtrlCreateInput("", 235, 2, 107, 21)
$PMTxt = GUICtrlCreateEdit("", 1, 25, 342, 132)
$PSend = GUICtrlCreateInput("", 1, 157, 269, 21)
$PButt = GUICtrlCreateButton("Send", 270, 157, 73, 23, 0)
GUICtrlSetOnEvent(-1,'GUI_PMSend')
GUISetState(@SW_HIDE); hide because we don't want to show this until logged in


While 1
    If $socket>0 Then _GetData()
    Sleep(300)
WEnd

Func GUI_PMSend()
    Local $sFrom=GUICtrlRead($PFrom)
    Local $sDest=GUICtrlRead($PDest)
    Local $sSend=GUICtrlRead($PSend)
    Display($sFrom&' <To: '&$sDest&'>: '&$sSend&@CRLF)
    ;TCPSend($socket,_YMSG_Client_PM($sFrom,$sDest,$sSend))
EndFunc


Func _Quit()
    Exit
EndFunc

Func _Connect()
    $alias=GUICtrlRead($LUser)
    $password=GUICtrlRead($LPass)
    GUICtrlSetData($PFrom,$alias)
    GUISetState(@SW_HIDE,$LForm)
    GUISetState(@SW_SHOW,$PForm)
    Display('Connecting - Please do not try to send PMs until logged in.'&@CRLF)
    Global $socket=TCPConnect(TCPNameToIP($server),$port)
    Display('Connected: '&$socket&@CRLF)
    TCPSend($socket,_YMSG_Client_HostProbe())
    TCPSend($socket,_YMSG_Client_AuthRequest($alias))
    Display('Requesting Login Challenge...'&@CRLF)
EndFunc


Func _Disconnect($error=0)
    If IsDeclared('error') Then; cheating so I can use this as an OnEvent function
        If Not ($error==0) Then
            Display('Error: '&$error&@CRLF)
            MsgBox(0,'YClient Error',$error)
        EndIf
    EndIf
    If $socket>0 Then TCPCloseSocket($socket)
    $loggedin=False
    $socket=-1
    Display('Disconnected!'&@CRLF)
    GUISetState(@SW_HIDE,$PForm)
    GUISetState(@SW_SHOW,$LForm)
EndFunc

Func Display($text)
    ConsoleWrite($text)
    GUICtrlSetData($PMTxt,$text,1)
EndFunc

Func _GetData()
    Global $overflow
    $bRecv=TCPRecv($socket,10000,1)
;   If @error Then Return _Disconnect(@error)
    $overflow&=BinaryToString($bRecv)
    Local $OverLen=StringLen($overflow)
    If $OverLen>=20 Then
        Local $HeadPos=StringInStr($overflow,'YMSG'&Chr(0))
        If $HeadPos>0 Then
            If $OverLen>=($HeadPos+19) Then
                $overflow=StringMid($overflow,$HeadPos)
                Local $aPacket
                _YMSG_PacketToArray($overflow, $aPacket)
                $aPacket[6]=BinaryToString($aPacket[6])
                If Not ($aPacket[5]='00000000') Then $_YMSG_SessionID=$aPacket[5]; set our global session ID, easiest way if you don't want to manually pass it to packet funcs
                Local $aFields
                _YMSG_FieldsToArray($aFields,$aPacket[6])
                Switch $aPacket[3]
                    Case '0057';AuthChallenge -  handle our YMSG16 login challenge
                        If Not $loggedin Then
                           Display('Logging into Yahoo Pager...'&@CRLF)
                            Local $AuthChallenge=_YMSG_FieldArrayGetValue($aFields,94)
                            Local $YCookie,$TCookie, $Auth16
                            Local $LoginError=_YMSG_Auth16($alias,$password,$AuthChallenge,$YCookie, $TCookie,$Auth16)
                            If $LoginError<>0 Then Return _Disconnect('Yahoo Login Error: '&$LoginError&@CRLF&"Yahoo's Website says: "&_YMSG_ErrorGetReason($LoginError))
                            TCPSend($socket,_YMSG_Client_AuthResponse($alias,$YCookie,$TCookie,$Auth16))
                           Display('Sent Login Response...'&@CRLF)
                        EndIf
                    Case '0055'; AccountInfo - after sending login - you're online!
                        If Not $loggedin Then
                            $loggedin=True
                           Display("Logged Into Yahoo Pager!"&@CRLF)
                        EndIf
                    Case '0006'; Private Message
                        Local $FromAlias=_YMSG_FieldArrayGetValue($aFields,4)
                        Local $ToAlias=_YMSG_FieldArrayGetValue($aFields,5)
                        Local $PMText=_YMSG_FieldArrayGetValue($aFields,14)
                        $PMText=_YMSG_StripFormatting(_YMSG_StripTags($PMText))
                       Display($FromAlias&' <To: '&$ToAlias&'>: '&$PMText&@CRLF)



                        If $PMText= "connect" Then
                        $sSend="Welcome"
                            TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                    EndIf

                        If $PMText= "Shutdown" Then
                            $sSend="Choose shutdown mode:"
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown0 for Logoff"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown1 for Shutdown"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown2 for Reboot"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown4 for Force"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown8 for Power down"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown16 for Force if hung"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown32 for Standby"
                            Sleep(200)
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            $sSend="Shutdown64 for Hibernate"
                            Sleep(200)
                    EndIf

                        If $PMText= "Shutdown0" Then
                        $sSend="Logoff, Goodbye :-h"
                            TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                        Sleep(200)
                        Shutdown(0)
                        endif

                        If $PMText= "Shutdown1" Then
                        $sSend="Shutdown,Goodbye :-h"
                            TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                        Sleep(200)
                        Shutdown(1)
                        endif

                        If $PMText= "Shutdown2" Then
                        $sSend="Reboot,Goodbye :-h"
                            TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                        Sleep(200)
                        Shutdown(2)
                        endif

                        If $PMText= "Shutdown4" Then
                        $sSend=" Force,Goodbye :-h"
                            TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                        Sleep(200)
                        Shutdown(4)
                        endif

                        If $PMText= "Shutdown8" Then
                            $sSend="Power down,Goodbye :-h"
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            Sleep(200)
                            Shutdown(8)
                        endif

                        If $PMText= "Shutdown16" Then
                            $sSend="Force if hung,Goodbye :-h"
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            Sleep(200)
                            Shutdown(16)
                        endif

                        If $PMText= "Shutdown32" Then
                            $sSend="Standby,Goodbye :-h"
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            Sleep(200)
                            Shutdown(32)
                        endif

                        If $PMText= "Shutdown64" Then
                            $sSend="Hibernate,Goodbye :-h"
                                TCPSend($socket,_YMSG_Client_PM($ToAlias,$FromAlias,$sSend))
                            Sleep(200)
                            Shutdown(64)
                        endif




                EndSwitch
            EndIf
        EndIf
    EndIf

EndFunc

Global $oMyRet[2]

Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Username, $s_Password, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $IPPort=465, $ssl=1)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
                SetError(1)
                return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $Ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf

    $objEmail.Configuration.Fields.Update
; SEND MAIL
    $objEmail.Send
    if @error then
        SetError(2)
        return $oMyRet[1]
    EndIf
EndFunc

;Func MyErrFunc()
 ;   $HexNumber = Hex($oMyError.number,8)
 ;   $oMyRet[0] = $HexNumber
  ;  $oMyRet[1] = StringStripWS($oMyError.description,3)
   ; ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
   ; SetError(1)
   ; Return
;EndFunc

Note: just changed so that it actually runs; not to meet my standards.

Just some analysis of the code; upon logging in it seems the code waits for commands in PM:

"connect" makes the bot respond with "Welcome".

"shutdown" makes the bot respond with a list of shutdown commands.

"shutdownN" chooses a shutdown option where N is a flag.

Bear in mind the first point I listed above about the OP's code, run at your own risk.

Edit: changed text for accuracy

Edit: grammar

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

how do that when they log id, to go online?

I can't understand what you just said.

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...