Hide a file behind an image using Windows CMD



We have done this demo on Windows 10.

Step 1. For this demo, we have an image named 'apple.png'.

Step 2. A folder named 'secrets' that has two files 'secret1.txt' and 'secret2.txt'. The text files again have the filenames stored in them.

Step 3. Zip the 'secrets' folder or the file you want to hide. By converting the file we want to hide into an archive, we will later be able to extract it again from where we hide it.

The CMD command we are going to use is "Copy".

C:\Users\Ashish Jain>Copy /?
Copies one or more files to another location.

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B]
     [+ source [/A | /B] [+ ...]] [destination [/A | /B]]

  source       Specifies the file or files to be copied.
  /A           Indicates an ASCII text file.
  /B           Indicates a binary file.
  /D           Allow the destination file to be created decrypted
  destination  Specifies the directory and/or filename for the new file(s).
  /V           Verifies that new files are written correctly.
  /N           Uses short filename, if available, when copying a file with a
               non-8dot3 name.
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.
  /L           If the source is a symbolic link, copy the link to the target
               instead of the actual file the source link points to.

The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line.  Default is to prompt on overwrites unless COPY command is being executed from within a batch script.

To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format). 

Step 4. C:\Users\Ashish Jain\OneDrive\Desktop>dir
 Directory of C:\...\Desktop

01/01/2020  11:05 PM             2,180 apple.png
01/01/2020  11:06 PM    [DIR]          secrets
01/01/2020  11:06 PM               264 secrets.zip 

Step 5. C:\...\Desktop>Copy /b apple.png + secrets.zip mango.png
apple.png
secrets.zip
        1 file(s) copied. 

C:\...\Desktop>dir
 Directory of C:\...\Desktop

01/01/2020  11:05 PM             2,180 apple.png
01/01/2020  11:25 PM             2,444 mango.png
01/01/2020  11:06 PM    [DIR]          secrets
01/01/2020  11:06 PM               264 secrets.zip 

Step 6. Before we extract the 'secrets', we have to delete original files, viz, 'secrets' folder and 'secrets.zip'.

C:\...\Desktop>unzip mango.png 
Archive:  mango.png
warning [mango.png]:  2180 extra bytes at beginning or within zipfile
  (attempting to process anyway)
 extracting: secrets/secret1.txt
 extracting: secrets/secret2.txt 

C:\...\Desktop>dir
 Directory of C:\...\Desktop

01/01/2020  11:25 PM             2,444 mango.png
01/01/2020  11:29 PM    [DIR]          secrets 

No comments:

Post a Comment