'Generate the URL to include, based on the configuration it will return a
URL pointing to a XSS bug, or our local webserver.'

def _gen_url_to_include(self, file_content, extension):

    if (self._use_XSS_vuln and self._xss_vuln):
        mutant = self._xss_vuln.get_mutant()
        mutant = mutant.copy()
        mutant.set_token_value(file_content)
        return mutant.get_uri().url_string
    else:
        filename = rand_alnum()
        filepath = os.path.join(get_home_dir(), 'webroot', filename)
        try:
            file_handler = open(filepath, 'w')
            file_handler.write(file_content)
            file_handler.close()
        except:
            raise BaseFrameworkException('Could    not    create    file    in    webroot.')
        else:
            url_to_include = ('http://%s:%s/%s' % (self._listen_address, self._listen_port, filename))
            return url_to_include
