MCPcopy
hub / github.com/NullArray/AutoSploit / do_clean_hosts

Method do_clean_hosts

lib/term/terminal.py:156–173  ·  view source on GitHub ↗

Clean the hosts.txt file of any duplicate IP addresses

(self)

Source from the content-addressed store, hash-verified

154 lib.settings.cmdline(command, is_msf=False)
155
156 def do_clean_hosts(self):
157 """
158 Clean the hosts.txt file of any duplicate IP addresses
159 """
160 retval = set()
161 current_size = len(self.loaded_hosts)
162 for host in self.loaded_hosts:
163 retval.add(host)
164 cleaned_size = len(retval)
165 with open(lib.settings.HOST_FILE, 'w') as hosts:
166 for item in list(retval):
167 hosts.write(item)
168 if current_size != cleaned_size:
169 lib.output.info("cleaned {} duplicate IP address(es) (total of {})".format(
170 current_size - cleaned_size, cleaned_size
171 )
172 )
173 self.__reload()
174
175 def do_token_reset(self, api, token, username):
176 """

Callers 1

terminal_main_displayMethod · 0.95

Calls 1

__reloadMethod · 0.95

Tested by

no test coverage detected