Finance-Bank-Wachovia

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
name:         Finance-Bank-Wachovia
version:      0.5
version_from: lib/Finance/Bank/Wachovia.pm
installdirs:  site
requires:
    Crypt::CBC:                    0
    Crypt::DES_PP:                 0
    HTTP::Cookies:                 0
    Test::More:                    0
    WWW::Mechanize:                0

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

Makefile.PL  view on Meta::CPAN

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Finance::Bank::Wachovia',
    EXE_FILES		 => [ 'scripts/wachovia.pl', 'scripts/wachovia_summary.pl' ],
    VERSION_FROM      => 'lib/Finance/Bank/Wachovia.pm', # finds $VERSION
    PREREQ_PM         => { 
    		'WWW::Mechanize' => 0, 
    		'HTTP::Cookies' => 0, 
    		'Test::More' => 0 ,
    		'Crypt::CBC' => 0,	
    		'Crypt::DES_PP' => 0,
    	}, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (ABSTRACT_FROM  => 'lib/Finance/Bank/Wachovia.pm', # retrieve abstract from module
       AUTHOR         => 'Jim <jg.perl@thegarvin.com>') : ()),
);

scripts/wachovia.pl  view on Meta::CPAN

	
$opts->{password} = $password if( $password = $opts->{password}
	|| $opts->{pass}
	|| $opts->{pw}
	);


if( $opts->{key} ){
	# indicates we are storing/retrieving data from keyfile
	eval {
		require Crypt::CBC;
		import Crypt::CBC;
	};
	if($@){ die "Must have Crypt::CBC and Crypt::DES_PP module installed to use --key feature: $@\n" }

	# if here, then user provided key + some info, so we want to preserve whatever it is they provided
	# while keeping whatever it is they didn't provide.
	my $new_opts = {};
	my $file_opts = get_account_info( $opts->{keyfile}, $opts->{key} );
	for(keys %$opts){ $new_opts->{$_} = $opts->{$_} }
	for(keys %$file_opts){ $new_opts->{$_} = $file_opts->{$_} unless $new_opts->{$_} }
	$opts = $new_opts;
	save_account_info( $opts );
}

scripts/wachovia.pl  view on Meta::CPAN

} 

 
#==============================================================================  
# Fills the options hash with account info from the local .wachovia file
sub get_account_info {
	my($keyfile, $key) = @_;
	my $opts;
	return unless -e $keyfile;
	open( F, $keyfile ) or die "Can't open ".$keyfile." for reading: $!";
	my $cipher = Crypt::CBC->new({
		'key'=> $key,
		'cipher'=> 'DES_PP',
		'iv'=> '%_j,!z"{'
	});
	my $plaintext = $cipher->decrypt( <F> );
	my @opts = split( /\//, $plaintext );
	for( @opts ){
		my($k, $v) = split(/=>/);
		$opts->{$k} = $v;	
	}
	return $opts;
}

# Writes an MD5 hash for the hash info.
sub save_account_info {
	my $opts = shift;
	open( F, '>', $opts->{keyfile} ) or die "Can't open ".$opts->{keyfile}." for writing: $!";
	my $cipher = Crypt::CBC->new({
		'key'=> $opts->{key},
		'cipher'=> 'DES_PP',
		'iv'=> '%_j,!z"{'
	});
	my $ciphertext = $cipher->encrypt( join('/', (map { "$_=>".$opts->{$_} } keys %$opts) ) );
	print F $ciphertext;
	close( F );
	return 1;
}

scripts/wachovia_summary.pl  view on Meta::CPAN

	|| $opts->{name}
	);
	
$opts->{password} = $password if( $password = $opts->{password}
	|| $opts->{pass}
	|| $opts->{pw}
	);

if( $opts->{key} ){
	eval {
		require Crypt::CBC;
		import Crypt::CBC;
	};
	if($@){ die "Must have Crypt::CBC and Crypt::DES_PP module installed to use --key feature: $@\n" }

	# if here, then user provided key + some info, so we want to preserve whatever it is they provided
	# while keeping whatever it is they didn't provide.
	my $new_opts = {};
	my $file_opts = get_account_info( $opts->{keyfile}, $opts->{key} );
	for(keys %$opts){ $new_opts->{$_} = $opts->{$_} }
	for(keys %$file_opts){ $new_opts->{$_} = $file_opts->{$_} unless $new_opts->{$_} }
	$opts = $new_opts;
	save_account_info( $opts );
}

scripts/wachovia_summary.pl  view on Meta::CPAN




#==============================================================================  
# Fills the options hash with account info from the local .wachovia file
sub get_account_info {
	my($keyfile, $key) = @_;
	my $opts;
	return unless -e $keyfile;
	open( F, $keyfile ) or die "Can't open ".$keyfile." for reading: $!";
	my $cipher = Crypt::CBC->new({
		'key'=> $key,
		'cipher'=> 'DES_PP',
		'iv'=> '%_j,!z"{'
	});
	my $plaintext = $cipher->decrypt( <F> );
	my @opts = split( /\//, $plaintext );
	for( @opts ){
		my($k, $v) = split(/=>/);
		$opts->{$k} = $v;	
	}
	return $opts;
}

# Writes an MD5 hash for the hash info.
sub save_account_info {
	my $opts = shift;
	open( F, '>', $opts->{keyfile} ) or die "Can't open ".$opts->{keyfile}." for writing: $!";
	my $cipher = Crypt::CBC->new({
		'key'=> $opts->{key},
		'cipher'=> 'DES_PP',
		'iv'=> '%_j,!z"{'
	});
	my $ciphertext = $cipher->encrypt( join('/', (map { "$_=>".$opts->{$_} } keys %$opts) ) );
	print F $ciphertext;
	close( F );
	return 1;
}



( run in 0.693 second using v1.01-cache-2.11-cpan-e1769b4cff6 )