Basic Image stegnographer v 0.1
Results 1 to 3 of 3

Thread: Basic Image stegnographer v 0.1

  1. #1
    Banned shakuni's Avatar
    Join Date
    Aug 2007
    Posts
    24

    Basic Image stegnographer v 0.1

    Basic Image stegnographer v 0.1

    The following source and explanation is a bit oversimplified. But I am still learning about steganography.

    A bitmap contains a header section(first 54 bytes) and image data. The header stores various information about the image's attributes, so we'll not mess with it. The remaining bytes contains the image data. So we can start hiding our message from 55th byte (it is done at the 100th byte in the source.)

    Subsequent versions of Basic Image stegnographer will be GUI, with support of more file formats and steganalysis(determining the presence of hidden info in the image, and if present, retreive it).

    Usage- just compile and run!
    Code:
    /*
    Basic Image stegnographer v 0.1
    basImStego.c
    
    Inserts and retrives a small string from a 24-bit bitmap image
    
    coded by - shakuni
    */
    
    #include <stdio.h>
    
    void showStartingNote();
    int showMenu();
    int encodeMsg();
    int decodeMsg();
    void showEndingNote();
    
    int menuChoice=0;
    char imgFileName[50];
    char msgToencode[100];
    char decodedMsg[100];
    int status=0;
    
    int main(void)
    {
        showStartingNote();
        while(1)
        {
        menuChoice=showMenu();
        
        switch (menuChoice)
        {
        case 1:
             status=encodeMsg();
             break;
        case 2:
             status=decodeMsg();
             break;
        case 3:
             showEndingNote();
             return;
        default:
             printf("Invalid choice !\n\n");
             continue;
        }
        }
        return 0;
    }
    
    void showStartingNote()
    {
    printf("%s"," Welcome to Basic Image stegnographer v 0.1 by shakuni \n");
    printf("%s"," =====================================================\n\n");
    printf("%s","Please note that-\n");
    printf("%s","-----------------\n\n");
    printf("%s","*The current version(version 0.1) only supports\n" 
                " 24-bit bitmap images for data hiding purpose.\n\n");
                
    printf("%s","*The current version can only find information hidden\n"
                " by itself, that is, it can't steganalyse images yet.\n\n\n");   
    }
    
    int showMenu()
    {
    printf("%s","Now, what would you like to do?\n");
    printf("%s","1. Hide some message in a bitmap image.\n");
    printf("%s","2. Retrive message hidden in an bitmap image.\n");
    printf("%s","3. Leave program.\n\n");
    printf("%s","Enter your choice(Enter the choice as a number)  :");
    
    scanf("%d",&menuChoice);
    return menuChoice;
    }
    
    int encodeMsg()
    {
        FILE *fp=NULL;
        
        printf("%s","Enter the name of bitmap image  :");
        scanf("%s",&imgFileName);
        fflush(stdin);
        
        printf("%s","Enter the message to Encode into the image :");
        gets(msgToencode);
        
        fp=fopen(imgFileName,"r+");
        if(fp!=NULL)
        {
             fseek(fp,100L,SEEK_SET);
             fprintf(fp,msgToencode);
             fclose(fp);
             printf("%s","Message successfully encoded in the image.\n\n");
        }
        else
        {
             printf("Failed to open %s",imgFileName);
             return 1;
        }
    }
    
    
    int decodeMsg()
    {
        FILE *fp=NULL;
        
        printf("%s","Enter the name of bitmap image  :");
        scanf("%s",&imgFileName);
        fflush(stdin);
        
        fp=fopen(imgFileName,"r+");
        if(fp!=NULL)
        {
             fseek(fp,100L,SEEK_SET);
             fgets(decodedMsg,100,fp);
             fclose(fp);
             printf("The message encoded into the image is \n%s\n\n",decodedMsg);
        }
        else
        {
             printf("Failed to open %s",imgFileName);
             return 1;
        }
    }
    
    void showEndingNote()
    {
    printf("%s","\n\n* Thank you for using Basic Image stegnographer v 0.1 .\n");
    printf("%s","* The future versions will support all image formats.\n");
    printf("%s","* The future versions will support steganalysis functions.\n");
    printf("%s","* Next version will be GUI.\n");
    getch();
    }

  2. #2
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    I'm not at a place where I can run this, but I'm curious. How does it affect the appearance of the image? It seems like it would make a few pixels very out of whack. I did a project in college with steganography and bitmap images. We had to implement the bpcs algorithm. It was pretty tough, but fun.

  3. #3
    Banned shakuni's Avatar
    Join Date
    Aug 2007
    Posts
    24
    It seems like it would make a few pixels very out of whack.
    yes it will, actually it just overwrites them. But it won't effect the image if the string that is to be hidden is small.

Similar Threads

  1. Tutorials Forum - Index
    By Negative in forum The Security Tutorials Forum
    Replies: 99
    Last Post: March 20th, 2007, 04:42 AM
  2. The history of the Mac line of Operating systems
    By gore in forum Operating Systems
    Replies: 3
    Last Post: March 7th, 2004, 07:02 AM
  3. Protecting Yourself From Image Theft
    By GreekGoddess in forum The Security Tutorials Forum
    Replies: 19
    Last Post: August 28th, 2003, 06:07 AM
  4. VISUAL BASIC for beginners
    By blow in forum Other Tutorials Forum
    Replies: 2
    Last Post: June 24th, 2002, 06:44 AM
  5. The Worlds Longest Thread!
    By Noble Hamlet in forum AntiOnline's General Chit Chat
    Replies: 1100
    Last Post: March 17th, 2002, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides