Sha256: f0bdfcb953a0262718af14bce0ee28582fd2f61440f27b4ec4ea86e49319541d

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module PWN
  module Plugins
    # This plugin provides useful social security number capabilities
    module SSN
      # Supported Method Parameters::
      # PWN::Plugins::SSN.generate(
      #   count: 'required - number of SSN numbers to generate'
      # )

      public_class_method def self.generate(opts = {})
        count = opts[:count].to_i

        # Based upon new SSN Randomization:
        # https://www.ssa.gov/employer/randomization.html
        ssn_result_arr = []
        (1..count).each do
          this_area = format('%0.3d', Random.rand(1..999))
          this_group = format('%0.2d', Random.rand(1..99))
          this_serial = format('%0.4d', Random.rand(1..9999))
          this_ssn = "#{this_area}-#{this_group}-#{this_serial}"
          ssn_result_arr.push(this_ssn)
        end

        ssn_result_arr
      rescue StandardError => e
        raise e
      end

      # Author(s):: Jacob Hoopes <jake.hoopes@gmail.com>

      public_class_method def self.authors
        "AUTHOR(S):
          Jacob Hoopes <jake.hoopes@gmail.com>
        "
      end

      # Display Usage for this Module

      public_class_method def self.help
        puts "USAGE:
          #{self}.generate(
            count: 'required - number of SSN numbers to generate'
          )

          #{self}.authors
        "
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pwn-0.4.340 lib/pwn/plugins/ssn.rb
pwn-0.4.339 lib/pwn/plugins/ssn.rb
pwn-0.4.338 lib/pwn/plugins/ssn.rb
pwn-0.4.336 lib/pwn/plugins/ssn.rb
pwn-0.4.333 lib/pwn/plugins/ssn.rb