Home Page
+ Reply to Thread
Results 1 to 3 of 3

Thread: [C/C++]Generic Auto Updater

  1. #1

    Computers [C/C++]Generic Auto Updater

    I was working on this last night and today and figured i would release it, purhaps someone could use it in one of their [COLOR=red ! important][COLOR=red ! important]applications[/COLOR][/COLOR] to auto update.

    You will notice that i download the demo file as TESTexe, then rename it once on the [COLOR=red ! important][COLOR=red ! important]pc[/COLOR][/COLOR] to TEST.exe. No this isnt because i dont think logical, its because if you direct download an [COLOR=red ! important][COLOR=red ! important]exe [COLOR=red ! important]file[/COLOR][/COLOR][/COLOR] some (nod32 and avast to name a few) antivirus systems detect it as a [COLOR=red ! important][COLOR=red ! important]virus[/COLOR][/COLOR] downloader through Heuristics scanning.

    Code:
    #include <stdio.h> // Header file with the C standard input and output functions
    #include <urlmon.h> // Header file with URLDownloadToFile function
    
    #pragma comment(lib, "urlmon.lib") // This library includes the URLDownloadToFile function
    
    void main() // Our main function, cant run without this ;)
    {    
        char remVer[4]; // Variable to store remote version number
        char myVer[4] = "1.0"; // Set local version number
    
        printf("Checking for newer versions...\n");
    
        // Ver.ini should have one line with the newest version (ie, 1.0)
        URLDownloadToFile(NULL, "http://www.console-world.org/Updates/Ver.ini", "Ver.ini", 0, 0);
    
        FILE *filePtr; // Create a file pointer
        
        filePtr = fopen("Ver.ini","r"); // Open Ver.ini from same dir as our program
    
        if(filePtr != NULL) // If the INI exists
        {
            fgets(remVer, 4, filePtr); // Read the INI data into our variable array
            printf("Remote Version: %s\n", remVer); // Display remote version info
            printf("Current Version: %s\n", myVer); // Display local version info
            fclose(filePtr); // Close the file stream
        }
        else // If the INI doesnt exist
            printf("\nCannot locate Ver.ini");
             
           if (strcmp(myVer, remVer) == 0) // If the local version is the same as the remote version
        {
            printf("\nYou already have the newest version\n");
            remove("Ver.ini"); // Delete Ver.ini, we no longer need its services :)
           }
        else // If the local version is NOT the same as the remote version
        {
            printf("\nYou are running an OLD version, Updating...\n");
            remove("Ver.ini"); // Delete Ver.ini, we no longer need its services :)
            
            /* Here we must not direct download an EXE file or antivirus Heuristics detect as virus
            URLDownloadToFile(NULL, "http://www.console-world.org/Updates/TESTexe", "TESTexe", 0, 0);
            URLDownloadToFile(NULL, "http://www.console-world.org/Updates/TESTdll", "TESTdll", 0, 0);
            
            rename("TESTexe", "TEST.exe");
            rename("TESTdll", "TEST.dll"); 
            */
           }
        
        printf("\nPress ENTER to continue"); // Tell the user how to exit
        fflush(stdin); // Flush the standard input
        getchar(); // Wait for user to press a key
    }
    [BANANA]Source: http://www.psp-hacks.com/forums/about79699.html[/BANANA]


  2. #2
    Old skool zomgodder tel0s is a name known to all tel0s is a name known to all tel0s is a name known to all tel0s is a name known to all tel0s is a name known to all tel0s is a name known to all
    Join Date
    Oct 2006
    Posts
    686
    not bad... I may add this little baby to my Botnet functionalities ;)

    They already have an update system, that uses the channel topic in IRC, but this would further prevent people stealing bots =)

    +rep for being one of the only people i know to *properly* comment their code. most people CBA ;)

  3. #3
    I thought that it will not working but when i run it in my PC its working and i really very happy.
    Your work is really appreciative.

    Keep it up man!

    1 x Thanks!
    (list)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)