Fandom

Beebhack

Iplayerdexor

31pages on
this wiki
Add New Page
Talk1 Share

A simple (very crude) c++ command-line program to deXOR iplayer files.

Save the following code (in a plain-text file) as iplayerdexor.cpp and then compile (on any *nix) with:

g++ iplayerdexor.cpp -o iplayerdexor

googlecode home

iplayerdexor.cpp

// iplayerdexor.cpp
// Free Software (both types) - Do with it what you will...
// iplayerdexor: Simple (crude) command-line program to clean XORd iplayer files
// Compile with: g++ iplayerdexor.cpp -o iplayerdexor
// ...then, if you wish, move it to some suitable place (such as /usr/local/bin/)
// This program comes with ABSOLUTELY NO WARRANTY, not even a /little bit/!

#include <iostream>
#include <fstream>

using namespace std;

int main (int argc, char * const argv[])
{
	ifstream::pos_type fileSize;
	char * fileDump;

	int xord[2] = {0x3c, 0x53};	// Alternating xor pattern
	int xorFlip = 0;	// Start on 0 or 1 to change the order of the xor pattern
	int xorStart = 0x2800; // From beginning of file
	int xorEnd = 0x400;	// From end of file

	if (argc == 2)
	{
		cout << "Checking if file \"" << argv[1] << "\" exists: ";
		ifstream inputFile(argv[1], ios::in|ios::binary|ios::ate);
		if (inputFile.is_open())
		{
			cout << "Done" << endl;
			cout << "Loading file into memory: ";
			fileSize = inputFile.tellg();
			fileDump = new char [fileSize];
			inputFile.seekg (0, ios::beg);
			inputFile.read (fileDump, fileSize);
			inputFile.close();
			cout << "Done" << endl;
			
			cout << "Xoring file: ";
			xorEnd = (int) fileSize - xorEnd;
			int xorPointer = xorStart;
			while (xorPointer < xorEnd)
			{
				fileDump[xorPointer] = fileDump[xorPointer] ^ xord[xorFlip];
				xorFlip = xorFlip ^ 1;
				xorPointer++;
			}
			cout << "Done" << endl;
			
			cout << "Writing clean file: ";
			ofstream outputFile;
			outputFile.open("clean.mov", ios::binary);
			outputFile.write(fileDump, fileSize);
			outputFile.close();
			cout << "Done" << endl;
			
			delete[] fileDump;
		}
		else{cout << "Fail" << endl;}
	}
	else {cout << "Usage: iplayerdexor iplayer_file_to_be_cleaned.mov" << endl;}

    return 0;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.