[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #4097 [Torflow]: KeyError in self.node_map[exit_node[1:]]



#4097: KeyError in self.node_map[exit_node[1:]]
---------------------+------------------------------------------------------
 Reporter:  aagbsn   |          Owner:  mikeperry
     Type:  defect   |         Status:  new      
 Priority:  normal   |      Milestone:           
Component:  Torflow  |        Version:           
 Keywords:           |         Parent:           
   Points:           |   Actualpoints:           
---------------------+------------------------------------------------------
Changes (by aagbsn):

 * cc: aagbsn@â (added)


Comment:

 maybe get_search_urls_for_filetype(self, filetype, number) does not return
 a tuple and is used inconsistently by SearchBasedHTTPTest.refill_targets()
 {{{
 #!python
   def refill_targets(self):
     for ftype in self.scan_filetypes:
       targets_needed = self.results_per_type -
 len(self.targets.bykey(ftype))
       if targets_needed > 0:
         plog("NOTICE", self.proto+" scanner short on "+ftype+" targets.
 Adding more")
         map(self.add_target,
 self.get_search_urls_for_filetype(ftype,targets_needed))
 }}}

 for comparison, see SearchBasedHTTPTest.get_targets():

 {{{
 #!python
   def get_targets(self):
     '''
     construct a list of urls based on the wordlist, filetypes and
 protocol.
     '''
     plog('INFO', 'Searching for relevant sites...')

     urllist = set([])
     for filetype in self.scan_filetypes:
       urllist.update(map(lambda x: (x, filetype),
 self.get_search_urls_for_filetype(filetype, self.results_per_type)))

     return list(urllist)
 }}}

 Testing the following modification:

 {{{
 #!python
 index be0dde0..aabb3e4 100755
 --- a/NetworkScanners/ExitAuthority/soat.py
 +++ b/NetworkScanners/ExitAuthority/soat.py
 @@ -1883,9 +1883,12 @@ class SearchBasedHTTPTest(SearchBasedTest,
 BaseHTTPTest):
    def refill_targets(self):
      for ftype in self.scan_filetypes:
        targets_needed = self.results_per_type -
 len(self.targets.bykey(ftype))
 +      urllist = set([])
        if targets_needed > 0:
          plog("NOTICE", self.proto+" scanner short on "+ftype+" targets.
 Adding more")
 -        map(self.add_target,
 self.get_search_urls_for_filetype(ftype,targets_needed))
 +        #map(self.add_target,
 self.get_search_urls_for_filetype(ftype,targets_needed))
 +        urllist.update(map(lambda x: (x, ftype),
 self.get_search_urls_for_filetype(ftype, targets_needed)))
 +        map(self.add_target, urllist)
 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4097#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs