mirror of
https://github.com/nmap/nmap.git
synced 2026-02-09 23:16:32 +00:00
Merge Nmap 7.96 release branch
This commit is contained in:
@@ -111,7 +111,7 @@ class CrashReport(HIGDialog):
|
||||
) % {"app_name": escape(APP_DISPLAY_NAME)})
|
||||
self.email_frame = Gtk.Frame()
|
||||
self.email_label = Gtk.Label()
|
||||
self.email_label.set_markup(_('<b>Copy and <b>'
|
||||
self.email_label.set_markup(_('<b>Copy and '
|
||||
'<a href="https://issues.nmap.org/new/choose">'
|
||||
'open a bug report</a></b>:'))
|
||||
self.btn_copy = Gtk.Button.new_from_stock(Gtk.STOCK_COPY)
|
||||
|
||||
@@ -148,6 +148,10 @@ class ScanWindow(UmitScanWindow):
|
||||
self.set_default_size(window.width, window.height)
|
||||
|
||||
self.scan_interface = ScanInterface()
|
||||
# Update highlighting
|
||||
output_viewer = self.scan_interface.scan_result.scan_result_notebook.nmap_output.nmap_output
|
||||
output_viewer.nmap_highlight.set_dark_mode(
|
||||
ScanWindow.dark_mode)
|
||||
|
||||
self.main_accel_group = Gtk.AccelGroup()
|
||||
|
||||
@@ -790,6 +794,11 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
|
||||
settings = Gtk.Settings.get_default()
|
||||
settings.set_property("gtk-application-prefer-dark-theme",
|
||||
ScanWindow.dark_mode)
|
||||
# Update highlighting
|
||||
output_viewer = self.scan_interface.scan_result.scan_result_notebook.nmap_output.nmap_output
|
||||
output_viewer.nmap_highlight.set_dark_mode(
|
||||
ScanWindow.dark_mode)
|
||||
output_viewer.apply_highlighting()
|
||||
|
||||
|
||||
def _exit_cb(self, *args):
|
||||
|
||||
@@ -70,6 +70,11 @@ from zenmapCore.UmitConf import NmapOutputHighlight
|
||||
|
||||
from zenmapGUI.NmapOutputProperties import NmapOutputProperties
|
||||
|
||||
def _tag_set_colors(tag, text_color, highlight_color):
|
||||
fg = "rgb({},{},{})".format(*(x >> 8 for x in text_color))
|
||||
bg = "rgb({},{},{})".format(*(x >> 8 for x in highlight_color))
|
||||
tag.set_property("foreground", fg)
|
||||
tag.set_property("background", bg)
|
||||
|
||||
class NmapOutputViewer(Gtk.Box):
|
||||
HIGHLIGHT_PROPERTIES = ["details", "date", "hostname", "ip", "port_list",
|
||||
@@ -139,13 +144,7 @@ class NmapOutputViewer(Gtk.Box):
|
||||
else:
|
||||
tag.set_property("underline", Pango.Underline.NONE)
|
||||
|
||||
text_color = settings[3]
|
||||
highlight_color = settings[4]
|
||||
|
||||
tag.set_property(
|
||||
"foreground", Gdk.Color(*text_color).to_string())
|
||||
tag.set_property(
|
||||
"background", Gdk.Color(*highlight_color).to_string())
|
||||
_tag_set_colors(tag, settings[3], settings[4])
|
||||
|
||||
def go_to_host(self, host):
|
||||
"""Go to host line on nmap output result"""
|
||||
@@ -218,15 +217,18 @@ class NmapOutputViewer(Gtk.Box):
|
||||
return
|
||||
|
||||
text = buf.get_text(start_iter, end_iter, include_hidden_chars=True)
|
||||
tag_table = buf.get_tag_table()
|
||||
|
||||
for property in self.HIGHLIGHT_PROPERTIES:
|
||||
settings = self.nmap_highlight.__getattribute__(property)
|
||||
tag = tag_table.lookup(property)
|
||||
_tag_set_colors(tag, settings[3], settings[4])
|
||||
for m in re.finditer(settings[5], text, re.M):
|
||||
m_start_iter = start_iter.copy()
|
||||
m_start_iter.forward_chars(m.start())
|
||||
m_end_iter = start_iter.copy()
|
||||
m_end_iter.forward_chars(m.end())
|
||||
buf.apply_tag_by_name(property, m_start_iter, m_end_iter)
|
||||
buf.apply_tag(tag, m_start_iter, m_end_iter)
|
||||
|
||||
def show_nmap_output(self, output):
|
||||
"""Show the string (or unicode) output in the output display."""
|
||||
|
||||
Reference in New Issue
Block a user