Esempio n. 1
0
 def get_asyncrequest_to_id(self, current_session, async_id):
     raw_data = self.async_requests.find_one({
         "session": current_session,
         "_id": async_id
     })
     if raw_data is None:
         return None
     raw_structure = self.async_request_structure.find_one({
         "session":
         current_session,
         "request_hash":
         raw_data['request_hash']
     })
     structure = AsyncRequestStructure(raw_structure['request_hash'],
                                       raw_structure['parameters'])
     url = Url(raw_data['url']['url'])
     url.abstract_url = raw_data['url']['abstract_url']
     if "event" in raw_data:
         tmp = TimingRequest(raw_data['method'],
                             url,
                             None,
                             raw_data['event'],
                             parameters=raw_data['parameters'])
         tmp.request_structure = structure
     else:
         trigger = self.clickables.find_one({"_id": raw_data['trigger']})
         trigger = self._parse_clickable_from_db_to_model(trigger)
         tmp = AjaxRequest(raw_data['method'],
                           url,
                           trigger,
                           parameters=raw_data['parameters'])
         tmp.request_structure = structure
     return tmp
Esempio n. 2
0
 def _parse_link_from_db(self, link):
     url = Url(link['url']['url'])
     url.abstract_url = link['url']['abstract_url']
     url.depth_of_finding = link['url']['depth_of_finding']
     result = Link(url, link['dom_address'], link['html_id'],
                   link['html_class'])
     return result
Esempio n. 3
0
 def _parse_form_from_db(self, form):
     parameters = []
     for p in form['parameters']:
         form_input = FormInput(p['tag'], p['name'], p['input_type'], p['values'])
         parameters.append(form_input)
     action = Url(form['action']["url"])
     action.abstract_url = form['action']["abstract_url"]
     return HtmlForm(parameters, action, form['method'], form["dom_address"])
Esempio n. 4
0
 def _parse_form_from_db(self, form):
     parameters = []
     for p in form['parameters']:
         form_input = FormInput(p['tag'], p['name'], p['input_type'],
                                p['values'])
         parameters.append(form_input)
     action = Url(form['action']["url"])
     action.abstract_url = form['action']["abstract_url"]
     return HtmlForm(parameters, action, form['method'],
                     form["dom_address"])
    def handle_url(self, new_url, requested_url):
        if not isinstance(new_url, Url):
            new_url = Url(new_url)
        if requested_url is not None:
            if not isinstance(requested_url, Url):
                requested_url = Url(requested_url)
            new_url.abstract_url = self.calculate_abstract_url(new_url, requested_url)

        if not self.database_manager.url_exists(new_url):
            new_url.url_structure = self.calculate_url_structure(new_url)
        return new_url
Esempio n. 6
0
 def get_asyncrequest_to_id(self, current_session, async_id):
     raw_data = self.async_requests.find_one({"session": current_session, "_id": async_id})
     if raw_data is None:
         return None
     raw_structure = self.async_request_structure.find_one({"session": current_session, "request_hash": raw_data['request_hash']})
     structure = AsyncRequestStructure(raw_structure['request_hash'], raw_structure['parameters'])
     url = Url(raw_data['url']['url'])
     url.abstract_url = raw_data['url']['abstract_url']
     if "event" in raw_data:
         tmp = TimingRequest(raw_data['method'], url, None, raw_data['event'], parameters=raw_data['parameters'])
         tmp.request_structure = structure
     else:
         trigger = self.clickables.find_one({"_id": raw_data['trigger']})
         trigger = self._parse_clickable_from_db_to_model(trigger)
         tmp = AjaxRequest(raw_data['method'], url, trigger, parameters=raw_data['parameters'])
         tmp.request_structure = structure
     return tmp
Esempio n. 7
0
 def _parse_url_from_db(self, url):
     result = Url(url['url'], url['depth_of_finding'])
     result.parameters = self.unescape_unloved_signs(result.parameters)
     result.abstract_url = url["abstract_url"]
     return result
Esempio n. 8
0
 def _parse_link_from_db(self, link):
     url = Url(link['url']['url'])
     url.abstract_url = link['url']['abstract_url']
     url.depth_of_finding = link['url']['depth_of_finding']
     result = Link(url, link['dom_address'], link['html_id'], link['html_class'])
     return result
Esempio n. 9
0
 def _parse_url_from_db(self, url):
     result = Url(url['url'], url['depth_of_finding'])
     result.parameters = self.unescape_unloved_signs(result.parameters)
     result.abstract_url = url["abstract_url"]
     return result