Skip to content

Commit a84c088

Browse files
committed
create_exploit(): More elaborate error message
1 parent 0783f8a commit a84c088

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

routersploit/utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,18 @@ def create_exploit(path): # TODO: cover with tests
539539
parts = path.split(os.sep)
540540
module_type, name = parts[0], parts[-1]
541541

542-
if not name:
543-
print_error("Invalid exploit name. ;(")
542+
if len(parts) == 1 or not name:
543+
print_error("Invalid exploit name: '{}'\n"
544+
"Use following naming convention: module_type/vendor_name/exploit_name\n"
545+
"e.g. exploits/dlink/password_disclosure".format(name))
544546
return
545547

546-
if module_type not in ['creds', 'exploits', 'scanners']:
547-
print_error("Invalid module type. ;(")
548+
types = ['creds', 'exploits', 'scanners']
549+
if module_type not in types:
550+
print_error("Invalid module type: '{}'\n"
551+
"Available types: {}\n"
552+
"Use following naming convention: module_type/vendor_name/exploit_name\n"
553+
"e.g. exploits/dlink/password_disclosure".format(module_type, types))
548554
return
549555

550556
create_resource(

0 commit comments

Comments
 (0)