diff --git a/zenmap/radialnet/gui/HostsViewer.py b/zenmap/radialnet/gui/HostsViewer.py index 657acc31c..ac573c4b2 100644 --- a/zenmap/radialnet/gui/HostsViewer.py +++ b/zenmap/radialnet/gui/HostsViewer.py @@ -135,7 +135,7 @@ HOSTS_HEADER = ['ID', '#', 'Hosts'] DIMENSION = (700, 400) -IP_RE = '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' +IP_RE = re.compile('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$') class HostsViewer(BWMainWindow): @@ -275,8 +275,8 @@ class HostsList(gtk.ScrolledWindow): value1 = treemodel.get_value(iter1, 2) value2 = treemodel.get_value(iter2, 2) - value1_is_ip = re.search(IP_RE, value1) - value2_is_ip = re.search(IP_RE, value2) + value1_is_ip = IP_RE.match(value1) + value2_is_ip = IP_RE.match(value2) if value1_is_ip and value2_is_ip: return ipv4_compare(value1, value2) diff --git a/zenmap/radialnet/util/integration.py b/zenmap/radialnet/util/integration.py index 8a1c4a39b..ed54475f6 100644 --- a/zenmap/radialnet/util/integration.py +++ b/zenmap/radialnet/util/integration.py @@ -124,7 +124,6 @@ from radialnet.gui.RadialNet import NetNode import zenmapCore.NmapParser import math -import re COLORS = [(0.0, 1.0, 0.0), diff --git a/zenmap/zenmapCore/NetworkInventory.py b/zenmap/zenmapCore/NetworkInventory.py index 2c3d326e6..b99b3434b 100644 --- a/zenmap/zenmapCore/NetworkInventory.py +++ b/zenmap/zenmapCore/NetworkInventory.py @@ -121,7 +121,6 @@ # ***************************************************************************/ import os -import re import unittest import zenmapCore import zenmapCore.NmapParser diff --git a/zenmap/zenmapCore/NmapCommand.py b/zenmap/zenmapCore/NmapCommand.py index 99bd65c60..94bbd0d4c 100644 --- a/zenmap/zenmapCore/NmapCommand.py +++ b/zenmap/zenmapCore/NmapCommand.py @@ -128,7 +128,6 @@ import errno import locale import sys import os -import re import tempfile import unittest diff --git a/zenmap/zenmapCore/NmapParser.py b/zenmap/zenmapCore/NmapParser.py index b7ee816a2..db2716e94 100644 --- a/zenmap/zenmapCore/NmapParser.py +++ b/zenmap/zenmapCore/NmapParser.py @@ -120,7 +120,6 @@ # * * # ***************************************************************************/ -import re import locale import os import os.path diff --git a/zenmap/zenmapCore/UmitOptionParser.py b/zenmap/zenmapCore/UmitOptionParser.py index dce584d6d..b7ac7d458 100644 --- a/zenmap/zenmapCore/UmitOptionParser.py +++ b/zenmap/zenmapCore/UmitOptionParser.py @@ -120,8 +120,6 @@ # * * # ***************************************************************************/ -import re - from optparse import OptionParser from zenmapCore.Name import APP_NAME, NMAP_DISPLAY_NAME from zenmapCore.Version import VERSION diff --git a/zenmap/zenmapGUI/ScanInterface.py b/zenmap/zenmapGUI/ScanInterface.py index f80ba58f6..fca7231d9 100644 --- a/zenmap/zenmapGUI/ScanInterface.py +++ b/zenmap/zenmapGUI/ScanInterface.py @@ -124,7 +124,6 @@ import errno import gtk import gobject import os -import re import time import xml.sax diff --git a/zenmap/zenmapGUI/ScriptInterface.py b/zenmap/zenmapGUI/ScriptInterface.py index 1d495aa72..86a2cd2d4 100644 --- a/zenmap/zenmapGUI/ScriptInterface.py +++ b/zenmap/zenmapGUI/ScriptInterface.py @@ -125,7 +125,6 @@ import gobject import gtk import sys import tempfile -import re import xml.sax from zenmapGUI.higwidgets.higwindows import HIGWindow