-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d075ff
commit 9899705
Showing
7 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Magstripe Reader Tested: HID 3110-6445 Magstripe Pass-Through Reader | ||
* set to rotary position B (Raw Data - All Bits Wiegand) | ||
|
||
RFID-Tool Specific Settings | ||
* set buffer size to 256 bits or greater | ||
|
||
See [aba-decode.php](aba-decode.php) script for converting binary card data to ascii (Script by: AndrewMohawk) | ||
* Command Line: /usr/bin/php aba-decode.php 1101000001100000100011001001001010101101111000001010011101101111100010 | ||
* Web: https://www.LegacySecurityGroup.com/aba-decode.php?binary=1101000001100000100011001001001010101101111000001010011101101111100010 | ||
|
||
Binary: | ||
5 bits | ||
Little Endian Format | ||
|
||
LRC(Longitudinal Redundancy Check): | ||
Count # of set bits(1's) in column | ||
EVEN = 0 | ||
ODD = 1 | ||
|
||
Track 2 Debit/Credit Card Format(for example): | ||
;1234567890123456=YYMMSSSDDDDDDDDDDDDDD?* | ||
; = Start Sentinel | ||
1234567890123456 = 16 Digit Card # | ||
= = End Card # | ||
YY = Expiration Year | ||
MM = Expiration Month | ||
SSS = Service Code (As Understood From Wikipedia: "201" means chip required, "101" means no chip, be sure to recalculate the LRC if changing, it is not advised to experimental here without knowing the laws involved) | ||
DDDDDDDDDDDDDD = Discretionary Data | ||
? = End Sentinel | ||
*=LRC | ||
|
||
Binary Reference: | ||
11010 ; - Start Sentinel | ||
00001 0 | ||
10000 1 | ||
01000 2 | ||
11001 3 | ||
00100 4 | ||
10101 5 | ||
01101 6 | ||
11100 7 | ||
00010 8 | ||
10011 9 | ||
00111 < | ||
01110 > | ||
01011 : | ||
10110 = - End Card Number | ||
11111 ? - End Sentinel | ||
00010 LRC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
header("Content-type: text/plain"); | ||
|
||
echo "Original script by: AndrewMohawk\n"; | ||
// [email protected] | ||
echo "http://www.andrewmohawk.com\n\n"; | ||
|
||
echo "Modified slightly by: Corey Harding\n"; | ||
echo "www.LegacySecurityGroup.com / www.Exploit.Agency\n\n"; | ||
|
||
//USAGE: | ||
//Command Line: /usr/bin/php aba-decode.php 1101000001100000100011001001001010101101111000001010011101101111100010 | ||
//Web: www.server.com/aba-decode.php?binary=1101000001100000100011001001001010101101111000001010011101101111100010 | ||
|
||
/* Decode Track 2 data from binary */ | ||
if (defined('STDIN')) { | ||
$binary = $argv[1]; | ||
} else { | ||
$binary = $_GET['binary']; | ||
} | ||
|
||
// this function by mtroy dot student at gmail dot com taken from http://php.net/manual/en/function.strpos.php | ||
function strpos_r($haystack, $needle) | ||
{ | ||
if(strlen($needle) > strlen($haystack)) | ||
trigger_error(sprintf("%s: length of argument 2 must be <= argument 1", __FUNCTION__), E_USER_WARNING); | ||
|
||
$seeks = array(); | ||
while($seek = strrpos($haystack, $needle)) | ||
{ | ||
array_push($seeks, $seek); | ||
$haystack = substr($haystack, 0, $seek); | ||
} | ||
return $seeks; | ||
} | ||
|
||
function processBinary($binary) | ||
{ | ||
$AsciiOutput = ""; | ||
|
||
//find start sentinel | ||
$start_sentinel = strpos($binary,"11010"); | ||
if($start_sentinel === false) | ||
{ | ||
echo "Could not find start sentinel\n"; | ||
return false; | ||
} | ||
|
||
//find end sentinel | ||
$end_sentinel = false; | ||
$end_sentinel = strrpos($binary,"11111"); | ||
if(count($end_sentinel) == 0) | ||
{ | ||
echo "Could not find end sentinel\n"; | ||
return false; | ||
} | ||
|
||
//Lets decode the data: | ||
$bit_length = 5; // 4 bits for data, 1 bit for odd-parity or LRC checking | ||
|
||
|
||
$data = substr($binary,$start_sentinel,($end_sentinel-$start_sentinel+5)); | ||
|
||
$currentBits = ""; | ||
$currentNum = 0; | ||
$finalString = ""; | ||
|
||
for($i=0;$i<strlen($data);$i++) | ||
{ | ||
if(strlen($currentBits) < $bit_length) | ||
{ | ||
$currentBits .= $data[$i]; | ||
|
||
} | ||
|
||
if(strlen($currentBits) == $bit_length) | ||
{ | ||
$parityBit = $currentBits[4]; | ||
$dataBits = substr($currentBits,0,4); | ||
|
||
$asciiChar = 0; | ||
|
||
|
||
for($x=0;$x<4;$x++) | ||
{ | ||
$currentNum += $dataBits[$x]; | ||
} | ||
|
||
|
||
|
||
$dec = bindec($dataBits); | ||
$dec = str_pad($dec, 2, "0", STR_PAD_LEFT); // just so output is nice | ||
$asciiChar = chr(bindec(strrev($dataBits))+48); // reverse the binary (since its LSB first) then convert to dec, add 48 and then take it to ASCII | ||
echo "$currentBits - Data ($dataBits) Parity($parityBit) Decimal ($dec) Ascii($asciiChar)"; | ||
if(($currentNum + $parityBit) % 2 == false) | ||
{ | ||
echo " __ Parity: Invalid"; | ||
} | ||
else | ||
{ | ||
echo " __ Parity: Valid"; | ||
} | ||
$AsciiOutput .= $asciiChar; | ||
echo "\n"; | ||
$currentBits = ""; | ||
$currentNum = 0; | ||
|
||
} | ||
|
||
|
||
} | ||
echo "\n\nTotal Out (ascii): $AsciiOutput\n"; | ||
} | ||
echo "Trying One way:\n\n"; | ||
if (processBinary($binary) == false) | ||
{ | ||
//reverse. | ||
echo "\n\n"; | ||
echo "Trying The Reverse:\n\n"; | ||
processBinary(strrev($binary)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
String version = "1.0.4"; | ||
String version = "1.0.4a"; |