Skip to content

Strip out same address in msg#21408

Open
g0tmi1k wants to merge 1 commit intorapid7:masterfrom
g0tmi1k:print_message
Open

Strip out same address in msg#21408
g0tmi1k wants to merge 1 commit intorapid7:masterfrom
g0tmi1k:print_message

Conversation

@g0tmi1k
Copy link
Copy Markdown
Contributor

@g0tmi1k g0tmi1k commented May 5, 2026

I've open up a few PRs recently, and a common item has been the "duplicatd IP:PORT" in output.

Example:

msf auxiliary(scanner/ftp/ftp_login) > run
[*] 10.0.0.10:21          - 10.0.0.10:21 - Starting FTP login sweep
[-] 10.0.0.10:21          - 10.0.0.10:21 - LOGIN FAILED: : (Incorrect: )
[-] 10.0.0.10:21          - 10.0.0.10:21 - LOGIN FAILED: msfadmin:incorrect (Incorrect: )
[+] 10.0.0.10:21          - 10.0.0.10:21 - Login Successful: msfadmin:msfadmin
[*] 10.0.0.10:21          - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_login) >

The workaround I had been doing was using if datastore['VERBOSE'], as seen below:

$ git diff
diff --git a/modules/auxiliary/scanner/ftp/ftp_login.rb b/modules/auxiliary/scanner/ftp/ftp_login.rb
index 093eb163a5..1c41754a30 100644
--- a/modules/auxiliary/scanner/ftp/ftp_login.rb
+++ b/modules/auxiliary/scanner/ftp/ftp_login.rb
@@ -100,7 +100,8 @@ class MetasploitModule < Msf::Auxiliary
         print_good "#{ip}:#{rport} - Login Successful: #{result.credential}"
       else
         invalidate_login(credential_data)
-        vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})"
+        vprint_error "LOGIN FAILED (#1): #{result.credential} (#{result.status}: #{result.proof})"
+        print_error "LOGIN FAILED (#2): #{result.credential} (#{result.status}: #{result.proof})" if datastore['VERBOSE']
       end
     end
   end
$



msf auxiliary(scanner/ftp/ftp_login) > reload
[*] Reloading module...
msf auxiliary(scanner/ftp/ftp_login) > run
[*] 10.0.0.10:21          - 10.0.0.10:21 - Starting FTP login sweep
[-] 10.0.0.10:21          - 10.0.0.10:21          - LOGIN FAILED (#1): : (Incorrect: )
[-] 10.0.0.10:21          - LOGIN FAILED (#2): : (Incorrect: )
[-] 10.0.0.10:21          - 10.0.0.10:21          - LOGIN FAILED (#1): msfadmin:incorrect (Incorrect: )
[-] 10.0.0.10:21          - LOGIN FAILED (#2): msfadmin:incorrect (Incorrect: )
[+] 10.0.0.10:21          - 10.0.0.10:21 - Login Successful: msfadmin:msfadmin
[*] 10.0.0.10:21          - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_login) >

However, after doing it on a few modules, figured I would try and address the problem.


Before

$ ./msfconsole -q -x 'db_status; workspace -D;
setg VERBOSE true; setg RHOSTS 10.0.0.10; setg LHOST tap0; setg USERNAME msfadmin; setg PASSWORD incorrect; setg USER_AS_PASS true; setg ANONYMOUS_LOGIN true; setg BLANK_PASSWORDS true; setg RECORD_GUEST false; set STOP_ON_SUCCESS false;'
[*] Connected to msf. Connection type: postgresql.
[*] Deleted workspace: default
[*] Recreated the default workspace
VERBOSE => true
RHOSTS => 10.0.0.10
LHOST => tap0
USERNAME => msfadmin
PASSWORD => incorrect
USER_AS_PASS => true
ANONYMOUS_LOGIN => true
BLANK_PASSWORDS => true
RECORD_GUEST => false
STOP_ON_SUCCESS => false
msf > use ftp_login

Matching Modules
================

   #  Name                             Disclosure Date  Rank    Check  Description
   -  ----                             ---------------  ----    -----  -----------
   0  auxiliary/scanner/ftp/ftp_login  .                normal  No     FTP Authentication Scanner


Interact with a module by name or index. For example info 0, use 0 or use auxiliary/scanner/ftp/ftp_login

[*] Using auxiliary/scanner/ftp/ftp_login
msf auxiliary(scanner/ftp/ftp_login) > run
[*] 10.0.0.10:21          - 10.0.0.10:21 - Starting FTP login sweep
[-] 10.0.0.10:21          - 10.0.0.10:21 - LOGIN FAILED: : (Incorrect: )
[-] 10.0.0.10:21          - 10.0.0.10:21 - LOGIN FAILED: msfadmin:incorrect (Incorrect: )
[+] 10.0.0.10:21          - 10.0.0.10:21 - Login Successful: msfadmin:msfadmin
[*] 10.0.0.10:21          - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_login) >

After

$ ./msfconsole -q -x 'db_status; workspace -D;
setg VERBOSE true; setg RHOSTS 10.0.0.10; setg LHOST tap0; setg USERNAME msfadmin; setg PASSWORD incorrect; setg USER_AS_PASS true; setg ANONYMOUS_LOGIN true; setg BLANK_PASSWORDS true; setg RECORD_GUEST false; set STOP_ON_SUCCESS false;'
[*] Connected to msf. Connection type: postgresql.
[*] Deleted workspace: default
[*] Recreated the default workspace
VERBOSE => true
RHOSTS => 10.0.0.10
LHOST => tap0
USERNAME => msfadmin
PASSWORD => incorrect
USER_AS_PASS => true
ANONYMOUS_LOGIN => true
BLANK_PASSWORDS => true
RECORD_GUEST => false
STOP_ON_SUCCESS => false
msf > use ftp_login

Matching Modules
================

   #  Name                             Disclosure Date  Rank    Check  Description
   -  ----                             ---------------  ----    -----  -----------
   0  auxiliary/scanner/ftp/ftp_login  .                normal  No     FTP Authentication Scanner


Interact with a module by name or index. For example info 0, use 0 or use auxiliary/scanner/ftp/ftp_login

[*] Using auxiliary/scanner/ftp/ftp_login
msf auxiliary(scanner/ftp/ftp_login) > run
[*] 10.0.0.10:21          - Starting FTP login sweep
[-] 10.0.0.10:21          - LOGIN FAILED: : (Incorrect: )
[-] 10.0.0.10:21          - LOGIN FAILED: msfadmin:incorrect (Incorrect: )
[+] 10.0.0.10:21          - Login Successful: msfadmin:msfadmin
[*] 10.0.0.10:21          - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_login) >

@g0tmi1k g0tmi1k force-pushed the print_message branch 3 times, most recently from 3650247 to 6c384a3 Compare May 6, 2026 12:32
Copy link
Copy Markdown
Contributor

@smcintyre-r7 smcintyre-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could use an alternative approach whereby we avoid adding the prefix twice instead of removing it?

@smcintyre-r7 smcintyre-r7 self-assigned this May 6, 2026
@smcintyre-r7 smcintyre-r7 added bug rn-fix release notes fix labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug rn-fix release notes fix

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants