<commit_before>=begin
                  Arachni
  Copyright (c) 2010 Tasos "Zapotek" Laskos <<EMAIL>>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

module Arachni
module Modules

#
# Credit Card Number recon module.
#
# Scans every page for credit card numbers.
#
# @author: morpheuslaw <<EMAIL>>
# @version: 0.1
#
class CreditCards < Arachni::Module::Base

    def initialize( page )
        @page = page
    end

    def run( )
        ccNumber = /^(((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15})$/

        # match CC number candidates and verify matches before logging
        match_and_log( ccNumber ){
            |match|
            __luhn_check( match )
        }
    end

    #
    # Checks for a valid credit card number
    #
    def __luhn_check( cc_number )
      cc_number   = cc_number.gsub( /D/, '' )
      cc_length   = cc_number.length
      parity      = cc_length % 2<commit_msg>updated the regexp<commit_after>=begin
                  Arachni
  Copyright (c) 2010 <NAME>" Laskos <<EMAIL>>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

module Arachni
module Modules

#
# Credit Card Number recon module.
#
# Scans every page for credit card numbers.
#
# @author: morpheuslaw <<EMAIL>>
# @version: 0.1
#
class CreditCards < Arachni::Module::Base

    def initialize( page )
        @page = page
    end

    def run( )
        ccNumber = /\b(((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15})\b/

        # match CC number candidates and verify matches before logging
        match_and_log( ccNumber ){
            |match|
            __luhn_check( match )
        }
    end

    #
    # Checks for a valid credit card number
    #
    def __luhn_check( cc_number )
      cc_number   = cc_number.gsub( /D/, '' )
      cc_length   = cc_number.length
      parity      = cc_length % 2
{'fraction_non_alphanumeric': 0.12204534491075736, 'fraction_numerical': 0.02604920405209841, 'mean_word_length': 2.3451612903225807, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1344364', 'n_tokens_mistral': 746, 'n_tokens_neox': 709, 'n_words': 206}