voila, c'est un UDF qui permet de créer des fichier au3 potentiellement obfusqué et de les lire en parallèle du script principale (contrôle possible à partir de l'environnement)
c'est un peut du multi-tâche en soit
► Afficher le texteproc.au3
Code : Tout sélectionner
Func NewProc($admin = 0, $src = 0, $filename = -1)
Local $Proc[4]
If $filename = -1 Then $filename = @TempDir & "\" & Hex(Random(1000000, 9999999)) & ".au3"
If $admin = 1 Then $Proc[0] &= "#RequireAdmin" & @CRLF
If $src Then
$Proc[1] = 1
Else
$Proc[1] = 0
EndIf
$Proc[2] = $filename
$Proc[3] = -1
Return $Proc
EndFunc ;==>NewProc
Func ProcAddline(ByRef $Proc, $line)
$Proc[0] &= $line & @CRLF
EndFunc ;==>ProcAddline
Func ProcSave($Proc)
FileDelete($Proc[2])
FileWrite($Proc[2], $Proc[0])
If $Proc[1] Then
If Not FileExists(@TempDir & "\obfuscator.exe") Then Obfuscator_exe(@TempDir & "\obfuscator.exe")
ShellExecuteWait(@TempDir & "\obfuscator.exe", $Proc[2], Default, Default, @SW_HIDE)
FileDelete($Proc[2])
FileCopy(StringTrimRight($Proc[2], 4) & "_obfuscated.au3", $Proc[2])
EndIf
EndFunc ;==>ProcSave
Func ProcExecute(ByRef $Proc)
if not @Compiled Then
If Not FileExists(@TempDir & "\autoit3.exe") Then AutoIt_exe(@TempDir & "\autoit3.exe")
$Proc[3] = Run(@TempDir & "\autoit3.exe " & $Proc[2])
Else
$Proc[3] = Run(@ScriptFullPath & " /AutoIt3ExecuteScript " & $Proc[2])
EndIf
While Not ProcessExists($Proc[3])
WEnd
EndFunc ;==>ProcExecute
Func ProcSaveAndExecute(ByRef $Proc)
ProcSave($Proc)
ProcExecute($Proc)
EndFunc ;==>ProcSaveAndExecute
Func ProcAddInclude(ByRef $Proc, $include)
$inc = @TempDir & "\" & Hex(Random(1000000, 9999999)) & ".au3"
FileCopy($include, $inc)
$Proc[0] = '#include "' & $inc & '"' & @CRLF & $Proc[0]
EndFunc ;==>ProcAddInclude
func ProcCompileInclude($path,$name)
filedelete(@scriptdir&"\Proc_"&$name&".au3")
filewrite(@scriptdir&"\Proc_"&$name&".au3","func proc_"& $name & "(byref $proc)" & @crlf & "ProcAddLine($proc, '" & stringreplace(stringreplace(FileRead($path&$name&".au3"),"'","''"),@crlf,"')"&@crlf&"ProcAddLine($proc,' ") & "')"&@crlf&"endfunc")
MsgBox(0,"fini!","ajoutez #include ""Proc_"&$name&".au3"""&@crlf&" à votre script puis appelez la fonction proc_"& $name & "($proc) pour ajouter l'include au proc voulu")
EndFunc
Func ProcDebug($Proc)
ConsoleWrite(@CRLF & "chemin du fichier temporaire: " & $Proc[2])
ConsoleWrite(@CRLF & "obfuscation: " & $Proc[1])
ConsoleWrite(@CRLF & "contenu: " & $Proc[0])
ConsoleWrite(@CRLF & "pid: " & $Proc[3] & @CRLF)
EndFunc ;==>ProcDebug
Func ProcClear($Proc)
FileDelete(StringTrimRight($Proc[2], 4) & "_obfuscated.au3")
FileDelete($Proc[2])
FileDelete($Proc[2] & ".tbl")
ProcStop($Proc)
$Proc[2] = ""
$Proc[1] = ""
$Proc[0] = ""
$Proc[3] = -1
EndFunc ;==>ProcClear
Func ProcStop($Proc)
If $Proc[3] <> -1 And ProcessExists($Proc[3]) Then ProcessClose($Proc[3])
$Proc[3] = -1
EndFunc ;==>ProcStop
Func ProcExists($Proc)
$Proc[3] = ProcessExists($Proc[3])
If $Proc[3] = 0 Then $Proc[3] = -1
Return ProcessExists($Proc[3])
EndFunc ;==>ProcExists
Func ProcGetTxt($Proc)
Return $Proc[0]
EndFunc ;==>ProcGetTxt
Func ProcGetFile($Proc)
Return $Proc[2]
EndFunc ;==>ProcGetFile
Func ProcGetobfuscated($Proc)
Return $Proc[1]
EndFunc ;==>ProcGetobfuscated
et voila un exemple:
Code : Tout sélectionner
$hello = NewProc()
$hello2 = NewProc()
$hello3 = NewProc()
ProcAddline($hello, 'msgbox(0,"helloWorld","hello")')
ProcAddline($hello2, 'msgbox(0,"helloWorld2","hello")')
ProcAddline($hello3, 'msgbox(0,"helloWorld3","hello")')
ProcSave($hello)
ProcSave($hello2)
ProcSave($hello3)
ProcExecute($hello)
ProcExecute($hello2)
ProcExecute($hello3)
While ProcExists($hello) Or ProcExists($hello2) Or ProcExists($hello3)
Sleep(100)
WEnd
ProcClear($hello)
ProcClear($hello2)
ProcClear($hello3)
il manque deux fonctions, elle sont dans le zip joint (c'est juste la restauration de autoit3.exe et de obfuscator.exe avec l'UDF de tlem)
ce truc n'est pas fait pour être réactif hein ? on est clair là dessus ? c'est plus réactif que 15 scripts compilé (et moins lourd) mais bien moins qu'un vrai multi-tâche