File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <ruby>
2
+
3
+ hosts = []
4
+
5
+ begin
6
+ framework.db.services.each do |service|
7
+ if ( service.name =~ /mssql/i and service.state == 'open' and service.proto == 'tcp')
8
+ hosts << {'ip' => service.host.address, 'port' => service.port}
9
+ end
10
+ end
11
+ rescue ActiveRecord::ConnectionNotEstablished
12
+ puts "DB not connected..."
13
+ # Uncomment if you want auto-reconnect and retry (on really large scans the db connector can time out)
14
+ # self.run_single('db_connect <creds>')
15
+ # puts "trying again..."
16
+ # retry
17
+ end
18
+
19
+ self.run_single("use auxiliary/scanner/mssql/mssql_login")
20
+ self.run_single('set PASS_FILE /opt/framework/data/wordlists/mssql.txt')
21
+ #self.run_single('set STOP_ON_SUCCESS TRUE')
22
+ hosts.each do |rhost|
23
+
24
+ self.run_single("set RHOSTS #{rhost['ip']}")
25
+ self.run_single("set RPORT #{rhost['port']}")
26
+ self.run_single('set BRUTEFORCE_SPEED 5')
27
+ self.run_single('set BLANK_PASSWORDS false')
28
+ self.run_single('set USER_AS_PASS false')
29
+ self.run_single('run')
30
+ sleep 1
31
+ end
32
+ </ruby>
33
+
You can’t perform that action at this time.
0 commit comments