Jump to content

How to create a ZIP file with altenate data streams included?


Exit
 Share

Recommended Posts

For my next project I would like to send files with "alternate data streams" by email in ZIP format.
I can not use any external program like 7-Zip or WinRAR. (They would fit😥)
Who knows how to create a ZIP file with "alternate data streams" included with the Powershell command "Compress-Archive"? 

Here a test script:  (save as "ADSTester.cmd")

@rem Try to create a zip file with alternate data streams (ADS) included

@rem Housekeeping
@cls
@del ADSTester.zip >nul:
@RD /S /Q Extracted >nul:
@del ADSTester.txt >nul:
@rem End of Housekeeping

echo This is the ADSTester.txt file >ADSTester.txt
echo This is the ADSTester.txt:Part1 file >ADSTester.txt:Part1
echo This is the ADSTester.txt:Part2 file >ADSTester.txt:Part2

dir /r ADSTester.txt
@rem See the 3 files

@rem ****************************************************************
@rem ****************************************************************
@rem Please alter the next lines to include the alternate data streams.   
powershell Compress-Archive -Path .\ADSTester.txt -Update -DestinationPath ADSTester.zip 
powershell Expand-Archive -Path ADSTester.zip -DestinationPath .\Extracted\

dir /r Extracted\ADSTester.txt
@rem Only one file left :-(

pause

 

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Not sure if the Compress-Archive method will collect the stream data and embed it in an archive, then put it back in place when the file is extracted.  You might have to do a custom script to extract the stream data and add it to the archive, then a archive extraction process to "rebuild" the streams.  

I saw an article that says the RAR file format supports NTFS ADS, but haven't looked into it.

Spoiler

Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder
Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array
Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc
Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF

 

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

×
×
  • Create New...