Explanation: ------------ Add a single host by IP address Or a list of single hosts separatedd by a comma Parameters: ----------- :param ip: IP address to be added Command Format: -------------- single IP[,IP,IP,IP,IP
(self, ip)
| 318 | lib.output.warning("currently no gathered hosts") |
| 319 | |
| 320 | def do_add_single_host(self, ip): |
| 321 | """ |
| 322 | Explanation: |
| 323 | ------------ |
| 324 | Add a single host by IP address |
| 325 | Or a list of single hosts separatedd by a comma |
| 326 | |
| 327 | Parameters: |
| 328 | ----------- |
| 329 | :param ip: IP address to be added |
| 330 | |
| 331 | Command Format: |
| 332 | -------------- |
| 333 | single IP[,IP,IP,IP,IP,...] |
| 334 | |
| 335 | Examples: |
| 336 | --------- |
| 337 | single 89.76.12.124,89.76.12.43 |
| 338 | """ |
| 339 | for item in ip.split(","): |
| 340 | validated_ip = lib.settings.validate_ip_addr(item) |
| 341 | if not validated_ip: |
| 342 | lib.output.error("provided IP '{}' is invalid, try again".format(ip)) |
| 343 | else: |
| 344 | with open(lib.settings.HOST_FILE, "a+") as hosts: |
| 345 | hosts.write(item + "\n") |
| 346 | lib.output.info("host '{}' saved to hosts file".format(item)) |
| 347 | |
| 348 | def do_quit_terminal(self, save_history=True): |
| 349 | """ |
no outgoing calls
no test coverage detected