Sha256: c376a0d6cf93240d6f128e61cef560ad47fe19e43a4d11490770788eae4086c5

Contents?: true

Size: 1.9 KB

Versions: 502

Compression:

Stored size: 1.9 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: 'required - number of numbers to generate'
      # )

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

        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. <request.pentest@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <request.pentest@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: 'required - number of numbers to generate'
          )

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

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

502 entries across 502 versions & 1 rubygems

Version Path
pwn-0.4.868 lib/pwn/plugins/credit_card.rb
pwn-0.4.867 lib/pwn/plugins/credit_card.rb
pwn-0.4.866 lib/pwn/plugins/credit_card.rb
pwn-0.4.865 lib/pwn/plugins/credit_card.rb
pwn-0.4.864 lib/pwn/plugins/credit_card.rb
pwn-0.4.863 lib/pwn/plugins/credit_card.rb
pwn-0.4.862 lib/pwn/plugins/credit_card.rb
pwn-0.4.861 lib/pwn/plugins/credit_card.rb
pwn-0.4.860 lib/pwn/plugins/credit_card.rb
pwn-0.4.859 lib/pwn/plugins/credit_card.rb
pwn-0.4.858 lib/pwn/plugins/credit_card.rb
pwn-0.4.857 lib/pwn/plugins/credit_card.rb
pwn-0.4.856 lib/pwn/plugins/credit_card.rb
pwn-0.4.855 lib/pwn/plugins/credit_card.rb
pwn-0.4.854 lib/pwn/plugins/credit_card.rb
pwn-0.4.853 lib/pwn/plugins/credit_card.rb
pwn-0.4.852 lib/pwn/plugins/credit_card.rb
pwn-0.4.851 lib/pwn/plugins/credit_card.rb
pwn-0.4.850 lib/pwn/plugins/credit_card.rb
pwn-0.4.849 lib/pwn/plugins/credit_card.rb