From 2565888ec5fa4c2a1359ffa9b076c3433ad5e097 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Sun, 3 Jun 2012 13:13:44 -0500 Subject: [PATCH] Change how we handle the password complexity failure --- modules/payloads/singles/cmd/windows/adduser.rb | 7 ++----- modules/payloads/singles/windows/adduser.rb | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/modules/payloads/singles/cmd/windows/adduser.rb b/modules/payloads/singles/cmd/windows/adduser.rb index 7ee40075f7..fd2698b7a5 100644 --- a/modules/payloads/singles/cmd/windows/adduser.rb +++ b/modules/payloads/singles/cmd/windows/adduser.rb @@ -73,11 +73,8 @@ module Metasploit3 raise ArgumentError, "Password for the adduser payload must be 14 characters or less" end - if (pass =~ /\A^.*((?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W])).*$/) and complexity - print_good "Password: #{pass} passes complexity checks" - elsif complexity - print_error "Password: #{pass} doesn't meet complexity requirements and may cause issues" - print_error "The password should idealy be 8-14 chars (1 UPPER, 1 lower, 1 digit/special)" + if complexity and pass !~ /\A^.*((?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W])).*$/ + raise ArgumentError, "Password: #{pass} doesn't meet complexity requirements and may cause issues" end if not cust.empty? diff --git a/modules/payloads/singles/windows/adduser.rb b/modules/payloads/singles/windows/adduser.rb index 7a2e25fed0..7139491a44 100644 --- a/modules/payloads/singles/windows/adduser.rb +++ b/modules/payloads/singles/windows/adduser.rb @@ -74,11 +74,8 @@ module Metasploit3 raise ArgumentError, "Password for the adduser payload must be 14 characters or less" end - if (pass =~ /\A^.*((?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W])).*$/) and complexity - print_good "Password: #{pass} passes complexity checks" - elsif complexity - print_error "Password: #{pass} doesn't meet complexity requirements and may cause issues" - print_error "The password should idealy be 8-14 chars (1 UPPER, 1 lower, 1 digit/special)" + if complexity and pass !~ /\A^.*((?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W])).*$/ + raise ArgumentError, "Password: #{pass} doesn't meet complexity requirements and may cause issues" end if not cust.empty?