Esempio n. 1
0
    def generate_random_url(self,):
        """Return a URL generated at random with the saved Canarytoken.
           The random URL is also saved into the Canarydrop."""
        sites = get_all_canary_sites()
        path_elements = get_all_canary_path_elements()
        pages = get_all_canary_pages()

        generated_url = sites[random.randint(0,len(sites)-1)]+'/'
        path = []
        for count in range(0,random.randint(1,4)):
            if len(path_elements) == 0:
                break

            elem = path_elements[random.randint(0,len(path_elements)-1)]
            path.append(elem)
            path_elements.remove(elem)
        path.append(self._drop['canarytoken'])

        path.append(pages[random.randint(0,len(pages)-1)])

        generated_url += '/'.join(path)

        self._drop['generated_url'] = generated_url

        return self._drop['generated_url']
Esempio n. 2
0
    def generate_random_url(self, ):
        """Return a URL generated at random with the saved Canarytoken.
           The random URL is also saved into the Canarydrop."""
        sites = get_all_canary_sites()
        path_elements = get_all_canary_path_elements()
        pages = get_all_canary_pages()

        generated_url = sites[random.randint(0, len(sites) - 1)] + '/'
        path = []
        for count in range(0, random.randint(1, 4)):
            if len(path_elements) == 0:
                break

            elem = path_elements[random.randint(0, len(path_elements) - 1)]
            path.append(elem)
            path_elements.remove(elem)
        path.append(self._drop['canarytoken'])

        path.append(pages[random.randint(0, len(pages) - 1)])

        generated_url += '/'.join(path)

        self._drop['generated_url'] = generated_url

        return self._drop['generated_url']
Esempio n. 3
0
 def render_GET(self, request):
     template = env.get_template('generate.html')
     sites_len = len(get_all_canary_sites())
     return template.render(settings=settings, sites_len=sites_len).encode('utf8')
Esempio n. 4
0
 def get_random_site(self,):
     sites = get_all_canary_sites()
     return sites[random.randint(0,len(sites)-1)]
Esempio n. 5
0
 def get_url_components(self,):
     return (get_all_canary_sites(), get_all_canary_path_elements(), get_all_canary_pages())
Esempio n. 6
0
 def get_random_site(self,):
     sites = get_all_canary_sites()
     return sites[random.randint(0,len(sites)-1)]
Esempio n. 7
0
 def render_GET(self, request):
     template = env.get_template('generate_new.html')
     sites_len = len(get_all_canary_sites())
     now = datetime.datetime.now()
     return template.render(settings=settings, sites_len=sites_len,
                            now=now).encode('utf8')