#!/usr/local/bin/php -q

<?php

/* VARIABLES
/*
/* PASSWORD (PLAINTEXT) */
$password["plain"] = "plaintext password here. sorry no example today ;)";
/* PASSWORD (CYPHERTEXT) */
$password["cipher"] = "and the ciphertext version here from the /etc/shadow or /etc/passwd file";

$chars = Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","/",".");

$n=0;
foreach($chars as $alpha) {
	foreach($chars as $beta) {
		$slt[$n]=$alpha.$beta;
		$n++;
	};
};

$done=0;
foreach($slt as $salt){
	if($done==0) {
		$cipher=crypt($password["plain"],$salt);
		if($cipher == $password["cipher"]) {
			$done=1;
			echo "SALT: $salt\n";
		};
	};
};
echo "\n"; ?>