mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Correct a bug in the code for NmapOutputViewer.go_to_host that was put in revision 32936.
The following steps caused the bug with the r32936 code:
1. Start a scan (say Quick Scan for simplicity) for a certain target (say A)
2. Wait for scan to complete
3. Start a scan for a different target (say B).
4. Wait for scan to complete
5. Click on host A in the Hosts list on the left (while scan B is still visible on the right)
6. BOOM!
This commit is contained in:
@@ -218,9 +218,13 @@ class NmapOutputViewer (gtk.VBox):
|
|||||||
buff = self.text_view.get_buffer()
|
buff = self.text_view.get_buffer()
|
||||||
start_iter = buff.get_start_iter()
|
start_iter = buff.get_start_iter()
|
||||||
|
|
||||||
found = start_iter.forward_search(
|
found_tuple = start_iter.forward_search(
|
||||||
"\nNmap scan report for %s\n" % host, gtk.TEXT_SEARCH_TEXT_ONLY
|
"\nNmap scan report for %s\n" % host, gtk.TEXT_SEARCH_TEXT_ONLY
|
||||||
)[0]
|
)
|
||||||
|
if found_tuple is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
found = found_tuple[0]
|
||||||
if not found.forward_line():
|
if not found.forward_line():
|
||||||
return
|
return
|
||||||
self.text_view.scroll_to_iter(found, 0, True, 0, 0)
|
self.text_view.scroll_to_iter(found, 0, True, 0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user