mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Merge Nmap 7.96 release branch
This commit is contained in:
@@ -5,19 +5,19 @@ test "x$UNDER_JHBUILD" = "x" && exit 1
|
||||
|
||||
# make-bundle.sh
|
||||
APP_NAME=Zenmap
|
||||
ZENMAP_DIST_DIR=$PWD/dist
|
||||
ZENMAP_BUILD_DIR=$PWD/build
|
||||
ZENMAP_DIST_DIR=${1:-zenmap-root}
|
||||
|
||||
export ZENMAP_DIST_DIR
|
||||
export ZENMAP_BUILD_DIR
|
||||
|
||||
BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents
|
||||
SCRIPT_DIR=`dirname "$0"`
|
||||
ZENMAP_DIR="$SCRIPT_DIR/../.."
|
||||
NDIFF_DIR="$ZENMAP_DIR/../ndiff"
|
||||
|
||||
echo "Running $0."
|
||||
|
||||
echo "Removing old build."
|
||||
rm -rf "$ZENMAP_DIST_DIR" "$ZENMAP_BUILD_DIR"
|
||||
rm -rf "$ZENMAP_DIST_DIR"
|
||||
|
||||
echo "Building python-launcher"
|
||||
$CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags --embed` \
|
||||
@@ -25,7 +25,8 @@ $CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags
|
||||
~/gtk-mac-bundler/examples/python-launcher.c
|
||||
|
||||
echo "Installing Zenmap to local system"
|
||||
python3 -m pip install --no-deps --force-reinstall .
|
||||
python3 -m pip install --no-deps --force-reinstall "$ZENMAP_DIR"
|
||||
python3 -m pip install --no-deps --force-reinstall "$NDIFF_DIR"
|
||||
|
||||
echo "Generating dependencies"
|
||||
# Have to run this with ~/gtk/inst/python3 or deps have wrong paths
|
||||
@@ -62,13 +63,15 @@ popd
|
||||
|
||||
# echo "Compiling Python to bytecode"
|
||||
PYTHONLIB=$(ls -d $BASE/Resources/lib/python3.*)
|
||||
cp "$PREFIX"/${PYTHONLIB#$BASE/Resources/}/site-packages/ndiff.py "$PYTHONLIB/site-packages/"
|
||||
|
||||
# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
|
||||
# See PEP-3147
|
||||
find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
|
||||
python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB"
|
||||
python -m compileall -b -x 'ndiff|zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB"
|
||||
|
||||
# Remove source if compiled is available, except for Zenmap itself:
|
||||
find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
|
||||
find "$PYTHONLIB" \( -name 'ndiff.py' -o -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
|
||||
rm -f "${pyc%.pyc}.py"
|
||||
done
|
||||
|
||||
@@ -100,3 +103,14 @@ with open(sys.argv[1],"r",encoding="utf-8") as f:
|
||||
APP_COPYRIGHT=APP_COPYRIGHT
|
||||
))
|
||||
EOF
|
||||
|
||||
mkdir -p "$BASE/Resources/bin"
|
||||
zenmap_cmd="$BASE/Resources/bin/zenmap"
|
||||
|
||||
cat >"$zenmap_cmd" <<'EOF'
|
||||
#!/bin/sh
|
||||
open -a Zenmap "$@"
|
||||
EOF
|
||||
chmod 755 "$zenmap_cmd"
|
||||
|
||||
cp "$PREFIX/bin/ndiff" "$BASE/Resources/bin/ndiff"
|
||||
|
||||
@@ -396,14 +396,20 @@ class CommandProfile (Profile, object):
|
||||
class NmapOutputHighlight(object):
|
||||
setts = ["bold", "italic", "underline", "text", "highlight", "regex"]
|
||||
|
||||
def __init__(self):
|
||||
self.dark_mode = False
|
||||
|
||||
def save_changes(self):
|
||||
config_parser.save_changes()
|
||||
|
||||
def set_dark_mode(self, mode=True):
|
||||
self.dark_mode = mode
|
||||
|
||||
def __get_it(self, p_name):
|
||||
property_name = "%s_highlight" % p_name
|
||||
|
||||
try:
|
||||
return self.sanity_settings([
|
||||
settings = self.sanity_settings([
|
||||
config_parser.get(
|
||||
property_name, prop, raw=True) for prop in self.setts])
|
||||
except Exception:
|
||||
@@ -418,7 +424,12 @@ class NmapOutputHighlight(object):
|
||||
|
||||
self.__set_it(p_name, settings)
|
||||
|
||||
return settings
|
||||
if self.dark_mode:
|
||||
for i in (0, 1, 2):
|
||||
settings[3][i] = (65535 - settings[3][i]) % 65536
|
||||
settings[4][i] = (65535 - settings[4][i]) % 65536
|
||||
|
||||
return settings
|
||||
|
||||
def __set_it(self, property_name, settings):
|
||||
property_name = "%s_highlight" % property_name
|
||||
|
||||
@@ -1 +1 @@
|
||||
VERSION = "7.95+SVN"
|
||||
VERSION = "7.96"
|
||||
|
||||
@@ -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