@@ -11,14 +11,35 @@ class Metasploit3 < Msf::Post
11
11
include Msf ::Auxiliary ::Report
12
12
include Msf ::Post ::Windows ::LDAP
13
13
14
+ SEARCH_FILTER = '(&(objectClass=organizationalPerson)(objectClass=user)(objectClass=person)(!(objectClass=computer)))'
15
+ DEFAULT_FIELDS = [
16
+ 'sn' ,
17
+ 'givenName' ,
18
+ 'state' ,
19
+ 'postalCode' ,
20
+ 'physicalDeliveryOfficeName' ,
21
+ 'telephoneNumber' ,
22
+ 'mobile' ,
23
+ 'facsimileTelephoneNumber' ,
24
+ 'displayName' ,
25
+ 'title' ,
26
+ 'department' ,
27
+ 'company' ,
28
+ 'streetAddress' ,
29
+ 'sAMAccountName' ,
30
+ 'userAccountControl' ,
31
+ 'comment' ,
32
+ 'description'
33
+ ]
34
+
14
35
def initialize ( info = { } )
15
36
super ( update_info ( info ,
16
37
'Name' => 'Windows Gather Words from Active Directory' ,
17
- 'Description' => %Q {
18
- This module will enumerate all user accounts in the default Active Domain (AD) directory and use
19
- these as words to seed a wordlist.In cases (like description) where spaces may occur, some extra processing
20
- is done to generate multiple words in addition to one long one (up to 24 characters).Results are dumped into
21
- /tmp
38
+ 'Description' => %q {
39
+ This module will enumerate all user accounts in the default Active Domain (AD) directory
40
+ and use these as words to seed a wordlist.In cases (like description) where spaces may
41
+ occur, some extra processing is done to generate multiple words in addition to one long
42
+ one (up to 24 characters). Results are dumped into /tmp
22
43
} ,
23
44
'License' => MSF_LICENSE ,
24
45
'Author' => [ 'Thomas Ring' ] ,
@@ -27,26 +48,15 @@ def initialize(info={})
27
48
) )
28
49
29
50
register_options ( [
30
- OptString . new ( 'FIELDS' , [ false , 'Fields to retrieve (ie, sn, givenName, displayName, description, comment)' , '' ] ) ,
51
+ OptString . new ( 'FIELDS' , [ true , 'Fields to retrieve (ie, sn, givenName, displayName, description, comment)' , DEFAULT_FIELDS ] ) ,
31
52
] , self . class )
32
53
end
33
54
34
55
def run
35
-
36
- fields = [ ]
37
- if ( datastore [ 'FIELDS' ] == '' )
38
- field_str = 'sn,givenName,state,postalCode,physicalDeliveryOfficeName,telephoneNumber,mobile,facsimileTelephoneNumber,displayName,'
39
- field_str << 'title,department,company, streetAddress,sAMAccountName,userAccountControl,comment,description'
40
- fields = field_str . gsub! ( /\s +/ , '' ) . split ( ',' )
41
- else
42
- fields = datastore [ 'FIELDS' ] . gsub ( /\s +/ , "" ) . split ( ',' )
43
- end
44
-
45
- search_filter = '(&(objectClass=organizationalPerson)(objectClass=user)(objectClass=person)(!(objectClass=computer)))'
46
- max_search = datastore [ 'MAX_SEARCH' ]
56
+ fields = datastore [ 'FIELDS' ] . gsub ( /\s +/ , "" ) . split ( ',' )
47
57
48
58
begin
49
- q = query ( search_filter , max_search , fields )
59
+ q = query ( SEARCH_FILTER , datastore [ 'MAX_SEARCH' ] , fields )
50
60
return if !q or q [ :results ] . empty?
51
61
rescue ::RuntimeError , ::Rex ::Post ::Meterpreter ::RequestError => e
52
62
# Can't bind or in a network w/ limited accounts
0 commit comments