MCPcopy Create free account
hub / github.com/Geeoon/asploit / __add

Method __add

src/BotnetCommandProcessor.py:65–94  ·  view source on GitHub ↗
(self, options: str)

Source from the content-addressed store, hash-verified

63 @throw CommandException if host is malformatted.
64 """
65 def __add(self, options: str):
66 if options.count(" ") != 5:
67 raise CommandException("Incorrect usage. "
68 "Run 'help add' for usage.")
69 name, host, path, target_type, method, header = options.split(" ")
70 if name == "*":
71 print("'*' name not allowed.")
72 if name in map(lambda host : host["name"], self.targets):
73 raise CommandException(f"'{name}' already in targets.")
74
75 typeClass = next((t for t in self.exploitClasses if t.get_name().upper()
76 == target_type.upper()), None)
77 if not typeClass:
78 raise CommandException(f"'{name}' is of an unsupported type.")
79
80 processor = None
81 try:
82 processor = typeClass(host, path, method, header)
83 except CommandException as e:
84 print(f"{name}: {str(e)}")
85
86 self.targets.append({
87 "name": name,
88 "host": host,
89 "path": path,
90 "type": target_type,
91 "method": method,
92 "header": header,
93 "processor": processor
94 })
95
96 """
97 @brief List all of the hosts

Callers 1

__loadMethod · 0.95

Calls 2

CommandExceptionClass · 0.85
get_nameMethod · 0.45

Tested by

no test coverage detected