container
E...R#@.-..Q..t...*..P.Di..e...jP.. 8...HTTP/1.1 200 OK Date: Thu, 23 Jun 2011 13:33:15 GMT Server: Apache Last-Modified: Thu, 23 Jun 2011 13:27:34 GMT Accept-Ranges: bytes Content-Length: 122 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <head> <title></title> </head> <body> </body> </html>
Table of Contents
introduction
The container project describes a set of content-free, protocol-driven code objects which are embedded Russian-doll-style within themselves. For example, an empty PDF is embedded as raw text within the PDF format. Coded objects become self-contained; the process can be repeated to extremes (ping_in_ping recursively embeds a ping packet within a ping packet until we reach the arbitrary size limit for such packets). The code for each object (commandline, Python or C code) is self-consciously literal, describing the process as algorithm without shortcuts. The container project embraces the use of the quine with any compiler considered as an embedding device. Future container examples will extend to include film-in-film and pornography-in-pornography.
The container project raises the question of where any protocol boundaries for embeddings can be established.
examples
mpeg in mpeg
A laborious procedure to create a suitable empty file (all 0s) which will create a large enough compressed file which when re-encoded will constitute one single video frame (pictured above).
encoding
dd if=/dev/zero of=empty bs=8 count=19669500 mencoder empty -ofps 25 -noaspect -demuxer rawvideo -rawvideo fps=25:w=300:h=240:format=i420 -ovc lavc -lavcopts vcodec=mpeg4 -ffourcc divx -o out mplayer -rawvideo w=300:h=240 -demuxer rawvideo out -vo jpeg // as mencoder can't deal with it mencoder "mf://*.jpg" -mf w=300:h=240:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o container.avi
ping in ping
ping in ping places a ping or ICMP [Internet Control Message Protocol] echo request packet inside another such packet inside another such packet; a Russian-doll style exercise in packeteering. A limit to this packaging and re-packaging of Internet packets is dictated by the maximum IP [Internet Protocol] packet size, which is 65,535 bytes.
code
from scapy.all import * pp=IP(dst="192.168.1.1")/ICMP() lenny=0 while(lenny<64000): # what is maximum size? 65,536 bytes p=IP(dst="192.168.1.1")/ICMP()/str(pp) pp=IP(dst="192.168.1.1")/ICMP()/str(p) lenny=len(str(pp)) print(lenny) sr1(pp)
wireshark screenshot
deconstruction of wireshark packet in scapy
wav in wav
http://soundcloud.com/martin\_howse/wavinwav-wav
A wav file (starting out with no data) is read in as raw data and then saved as a wav file in turn to be read in as a wav file… (russian doll style, wav in wav). This process is repeated 1000 times. The resulting… wav is slowed down 100% in audacity.
code:
#include <stdlib.h> #include <stdio.h> #include <sndfile.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #define BUFFER_LEN 1 int main (void){ int x, fil, infile, readcount=0; unsigned char data[BUFFER_LEN+1]; unsigned char indy[8]; unsigned char outdy[8]; short sample; SNDFILE *outfile; SF_INFO sfinfo ; memset (&sfinfo, 0, sizeof (sfinfo)) ; sfinfo.samplerate = 44100; sfinfo.channels = 1; sfinfo.format = (SF_FORMAT_WAV | SF_FORMAT_PCM_U8); sfinfo.frames = 1; fil=0; //the seed sprintf(outdy,"%d.wav",fil); if (! (outfile = sf_open (outdy, SFM_WRITE, &sfinfo))) { printf ("Not able to open output file %s.\n", "output.wav"); sf_perror (NULL) ; return 1 ; } ; sf_write_short(outfile, data, 1); sf_close(outfile); sfinfo.frames = 45; for (x=0;x<1000;x++){ // open (empty seed) wav file as 8 bit data sprintf(indy,"%d.wav",fil); fil=fil^1; sprintf(outdy,"%d.wav",fil); infile=open(indy, O_RDONLY); if (! (outfile = sf_open (outdy, SFM_WRITE, &sfinfo))) { printf ("Not able to open output file %s.\n", "output.wav"); sf_perror (NULL) ; return 1 ; } // save data as wav file while((read(infile, data, BUFFER_LEN)) !=0) { readcount++; // printf("%c",data[0]); sample=data[0]<<8; sf_write_short(outfile, &sample, 1); } printf("%d\n",x); close(infile); sf_close(outfile); sfinfo.frames += readcount; } return 0; }
pdf in pdf
An empty file was created, converted to postscript format and then to pdf and subsequently re-embedded repeating the same process.
encoding
touch blank e2ps -nh blank > blank.ps ps2pdf blank.ps e2ps -nh blank.pdf pdfinpdf.ps ps2pdf pdfinpdf.ps
jpeg in jpeg
Created using GNU Octave. The resulting JPEG above is one pixel wide.
code:
empty=zeros(480,640); imwrite(empty, "empty.jpg"); empty=fopen("empty.jpg", "r"); al=fread(empty) imwrite(al, "jpeginjpeg.jpg")
Date: 2011-06-30 00:40:46 BST
HTML generated by org-mode 6.31trans in emacs 23