Skip to content

Commit d4d5935

Browse files
committed
create_exploit(): adding vendor validation
1 parent a84c088 commit d4d5935

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

routersploit/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,14 @@ def create_exploit(path): # TODO: cover with tests
537537
from .templates import exploit
538538

539539
parts = path.split(os.sep)
540-
module_type, name = parts[0], parts[-1]
540+
module_type, vendor, name = parts[0], [1], parts[-1]
541+
if len(parts) < 3:
542+
print_error("Invalid format. "
543+
"Use following naming convention: module_type/vendor_name/exploit_name\n"
544+
"e.g. exploits/dlink/password_disclosure".format(name))
545+
return
541546

542-
if len(parts) == 1 or not name:
547+
if not name:
543548
print_error("Invalid exploit name: '{}'\n"
544549
"Use following naming convention: module_type/vendor_name/exploit_name\n"
545550
"e.g. exploits/dlink/password_disclosure".format(name))

0 commit comments

Comments
 (0)