Module: PWN::Plugins::CreditCard

Defined in:
lib/pwn/plugins/credit_card.rb

Overview

This plugin provides useful credit card capabilities

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



79
80
81
82
83
# File 'lib/pwn/plugins/credit_card.rb', line 79

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.generate(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::CreditCard.generate(

type: 'optional - card type from #list_types method to generate (defaults to :random)',
count: 'optional - number of numbers to generate (defaults to 1)'

)



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pwn/plugins/credit_card.rb', line 41

public_class_method def self.generate(opts = {})
  type = opts[:type] ||= :random
  type = type.to_s.strip.scrub.chomp.downcase.to_sym

  count = opts[:count].to_i
  count = 1 if count.zero?

  cc_result_arr = []
  (1..count).each do
    gen_type = list_types.sample if type == :random
    gen_type = type unless type == :random
    cc_hash = type(cc: CreditCardValidations::Factory.random(gen_type))
    cc_result_arr.push(cc_hash)
  end

  cc_result_arr
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/pwn/plugins/credit_card.rb', line 87

public_class_method def self.help
  puts "USAGE:
    #{self}.list_types

    #{self}.generate(
      type: 'required - card to generate from #list_types method to generate',
      count: 'optional - number of numbers to generate (defaults to 1)'
    )

    #{self}.type(
      cc: 'required - e.g. XXXX XXXX XXXX XXXX'
    )

    #{self}.authors
  "
end

.list_typesObject

Supported Method Parameters

PWN::Plugins::CreditCard.list_types



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pwn/plugins/credit_card.rb', line 13

public_class_method def self.list_types
  %i[
    amex
    unionpay
    dankort
    diners
    elo
    discover
    hipercard
    jcb
    maestro
    mastercard
    mir
    rupay
    solo
    switch
    visa
  ]
rescue StandardError => e
  raise e
end

.type(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::CreditCard.type(

cc: 'required - e.g. XXXX XXXX XXXX XXXX'

)



66
67
68
69
70
71
72
73
74
75
# File 'lib/pwn/plugins/credit_card.rb', line 66

public_class_method def self.type(opts = {})
  cc = opts[:cc].to_s.scrub.strip.chomp
  cc_hash = {}
  cc_hash[:number] = cc
  cc_hash[:type] = cc.credit_card_brand

  cc_hash
rescue StandardError => e
  raise e
end