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.958 lib/pwn/plugins/credit_card.rb
pwn-0.4.957 lib/pwn/plugins/credit_card.rb
pwn-0.4.956 lib/pwn/plugins/credit_card.rb
pwn-0.4.955 lib/pwn/plugins/credit_card.rb
pwn-0.4.954 lib/pwn/plugins/credit_card.rb
pwn-0.4.953 lib/pwn/plugins/credit_card.rb
pwn-0.4.952 lib/pwn/plugins/credit_card.rb
pwn-0.4.951 lib/pwn/plugins/credit_card.rb
pwn-0.4.950 lib/pwn/plugins/credit_card.rb
pwn-0.4.949 lib/pwn/plugins/credit_card.rb
pwn-0.4.948 lib/pwn/plugins/credit_card.rb
pwn-0.4.947 lib/pwn/plugins/credit_card.rb
pwn-0.4.946 lib/pwn/plugins/credit_card.rb
pwn-0.4.945 lib/pwn/plugins/credit_card.rb
pwn-0.4.944 lib/pwn/plugins/credit_card.rb
pwn-0.4.943 lib/pwn/plugins/credit_card.rb
pwn-0.4.942 lib/pwn/plugins/credit_card.rb
pwn-0.4.941 lib/pwn/plugins/credit_card.rb
pwn-0.4.940 lib/pwn/plugins/credit_card.rb
pwn-0.4.939 lib/pwn/plugins/credit_card.rb