From cf65db9573ec99b0f4e2b599b6f158785602c230 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 11 Feb 2015 16:11:18 -0500 Subject: Updated oscp and ossh. --- bin/oscp | 7 ++----- bin/ossh | 17 +++++++---------- bin/ossh_bash_completion | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'bin') diff --git a/bin/oscp b/bin/oscp index 463dadaef..385e36732 100755 --- a/bin/oscp +++ b/bin/oscp @@ -54,8 +54,8 @@ class Oscp(object): help='options to pass to SSH.\n \ "-oPort=22,TCPKeepAlive=yes"') - parser.add_argument('src', default='') - parser.add_argument('dest',default='') + parser.add_argument('src', nargs='?', default='') + parser.add_argument('dest',nargs='?', default='') self.args = parser.parse_args() self.parser = parser @@ -89,9 +89,6 @@ class Oscp(object): else: self.host = search.groups()[0] self.path = search.groups()[1] - else: - print "Could not determine user and hostname." - return if self.args.env: self.env = self.args.env diff --git a/bin/ossh b/bin/ossh index d74244501..6b04cb46e 100755 --- a/bin/ossh +++ b/bin/ossh @@ -24,15 +24,10 @@ class Ossh(object): # parse host and user self.process_host() - if not self.args.list and not self.env: - print "Please specify an environment." - return - if self.args.host == '' and not self.args.list: self.parser.print_help() return - if self.args.debug: print self.args @@ -176,16 +171,18 @@ class Ossh(object): for arg in self.args.ssh_opts.split(","): ssh_args.append("-o%s" % arg) - result = self.select_host() - if not result: + results = self.select_host() + if not results: return # early exit, no results - if len(result) > 1: - self.list_hosts(10) + if len(results) > 1: + print "Multiple results found for %s." % self.host + for result in results: + print "{ec2_tag_Name:<35} {ec2_tag_environment:<5} {ec2_id:<10}".format(**result[1]) return # early exit, too many results # Assume we have one and only one. - hostname, server_info = result[0] + hostname, server_info = results[0] dns = server_info['ec2_public_dns_name'] ssh_args.append(dns) diff --git a/bin/ossh_bash_completion b/bin/ossh_bash_completion index 0d0bdb0e6..6a95ce6ee 100755 --- a/bin/ossh_bash_completion +++ b/bin/ossh_bash_completion @@ -15,4 +15,4 @@ _ossh() return 0 } -complete -F _ossh ossh +complete -F _ossh ossh oscp -- cgit v1.2.3