File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
spec/lib/msf/base/sessions Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,17 @@ def bootstrap(datastore = {}, handler = nil)
42
42
session = self
43
43
session . init_ui ( user_input , user_output )
44
44
45
- @info = "LDAP #{ datastore [ 'USERNAME' ] } @ #{ @peer_info } "
45
+ username = datastore [ 'USERNAME' ]
46
+ if username . blank?
47
+ begin
48
+ whoami = client . ldapwhoami
49
+ rescue Net ::LDAP ::Error => e
50
+ ilog ( 'ldap session opened with no username and the target does not support the LDAP whoami extension' )
51
+ else
52
+ username = whoami . delete_prefix ( 'u:' ) . split ( '\\' ) . last
53
+ end
54
+ end
55
+ @info = "LDAP #{ username } @ #{ @peer_info } "
46
56
end
47
57
48
58
def execute_file ( full_path , args )
Original file line number Diff line number Diff line change 23
23
allow ( client ) . to receive ( :peerinfo ) . and_return ( peer_info )
24
24
allow ( client ) . to receive ( :peerhost ) . and_return ( address )
25
25
allow ( client ) . to receive ( :peerport ) . and_return ( port )
26
+ allow ( client ) . to receive ( :ldapwhoami ) . and_return ( "u:WORKGROUP\\ Administrator" )
26
27
end
27
28
28
29
it_behaves_like 'client session'
You can’t perform that action at this time.
0 commit comments