File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
modules/auxiliary/scanner/smb Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,23 @@ def run_host(ip)
108
108
end
109
109
110
110
if simple . client . default_domain
111
- desc << " (domain:#{ simple . client . default_domain } )"
111
+ if simple . client . default_domain . encoding . name == "UTF-8"
112
+ desc << " (domain:#{ simple . client . default_domain } )"
113
+ else
114
+ # Workgroup names are in ANSI, but may contain invalid characters
115
+ # Go through each char and convert/check
116
+ temp_workgroup = simple . client . default_domain . dup
117
+ desc << " (workgroup:"
118
+ temp_workgroup . each_char do |i |
119
+ begin
120
+ desc << i . encode ( "UTF-8" )
121
+ rescue Encoding ::UndefinedConversionError => e
122
+ desc << '?'
123
+ print_error ( "Found incompatible (non-ANSI) character in Workgroup name. Replaced with '?'" )
124
+ end
125
+ end
126
+ desc << " )"
127
+ end
112
128
conf [ :SMBDomain ] = simple . client . default_domain
113
129
match_conf [ 'host.domain' ] = conf [ :SMBDomain ]
114
130
end
You can’t perform that action at this time.
0 commit comments