1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 12:41:29 +00:00
Files
nmap/zenmap/install_scripts/macosx/test_wrapper.py
david ed2ba4e168 Copy nping, nsock, nbase, zenmap, ncat from their homes in /.
If you have trouble updating after this revision you need to follow
these instructions. You have probably just seen an error like this:

svn: URL 'svn://svn.insecure.org/nping' of existing directory 'nping'
does not match expected URL 'svn://svn.insecure.org/nmap/nping'

This is caused by the replacement of SVN externals.

Here's what you need to do. First, save any local changes you might have
in the nping, nsock, nbase, ncat, and zenmap directories. (For example
by running "cd nping; svn diff > ../nping.diff".) If you don't have any
local changes you can skip this step.

Then run these commands:

rm -rf nping/ nsock/ nbase/ ncat/ zenmap/
svn update
svn cleanup

If all else fails, you can just delete your whole working directory and
check out anew:

svn co --username guest --password "" svn://svn.insecure.org/nmap

There may be further discussion in the mailing list thread at
http://seclists.org/nmap-dev/2011/q4/303.
2011-11-16 21:49:44 +00:00

33 lines
984 B
Python
Executable File

#!/usr/bin/env python
# This is a test class for the non-trivial escaping done by zenmap_wrapper.py.
import unittest
import zenmap_wrapper
class test_key_file(unittest.TestCase):
def test_escape(self):
TESTS = (
("", ""),
("a", "a"),
("a\nb\tc\rd\\e", "a\\nb\\tc\\rd\\\\e"),
("a\"b", "a\"b")
)
for test_line, expected in TESTS:
actual = zenmap_wrapper.escape_key_file_value(test_line)
self.assertEqual(expected, actual)
def test_escape_first_space(self):
# Check first-character space escaping.
self.assert_(zenmap_wrapper.escape_key_file_value(" abc").startswith("\\s"))
def test_substitute(self):
original = "abc"
replacements = {"b": "\"\\\t\r\ndef"}
expected = "a\"\\\\\\t\\r\\ndefc"
actual = zenmap_wrapper.substitute_key_file_line(original, replacements)
self.assertEqual(expected, actual)
unittest.main()