Skip to content

Commit

Permalink
Merge pull request #9 from g0tmi1k/check-path
Browse files Browse the repository at this point in the history
SSH: Check path before trying to brute force
  • Loading branch information
galkan committed Jan 20, 2016
2 parents 40faf4f + fe5355f commit cf38ad1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def openvpn(self):
port = 443

if not os.path.exists(self.openvpn_path):
mess = "openvpn: %s path doesn't exists on the system !!!"% (self.openvpn_path)
mess = "openvpn: %s path doesn't exists on the system !!!" % os.path.abspath(self.openvpn_path)
raise CrowbarExceptions(mess)

if self.args.port is not None:
Expand Down Expand Up @@ -236,15 +236,15 @@ def openvpn(self):
try:
userfile = open(self.args.username_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists !!!"% self.args.username_file
mess = "File: %s doesn't exists !!!" % os.path.abspath(self.args.username_file)
raise CrowbarExceptions(mess)

for user in userfile:
if self.args.passwd_file:
try:
passwdfile = open(self.args.passwd_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists !!!"% self.args.passwd_file
mess = "File: %s doesn't exists !!!" % os.path.abspath(self.args.passwd_file)
raise CrowbarExceptions(mess)

for password in passwdfile:
Expand All @@ -262,7 +262,7 @@ def openvpn(self):
try:
passwdfile = open(self.args.passwd_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists !!!"% self.args.passwd_file
mess = "File: %s doesn't exists !!!" % os.path.abspath(self.args.passwd_file)
raise CrowbarExceptions(mess)

for password in passwdfile:
Expand Down Expand Up @@ -301,7 +301,7 @@ def vnckey(self, *options):
port = 5901

if not os.path.exists(self.vncviewer_path):
mess = "vncviewer: %s path doesn't exists on the system !!!"% (self.vncviewer_path)
mess = "vncviewer: %s path doesn't exists on the system !!!" % os.path.abspath(self.vncviewer_path)
raise CrowbarExceptions(mess)

if self.args.port is not None:
Expand All @@ -312,7 +312,7 @@ def vnckey(self, *options):


if not os.path.isfile(self.args.key_file):
mess = "Key file: \"%s\" doesn't exists."% self.args.key_file
mess = "Key file: \"%s\" doesn't exists." % os.path.abspath(self.args.key_file)
raise CrowbarExceptions(mess)


Expand Down Expand Up @@ -355,7 +355,7 @@ def rdp(self):
port = 3389

if not os.path.exists(self.xfreerdp_path):
mess = "xfreerdp: %s path doesn't exists on the system !!!"% (self.xfreerdp_path)
mess = "xfreerdp: %s path doesn't exists on the system !!!" % os.path.abspath(self.xfreerdp_path)
raise CrowbarExceptions(mess)

if self.args.port is not None:
Expand All @@ -378,7 +378,7 @@ def rdp(self):
try:
userfile = open(self.args.username_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists !!!"% self.args.username_file
mess = "File: %s doesn't exists !!!" % os.path.abspath(self.args.username_file)
raise CrowbarExceptions(mess)

for user in userfile:
Expand All @@ -389,7 +389,7 @@ def rdp(self):
try:
passwdfile = open(self.args.passwd_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists"% self.args.passwd_file
mess = "File: %s doesn't exists" % os.path.abspath(self.args.passwd_file)
raise CrowbarExceptions(mess)

for password in passwdfile:
Expand All @@ -401,7 +401,7 @@ def rdp(self):
try:
passwdfile = open(self.args.passwd_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists"% self.args.passwd_file
mess = "File: %s doesn't exists" % os.path.abspath(self.args.passwd_file)
raise CrowbarExceptions(mess)

for password in passwdfile:
Expand Down Expand Up @@ -448,7 +448,10 @@ def sshkey(self):
pool = ThreadPool(self.args.thread)
except Exception, err:
raise CrowbarExceptions(str(err))


if not os.path.exists(self.args.key_file):
mess = "Key file/folder: \"%s\" doesn't exists." % os.path.abspath(self.args.key_file)
raise CrowbarExceptions(mess)

for ip in self.ip_list:
if not self.args.quiet:
Expand All @@ -458,7 +461,7 @@ def sshkey(self):
try:
userfile = open(self.args.username_file, "r").read().splitlines()
except:
mess = "File: %s doesn't exists !!!"% self.args.username_file
mess = "File: %s doesn't exists !!!" % os.path.abspath(self.args.username_file)
raise CrowbarExceptions(mess)

for user in userfile:
Expand Down

0 comments on commit cf38ad1

Please sign in to comment.