Sha256: 40bd500df589d16cf781eb694e42ff564aef257acbda1213e72ab46fd27f99b1

Contents?: true

Size: 1.95 KB

Versions: 103

Compression:

Stored size: 1.95 KB

Contents

# frozen_string_literal: true

require 'credit_card_validations'
require 'credit_card_validations/string'

module PWN
  module Plugins
    # This plugin provides useful credit card capabilities
    module CreditCard
      # Supported Method Parameters::
      # PWN::Plugins::CreditCard.generate(
      #   type: 'required - card to generate :amex|:unionpay|:dankort|:diners|:elo|:discover|:hipercard|:jcb|:maestro|:mastercard|:mir|:rupay|:solo|:switch|:visa',
      #   count: 'optional - number of numbers to generate (defaults to 1)'
      # )

      public_class_method def self.generate(opts = {})
        type = opts[:type].to_s.scrub.strip.chomp.to_sym
        count = opts[:count].to_i
        count = 1 if count.zero?

        cc_result_arr = []
        (1..count).each do
          cc_result_arr.push(CreditCardValidations::Factory.random(type))
        end

        cc_result_arr
      rescue StandardError => e
        raise e
      end

      # Supported Method Parameters::
      # PWN::Plugins::CreditCard.type(
      #   cc: 'required - e.g. XXXX XXXX XXXX XXXX'
      # )

      public_class_method def self.type(opts = {})
        cc = opts[:cc].to_s.scrub.strip.chomp
        cc.credit_card_brand
      rescue StandardError => e
        raise e
      end

      # Author(s):: 0day Inc. <support@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <support@0dayinc.com>
        "
      end

      # Display Usage for this Module

      public_class_method def self.help
        puts "USAGE:
          #{self}.generate(
            type: 'required - card to generate :amex|:unionpay|:dankort|:diners|:elo|:discover|:hipercard|:jcb|:maestro|:mastercard|:mir|:rupay|:solo|:switch|:visa',
            count: 'optional - number of numbers to generate (defaults to 1)'
          )

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

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

103 entries across 103 versions & 1 rubygems

Version Path
pwn-0.5.253 lib/pwn/plugins/credit_card.rb
pwn-0.5.252 lib/pwn/plugins/credit_card.rb
pwn-0.5.251 lib/pwn/plugins/credit_card.rb
pwn-0.5.250 lib/pwn/plugins/credit_card.rb
pwn-0.5.249 lib/pwn/plugins/credit_card.rb
pwn-0.5.248 lib/pwn/plugins/credit_card.rb
pwn-0.5.247 lib/pwn/plugins/credit_card.rb
pwn-0.5.246 lib/pwn/plugins/credit_card.rb
pwn-0.5.245 lib/pwn/plugins/credit_card.rb
pwn-0.5.244 lib/pwn/plugins/credit_card.rb
pwn-0.5.243 lib/pwn/plugins/credit_card.rb
pwn-0.5.242 lib/pwn/plugins/credit_card.rb
pwn-0.5.241 lib/pwn/plugins/credit_card.rb
pwn-0.5.240 lib/pwn/plugins/credit_card.rb
pwn-0.5.239 lib/pwn/plugins/credit_card.rb
pwn-0.5.238 lib/pwn/plugins/credit_card.rb
pwn-0.5.237 lib/pwn/plugins/credit_card.rb
pwn-0.5.236 lib/pwn/plugins/credit_card.rb
pwn-0.5.235 lib/pwn/plugins/credit_card.rb
pwn-0.5.234 lib/pwn/plugins/credit_card.rb