124: def consoles
125: opts = {}
126: opts[:group] = @option.group if @option.group
127: opts[:id] = @argv.instid if @argv.instid
128: opts[:id] &&= [opts[:id]].flatten
129:
130: lt = Rudy::AWS::EC2::Instances.list_group(opts[:group], :any, opts[:id]) do |inst|
131: li instance_separator(inst.dns_public || inst.state, inst.awsid)
132: console = Rudy::AWS::EC2::Instances.console(inst.awsid)
133: output = console ? Base64.decode64(console) : "Unavailable"
134:
135:
136:
137:
138: output &&= output.noansi
139:
140: li output
141:
142: if output.match(/<Password>(.+)<\/Password>/m)
143: li
144: if @@global.pkey
145: encrtypted_text = ($1 || '').strip
146: k = Rye::Key.from_file(@@global.pkey)
147: pword = k.decrypt(encrtypted_text)
148: answer = "%s: %s" % ['password', pword]
149: Annoy.timed_display(answer, STDERR, 10)
150: li
151: else
152: li "Please supply a private key path to decode the administrator password"
153: li "rudy-ec2 -k path/2/privatekey console [-g group] [instance ID]"
154: end
155: end
156:
157: end
158:
159: end