107 lines
2.4 KiB
JavaScript
107 lines
2.4 KiB
JavaScript
/**
|
||
* Card Generator Configuration
|
||
* 卡类型配置
|
||
*/
|
||
|
||
const CARD_TYPES = {
|
||
unionpay: {
|
||
name: '中国银联 (UnionPay)',
|
||
// 固定前缀(用户提供的成功案例都是这个前缀)
|
||
prefix: '622836754', // 固定BIN前缀
|
||
length: 16,
|
||
cvvLength: 3,
|
||
useLuhn: true,
|
||
|
||
// 成功案例的后7位模式(43个真实案例,统计分析显示接近均匀随机分布)
|
||
successfulPatterns: [
|
||
'1130577', '0744030', '9888788', '9131205', '1450744',
|
||
'7238010', '7300364', '0814288', '6042579', '6361755',
|
||
'2443235', '3564435', '8400627', '4445204', '2653734',
|
||
'9976732', '0810302', '0707201', '5237808', '4322734',
|
||
'1880148', '9130520', '7863197', '1210049', '9031561',
|
||
'2464926', '2487000', '5452860', '8491592', '5022853',
|
||
'5864858', '4742832', '0023658', '7416988', '7093159',
|
||
'9198576', '8160064', '6223252', '4873785', '1299976',
|
||
'2940032', '6998937', '5800241'
|
||
],
|
||
|
||
// 生成策略配置
|
||
generation: {
|
||
mutationRate: 0.5, // 50% 使用变异策略
|
||
randomRate: 0.5, // 50% 使用纯随机
|
||
mutationDigits: [1, 2] // 变异时改变1-2个数字
|
||
}
|
||
},
|
||
visa: {
|
||
name: 'Visa',
|
||
prefix: '4',
|
||
length: 16,
|
||
cvvLength: 3,
|
||
useLuhn: true
|
||
},
|
||
mastercard: {
|
||
name: 'MasterCard',
|
||
prefix: '5',
|
||
length: 16,
|
||
cvvLength: 3,
|
||
useLuhn: true
|
||
},
|
||
amex: {
|
||
name: 'American Express',
|
||
prefix: '34',
|
||
length: 15,
|
||
cvvLength: 4,
|
||
useLuhn: true
|
||
},
|
||
discover: {
|
||
name: 'Discover',
|
||
prefix: '6011',
|
||
length: 16,
|
||
cvvLength: 3,
|
||
useLuhn: true
|
||
}
|
||
};
|
||
|
||
/**
|
||
* 有效期配置
|
||
*/
|
||
const EXPIRY_CONFIG = {
|
||
minYear: 26, // 2026
|
||
maxYear: 30, // 2030
|
||
minMonth: 1,
|
||
maxMonth: 12
|
||
};
|
||
|
||
/**
|
||
* 输出格式配置
|
||
*/
|
||
const OUTPUT_FORMATS = {
|
||
pipe: {
|
||
name: 'Pipe分隔 (|)',
|
||
formatter: (card) => `${card.number}|${card.month}|${card.year}|${card.cvv}`
|
||
},
|
||
json: {
|
||
name: 'JSON格式',
|
||
formatter: (card) => JSON.stringify(card, null, 2)
|
||
},
|
||
csv: {
|
||
name: 'CSV格式',
|
||
formatter: (card) => `${card.number},${card.month},${card.year},${card.cvv}`
|
||
},
|
||
pretty: {
|
||
name: '美化格式',
|
||
formatter: (card) => `
|
||
Card Number: ${card.number}
|
||
Expiry Date: ${card.month}/${card.year}
|
||
CVV: ${card.cvv}
|
||
Type: ${card.type}
|
||
`.trim()
|
||
}
|
||
};
|
||
|
||
module.exports = {
|
||
CARD_TYPES,
|
||
EXPIRY_CONFIG,
|
||
OUTPUT_FORMATS
|
||
};
|