#!/usr/bin/perl
use IO::Socket;

# ocrshopxtr_freebie.pl - VeNoMouS <venom@gen-x.co.nz>
# This code bypasses the OCR Shop XTR vvlicense.
# I was doing some ocr related stuff at work, and I didnt like how windows was limited
# in what it could do, so I googled and came across OCR Shop XTR, it even picked up order 
# numbers that ifilter couldnt(oh yea adobe you so rule), then I went to look at the price $2,395.00,
# you can imagine how far my jaw dropped, anyway the licencse check is retarded
# it just binds vvlicense to port 10102 on 127.0.0.1 and sends a simple cmd seq.
#
# CLIENT -> S OCRC:0.
# SERVER -> SUCCESS:1.
# CLIENT -> F OCRC:0.
# SERVER -> 11111111111111111111111111111111 (bunch more look @ the hex below you lazy cunt)
# CLIENT -> O OCRC:0.
# SERVER -> SUCCESS:1.
# CLIENT -> I OCRC:1.
# SERVER -> SUCCESS:1.
#
# And from here it starts the ocr scan proccess cause it was successful from the licencse server.
# Anyway thnx to defy for giving me his perl socket engine (saved me writing one).
# Word up to str0ke. 

sub ascii_to_hex ($)
{
	(my $str = shift) =~ s/(.|\n)/sprintf("%02lx", ord $1)/eg;
	 return $str;
}

$| = 1;
my $server = IO::Socket::INET->new(
                                        LocalAddr => '127.0.0.1',
                                        LocalPort => 10102,
                                        Reuse => 1,
                                        Listen => 9
                                  ) or die "ws: $@ on server port 10102: $!\n";

warn "ws($$): (server) ready on port @{[$server->sockport]}\n";


while($SIG{CHLD} = 'IGNORE', my $c = $server->accept) {
  my $header;
  while ($header !~ /\n\n/ and sysread $c, $_, 1) 
	{
		$_ =~ s/\r//;
		$header .= $_;

		my $data=ascii_to_hex($header);

		if ($data =~ /53204f4352433a30/) 
		{
			print $c "\x53\x55\x43\x43\x45\x53\x53\x3a\x31\x00";
		}
	
		if ($data =~ /46204f4352433a3000/) 
		{
			print $c "\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x31\x30\x31\x00";
		}
	
		if ($data =~ /4f204f4352433a3000/) 
		{
			print $c "\x53\x55\x43\x43\x45\x53\x53\x3a\x31\x00";
		}

		if ($data =~ /49204f4352433a3100/) 
		{
			print $c "\x53\x55\x43\x43\x45\x53\x53\x3a\x31\x00";
		}
	}
}
$c->close;
undef($c);