Java program to validate an unencrypted credit card track data

The current version of the Point of Sale (PoS) system does not require cardholder data to be encrypted when they are saved in non-persistent memory (e.g. RAM). This design flaw, unfortunately, allows attackers to install malware on a PoS system to steal the credit card information of cardholders. In 2005, “Target Corp. was hit by an extensive theft of its customers’ credit-card and debit-card data over the busy Black Friday weekend.

In this assignment, you are asked to implement a Java program to validate if a Point of Sale (PoS) system has unencrypted credit card track I data in memory. A sample memory data of a PoS system is provided on the course webpage, called memorydump.dmp. Although the memory data can be obtained via existing memory dump tools, this sample file is hand-made. A sample output of your program may look like:

There is 1 track I record in the memory data

<Information of the 1st record >

Cardholder’s Name: Binhai Zhu

Card Number: 4128 1234 1234 1234

Expiration Date: 09/2015

CVC Number: 101



****************************************************************************************************************************

memorydump.dmp


%B1234123412341234^Cardsfd43654356235454631254656435135464543654361254656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340ohn^235454631123%B4128123412341234^Binhai/Zhu^150910100000019301000000877000000?;4128123412341234=000?;1234123412341fdwei000dfg00?;12341%B123412341234235454631254656435135464543513546546;1234123412^341246101193010877?00000?;1234123412340000?;123412341dfggadsfi;1234123412341234=1405101193010877?00000?;1234123412340dfg;1234123412341fdwei1405101235649855189454556435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340000?;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^2354546311234123ohn^235454631254656435135464543513546546;1234123412341234=1405101193010877?00000?;123412341234000451234123412341fdwei14051012354546312546^11193010877?00000?;1234123412340000?;1234123412341fdwei;1234123412341354645434656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123414635000dfg;1234123412341fdweif^123545466;123412341231509104123ohn^235454631254656435135464543513546546;1234123412341234=1405101193010877?

%B41281234123Yang9301000000877000000?;4128123412341293010877?%B4128123412341234^Binhai/0000877000000?;4128123412341234=1509101193010877?000?;1234123412341fdwei000dfg00?;12341%B123412341234235454631254656435135464543513546546;1234123412^341246101193010877?00000?;1234123412340000?;123412341dfggadsfi;1234123412341234=1405101193010877?00000?;1234123412340dfg;1234123412341fdwei1405101235649855189454556435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340000?;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^2354546311234123ohn^235454631254656435135464543513546546;1234123412341234=1405101193010877?00000?;123412341234000451234123412341fdwei14051012354546312546^11193010877?00000?;1234123412340000?;1234123412341fdwei;1234123412341354645434656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123414635000dfg;1234123412341fdweif^123545466;1234123412346;1234123412^341246101193010877?00000?;1234123412340000?;123412341dfggadsfi;1234123412341234=1405101193010877?00000?;1234123412340dfg;1234123412341fdwei1405101235649855189454556435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340000?;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^23534=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^2354546311234123ohn^235454631254656435135464543513546546;1234123412341234=1405101193010877?00000?;123412341234000451234123412341fdwei14051012354546312546^11193010877?00000?;1234123412340000?;1234123412341fdwei;1234123412341354645434656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123414635000dfg;1234123412341fdweif^123545466;1234123455189454556435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340000?;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^23534=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^2354546311234123ohn^235454631254656435135464543513546546;1234123412341234=1405101193010877?00000?;123412341234000451234123412341fdwei14051012354546312546^11193010877?00000?;1234123412340000?;1234123412341fdwei;1234123412341354645434656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123414635000dfg;1234123412341fdweif^123545466;1234123412346;1234123412^341246101193010877?00000?;1234123412340000?;123412341dfggadsfi;1234123412341234=1405101193010877?00000?;1234123412340dfg;1234123412341fdwei1454546312546^11193010877?00000?;1234123412340000?;1234123412%B4128123412341235^Paxton/John^181213100000019301000000877000000?;4128123412341234=1509101193010877?341fdwei;1234123412341354645434656435135464543513546546;1234123412341234=1405101193010877?00000?;1234123414635000dfg;1234123412341fdweif^123545466;1234123455189454556435135464543513546546;1234123412341234=1405101193010877?00000?;1234123412340000?;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;12341234365hn^23534=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;123412sfddi000000000000?;1234^234=1405101193010877?00000?;123412341234000dfg12^3412341234sfdeif^123545466;1234123