1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Spellcheck on all Python files

This commit is contained in:
dmiller
2014-02-20 21:22:30 +00:00
parent 1575c63d7d
commit a72faf3906
21 changed files with 75 additions and 75 deletions

View File

@@ -517,8 +517,8 @@ def host_pairs(a, b):
class ScanDiff(object): class ScanDiff(object):
"""An abtract class for different diff output types. Subclasses must define """An abstract class for different diff output types. Subclasses must
various output methods.""" define various output methods."""
def __init__(self, scan_a, scan_b, f=sys.stdout): def __init__(self, scan_a, scan_b, f=sys.stdout):
"""Create a ScanDiff from the "before" scan_a and the "after" """Create a ScanDiff from the "before" scan_a and the "after"
scan_b.""" scan_b."""

View File

@@ -319,7 +319,7 @@ def print_parseable_sent_packet(test_number, test_packet, ip_version):
else : else :
print_and_store_line(tag + "={"+str(test_number)+", " + "0" +", " + hexstr(str(test_packet), onlyhex=1) + "}") print_and_store_line(tag + "={"+str(test_number)+", " + "0" +", " + hexstr(str(test_packet), onlyhex=1) + "}")
def print_parseable_time_dependant_test_result(test_number, response, ip_version): def print_parseable_time_dependent_test_result(test_number, response, ip_version):
if ip_version==4 : if ip_version==4 :
tag="timed4_result" tag="timed4_result"
else : else :
@@ -353,7 +353,7 @@ def print_welcome_banner():
print " " print " "
print " We'd like to thank you in advance for running this tool. After " print " We'd like to thank you in advance for running this tool. After "
print " the execution has finished, a file with the following name " print " the execution has finished, a file with the following name "
print " will be sted in the working directory: " print " will be created in the working directory: "
print " " print " "
print output_file_name_g.center(65) print output_file_name_g.center(65)
print " " print " "
@@ -809,7 +809,7 @@ def filter_responses(sent, received):
# If we get here (we have not "break"ed the loop), it means that we # If we get here (we have not "break"ed the loop), it means that we
# did not find any standard response. Now check for ICMP errors. # did not find any standard response. Now check for ICMP errors.
# We do a very soft matching. We can probably make mistakes here if # We do a very soft matching. We can probably make mistakes here if
# we send many packets and we get many different resposnes, but this # we send many packets and we get many different responses, but this
# is not a common case in ipv6fp.py, so we should be fine. # is not a common case in ipv6fp.py, so we should be fine.
for i in range(0, len(response_set)) : for i in range(0, len(response_set)) :
@@ -839,7 +839,7 @@ def filter_responses(sent, received):
if response_set[i][IPerror6].src==sent_probe.src: if response_set[i][IPerror6].src==sent_probe.src:
if response_set[i][IPerror6].dst==sent_probe.dst: if response_set[i][IPerror6].dst==sent_probe.dst:
if response_set[i][IPerror6].nh==sent_probe.nh: if response_set[i][IPerror6].nh==sent_probe.nh:
print_debug("TimeExceede MATCH") print_debug("TimeExceeded MATCH")
final_results.append( [sent_probe, response_set[i]] ) final_results.append( [sent_probe, response_set[i]] )
match=response_set[i] match=response_set[i]
break break
@@ -969,7 +969,7 @@ def sndrcv_ng(pkt, timeout=1, iface=None, inter = 0, verbose=1, retry=0, multi=0
elif pid < 0: elif pid < 0:
print "ERROR: unable to fork()" print "ERROR: unable to fork()"
# Packet recption child # Packet reception child
else: else:
print_debug("Reception Child") print_debug("Reception Child")
cap_pkts=sniff(timeout=timeout) cap_pkts=sniff(timeout=timeout)
@@ -1032,7 +1032,7 @@ def send_and_receive_eth(packet, verbosity=1):
return responses return responses
# Note that this function does NOT strip the ethernet header of the returned (answered, unsanswered) set. # Note that this function does NOT strip the ethernet header of the returned (answered, unanswered) set.
def send_and_receive_eth_multiple(packet, verbosity=1): def send_and_receive_eth_multiple(packet, verbosity=1):
# Send packet and get response # Send packet and get response
@@ -1136,11 +1136,11 @@ def run_test_multiple(test_number_base, test_id, test_description, test_packet,
if type(responses[0][i][1])==scapy.layers.l2.Ether : if type(responses[0][i][1])==scapy.layers.l2.Ether :
print_received_packet(responses[0][i][1].payload) print_received_packet(responses[0][i][1].payload)
myresponses.append(responses[0][i][1].payload) myresponses.append(responses[0][i][1].payload)
print_parseable_time_dependant_test_result(test_number_base+i, responses[0][i][1].payload, ip_version) print_parseable_time_dependent_test_result(test_number_base+i, responses[0][i][1].payload, ip_version)
else: else:
print_received_packet(responses[0][i][1]) print_received_packet(responses[0][i][1])
myresponses.append(responses[0][i][1]) myresponses.append(responses[0][i][1])
print_parseable_time_dependant_test_result(test_number_base+i, responses[0][i][1], ip_version) print_parseable_time_dependent_test_result(test_number_base+i, responses[0][i][1], ip_version)
# Cleanup and return # Cleanup and return
print_end_separator() print_end_separator()
@@ -1714,7 +1714,7 @@ def set_up_ipv6_tests(target):
# TEST 42 # TEST 42
test6_ids.append("ICMP_NI_Query_0") test6_ids.append("ICMP_NI_Query_0")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=1, Payload='.' (root) in DNS format") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=1, Payload='.' (root) in DNS format")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1 icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1
@@ -1728,7 +1728,7 @@ def set_up_ipv6_tests(target):
# TEST 43 # TEST 43
test6_ids.append("ICMP_NI_Query_1") test6_ids.append("ICMP_NI_Query_1")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=1, Payload=localhost (in DNS format)") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=1, Payload=localhost (in DNS format)")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1 icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1
@@ -1742,7 +1742,7 @@ def set_up_ipv6_tests(target):
# TEST 44 # TEST 44
test6_ids.append("ICMP_NI_Query_2") test6_ids.append("ICMP_NI_Query_2")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=1, Payload=Bogus DNS formatted name (label length>63)") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=1, Payload=Bogus DNS formatted name (label length>63)")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1 icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1
@@ -1756,7 +1756,7 @@ def set_up_ipv6_tests(target):
# TEST 45 # TEST 45
test6_ids.append("ICMP_NI_Query_3") test6_ids.append("ICMP_NI_Query_3")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=1, Payload=Bogus DNS formatted name (Characters missing)") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=1, Payload=Bogus DNS formatted name (Characters missing)")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1 icmp_packet.code=1 # RFC: On transmission, the ICMPv6 Code in a NOOP Query must be set to 1
@@ -1770,7 +1770,7 @@ def set_up_ipv6_tests(target):
# TEST 46 # TEST 46
test6_ids.append("ICMP_NI_Query_4") test6_ids.append("ICMP_NI_Query_4")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=0, Subject Addr=::0") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=0, Subject Addr=::0")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0 # This is forbidden by RFC 4620 icmp_packet.code=0 # This is forbidden by RFC 4620
@@ -1784,7 +1784,7 @@ def set_up_ipv6_tests(target):
# TEST 47 # TEST 47
test6_ids.append("ICMP_NI_Query_5") test6_ids.append("ICMP_NI_Query_5")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=0, Subject Addr=target's") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=0, Subject Addr=target's")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0 # IPv6 Address. Using this in NOOP is forbidden by RFC 4620 icmp_packet.code=0 # IPv6 Address. Using this in NOOP is forbidden by RFC 4620
@@ -1798,7 +1798,7 @@ def set_up_ipv6_tests(target):
# TEST 48 # TEST 48
test6_ids.append("ICMP_NI_Query_6") test6_ids.append("ICMP_NI_Query_6")
test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/IMCP Code=0xAB (unknown), Payload=0x00") test6_descriptions.append("ICMP/NI Query NOOP/Dst=target/ICMP Code=0xAB (unknown), Payload=0x00")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0xAB # This one is also forbidden by RFC 4620 icmp_packet.code=0xAB # This one is also forbidden by RFC 4620
@@ -1812,7 +1812,7 @@ def set_up_ipv6_tests(target):
# TEST 49 # TEST 49
test6_ids.append("ICMP_NI_Query_7") test6_ids.append("ICMP_NI_Query_7")
test6_descriptions.append("ICMP/NI Query Unused/Dst=target/IMCP Code=1, Payload=localhost") test6_descriptions.append("ICMP/NI Query Unused/Dst=target/ICMP Code=1, Payload=localhost")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=1 # DNS name icmp_packet.code=1 # DNS name
@@ -1826,7 +1826,7 @@ def set_up_ipv6_tests(target):
# TEST 50 # TEST 50
test6_ids.append("ICMP_NI_Query_8") test6_ids.append("ICMP_NI_Query_8")
test6_descriptions.append("ICMP/NI Query Unused/Dst=target/IMCP Code=0, Payload=target's addr") test6_descriptions.append("ICMP/NI Query Unused/Dst=target/ICMP Code=0, Payload=target's addr")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0 # IPv6 Address icmp_packet.code=0 # IPv6 Address
@@ -1840,7 +1840,7 @@ def set_up_ipv6_tests(target):
# TEST 51 # TEST 51
test6_ids.append("ICMP_NI_Query_9") test6_ids.append("ICMP_NI_Query_9")
test6_descriptions.append("ICMP/NI Query Node Name/Dst=target/IMCP Code=1, Name=localhost") test6_descriptions.append("ICMP/NI Query Node Name/Dst=target/ICMP Code=1, Name=localhost")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryName() icmp_packet=ICMPv6NIQueryName()
icmp_packet.code=1 # DNS Name icmp_packet.code=1 # DNS Name
@@ -1854,7 +1854,7 @@ def set_up_ipv6_tests(target):
# TEST 52 # TEST 52
test6_ids.append("ICMP_NI_Query_10") test6_ids.append("ICMP_NI_Query_10")
test6_descriptions.append("ICMP/NI Query Node Name/Dst=target/IMCP Code=0, Addr=target's") test6_descriptions.append("ICMP/NI Query Node Name/Dst=target/ICMP Code=0, Addr=target's")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryName() icmp_packet=ICMPv6NIQueryName()
icmp_packet.code=0 # IPv6 Addr icmp_packet.code=0 # IPv6 Addr
@@ -1868,7 +1868,7 @@ def set_up_ipv6_tests(target):
# TEST 53 # TEST 53
test6_ids.append("ICMP_NI_Query_11") test6_ids.append("ICMP_NI_Query_11")
test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/IMCP Code=0, Addr=target's, Flags=All addresses") test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/ICMP Code=0, Addr=target's, Flags=All addresses")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryIPv6() icmp_packet=ICMPv6NIQueryIPv6()
icmp_packet.code=0 # IPv6 Addr icmp_packet.code=0 # IPv6 Addr
@@ -1882,7 +1882,7 @@ def set_up_ipv6_tests(target):
# TEST 54 # TEST 54
test6_ids.append("ICMP_NI_Query_12") test6_ids.append("ICMP_NI_Query_12")
test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/IMCP Code=0, Addr=target's, Flags=None") test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/ICMP Code=0, Addr=target's, Flags=None")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryIPv6() icmp_packet=ICMPv6NIQueryIPv6()
icmp_packet.code=0 # IPv6 Addr icmp_packet.code=0 # IPv6 Addr
@@ -1896,7 +1896,7 @@ def set_up_ipv6_tests(target):
# TEST 55 # TEST 55
test6_ids.append("ICMP_NI_Query_13") test6_ids.append("ICMP_NI_Query_13")
test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/IMCP Code=0, Name=localhost, Flags=All") test6_descriptions.append("ICMP/NI Query Node Addresses IPv6/Dst=target/ICMP Code=0, Name=localhost, Flags=All")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryIPv6() icmp_packet=ICMPv6NIQueryIPv6()
icmp_packet.code=1 # DNS Name icmp_packet.code=1 # DNS Name
@@ -1910,7 +1910,7 @@ def set_up_ipv6_tests(target):
# TEST 56 # TEST 56
test6_ids.append("ICMP_NI_Query_14") test6_ids.append("ICMP_NI_Query_14")
test6_descriptions.append("ICMP/NI Query Node Addresses IPv4/Dst=target/IMCP Code=0, Name=localhost, Flags='A'") test6_descriptions.append("ICMP/NI Query Node Addresses IPv4/Dst=target/ICMP Code=0, Name=localhost, Flags='A'")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryIPv4() icmp_packet=ICMPv6NIQueryIPv4()
icmp_packet.code=1 # DNS Name icmp_packet.code=1 # DNS Name
@@ -1924,7 +1924,7 @@ def set_up_ipv6_tests(target):
# TEST 57 # TEST 57
test6_ids.append("ICMP_NI_Query_15") test6_ids.append("ICMP_NI_Query_15")
test6_descriptions.append("ICMP/NI Query Node Addresses IPv4/Dst=target/IMCP Code=0, Addr=target's, Flags='A'") test6_descriptions.append("ICMP/NI Query Node Addresses IPv4/Dst=target/ICMP Code=0, Addr=target's, Flags='A'")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryIPv4() icmp_packet=ICMPv6NIQueryIPv4()
icmp_packet.code=0 # IPv6 Addr icmp_packet.code=0 # IPv6 Addr
@@ -1938,7 +1938,7 @@ def set_up_ipv6_tests(target):
# TEST 58 # TEST 58
test6_ids.append("ICMP_NI_Query_16") test6_ids.append("ICMP_NI_Query_16")
test6_descriptions.append("ICMP/NI Query Bogus Op code/Dst=target/IMCP Code=0, Addr=target's") test6_descriptions.append("ICMP/NI Query Bogus Op code/Dst=target/ICMP Code=0, Addr=target's")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0 # IPv6 Addr icmp_packet.code=0 # IPv6 Addr
@@ -1952,7 +1952,7 @@ def set_up_ipv6_tests(target):
# TEST 59 # TEST 59
test6_ids.append("ICMP_NI_Query_17") test6_ids.append("ICMP_NI_Query_17")
test6_descriptions.append("ICMP/NI Query Bogus Op code/Dst=target/IMCP Code=Bogus") test6_descriptions.append("ICMP/NI Query Bogus Op code/Dst=target/ICMP Code=Bogus")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
icmp_packet=ICMPv6NIQueryNOOP() icmp_packet=ICMPv6NIQueryNOOP()
icmp_packet.code=0xFB # Bogus icmp_packet.code=0xFB # Bogus
@@ -1985,7 +1985,7 @@ def set_up_ipv6_tests(target):
test6_descriptions.append("IPv6/ExtHdr DestOpts {Opts Empty} / No next Header") test6_descriptions.append("IPv6/ExtHdr DestOpts {Opts Empty} / No next Header")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
ext_hdr=IPv6ExtHdrDestOpt() ext_hdr=IPv6ExtHdrDestOpt()
ext_hdr.nh=59 # No Next HEader ext_hdr.nh=59 # No Next Header
final_packet=ip_packet/ext_hdr final_packet=ip_packet/ext_hdr
test6_packets.append(final_packet) test6_packets.append(final_packet)
@@ -2380,7 +2380,7 @@ def set_up_ipv6_tests(target):
frag_hdr_2.offset=1 # 1=8 octets frag_hdr_2.offset=1 # 1=8 octets
frag_hdr_2.id=0x34567812 frag_hdr_2.id=0x34567812
frag_hdr_2.nh=58 # ICMPv6 frag_hdr_2.nh=58 # ICMPv6
payload="\xFF\xFF\x00\x00"*10 # Checksum collision (sabe cksum as "\x00\x00\xFF\xFF"*10 ) payload="\xFF\xFF\x00\x00"*10 # Checksum collision (same cksum as "\x00\x00\xFF\xFF"*10 )
final_packet_2=ip_packet_2/frag_hdr_2/payload final_packet_2=ip_packet_2/frag_hdr_2/payload
finals_t88=[final_packet_1, final_packet_2] finals_t88=[final_packet_1, final_packet_2]
test6_packets.append(finals_t88) test6_packets.append(finals_t88)
@@ -2588,7 +2588,7 @@ def set_up_ipv6_tests(target):
# #
# Code: 0 # Code: 0
# Pointer: high-order octet of the IPv6 Payload Length # Pointer: high-order octet of the IPv6 Payload Length
test6_descriptions.append("IPv6 with PLEN=0/Hop-by-hop withotu Jumbo Payload") test6_descriptions.append("IPv6 with PLEN=0/Hop-by-hop without Jumbo Payload")
ip_packet=build_default_ipv6(target) ip_packet=build_default_ipv6(target)
ext_1=IPv6ExtHdrHopByHop() ext_1=IPv6ExtHdrHopByHop()
icmp_packet=build_default_icmpv6() icmp_packet=build_default_icmpv6()
@@ -3597,7 +3597,7 @@ def run_all_tests(target6, target4, from_test, to_test):
test4_replies.append(res) test4_replies.append(res)
time.sleep(inter_test_delay_g) # Wait for a bit before the next test time.sleep(inter_test_delay_g) # Wait for a bit before the next test
def run_timing_dependant_tests() : def run_timing_dependent_tests() :
global inter_packet_delay_g global inter_packet_delay_g
# Select the appropriate packets # Select the appropriate packets
@@ -3609,9 +3609,9 @@ def run_timing_dependant_tests() :
inter_packet_delay_g=0.1 # 100ms inter_packet_delay_g=0.1 # 100ms
if target_host6_g!=None : if target_host6_g!=None :
run_test_multiple(1000, "IPv6_NmapProbes_100ms", "Time dependant IPv6 probes", packets6, 6) run_test_multiple(1000, "IPv6_NmapProbes_100ms", "Time dependent IPv6 probes", packets6, 6)
if target_host4_g!=None : if target_host4_g!=None :
run_test_multiple(2000, "IPv4_NmapProbes_100ms", "Time dependant IPv4 probes", packets4, 4) run_test_multiple(2000, "IPv4_NmapProbes_100ms", "Time dependent IPv4 probes", packets4, 4)
# Restore original inter packet delay # Restore original inter packet delay
inter_packet_delay_g=ipdbak inter_packet_delay_g=ipdbak
@@ -3958,7 +3958,7 @@ def test_connectivity():
icmp_packet=ICMPv6EchoRequest() icmp_packet=ICMPv6EchoRequest()
final_packets=[ip_packet1/tcp_packet, ip_packet2/icmp_packet] final_packets=[ip_packet1/tcp_packet, ip_packet2/icmp_packet]
# Send the packet and listen for responses # Send the packet and listen for responses
sys.stdout.write("[+] IPv6 conectivity: ") sys.stdout.write("[+] IPv6 connectivity: ")
sys.stdout.flush() sys.stdout.flush()
if send_eth_g == True: if send_eth_g == True:
response6=send_and_receive_eth(final_packets, verbosity=0) response6=send_and_receive_eth(final_packets, verbosity=0)
@@ -3990,7 +3990,7 @@ def test_connectivity():
icmp_packet=ICMP(type=8) icmp_packet=ICMP(type=8)
final_packets=[ip_packet1/tcp_packet, ip_packet2/icmp_packet] final_packets=[ip_packet1/tcp_packet, ip_packet2/icmp_packet]
# Send the packet and listen for responses # Send the packet and listen for responses
sys.stdout.write("[+] IPv4 conectivity: ") sys.stdout.write("[+] IPv4 connectivity: ")
sys.stdout.flush() sys.stdout.flush()
if send_eth_g == True: if send_eth_g == True:
response4=send_and_receive_eth(final_packets, verbosity=0) response4=send_and_receive_eth(final_packets, verbosity=0)
@@ -4086,9 +4086,9 @@ def main():
# Run main the tests # Run main the tests
run_all_tests(target_host6_g, target_host4_g, first_test_g, last_test_g+1) run_all_tests(target_host6_g, target_host4_g, first_test_g, last_test_g+1)
# Run time dependant tests only when all others are requested # Run time dependent tests only when all others are requested
if first_test_g==0 and last_test_g> len(test6_ids) : if first_test_g==0 and last_test_g> len(test6_ids) :
run_timing_dependant_tests() # Nmap OS probes that are sent 100ms apart run_timing_dependent_tests() # Nmap OS probes that are sent 100ms apart
# Build result vectors # Build result vectors
build_result_vector6() build_result_vector6()

View File

@@ -31,7 +31,7 @@ def create_dir(path):
# The format of pango/pangorc is called "key file." It's described at # The format of pango/pangorc is called "key file." It's described at
# http://library.gnome.org/devel/glib/stable/glib-Key-value-file-parser. # http://library.gnome.org/devel/glib/stable/glib-Key-value-file-parser.
# Escape a string as approprite for a "key file." # Escape a string as appropriate for a "key file."
def escape_key_file_value(value): def escape_key_file_value(value):
result = [] result = []
for c in value: for c in value:
@@ -82,7 +82,7 @@ def hack_xinitrc(system_xinitrc_filename, home_xinitrc_filename):
system_xinitrc = open(system_xinitrc_filename, "r") system_xinitrc = open(system_xinitrc_filename, "r")
home_xinitrc = open(home_xinitrc_filename, "w") home_xinitrc = open(home_xinitrc_filename, "w")
lines = iter(system_xinitrc) lines = iter(system_xinitrc)
# Look for the first non-comment line so we don't pre-empt the #! line. # Look for the first non-comment line so we don't preempt the #! line.
for line in lines: for line in lines:
if not line.lstrip().startswith("#"): if not line.lstrip().startswith("#"):
break break

View File

@@ -144,7 +144,7 @@ class BWChangeableComboBoxEntry(gtk.ComboBoxEntry):
if self.get_active() != -1: if self.get_active() != -1:
self.__last_active = self.get_active() self.__last_active = self.get_active()
def bw_get_lenght(self): def bw_get_length(self):
""" """
""" """
return len(self.__liststore) return len(self.__liststore)

View File

@@ -122,7 +122,7 @@
class Linear2DInterpolator: class Linear2DInterpolator:
""" """
Implements a bidimesional linear interpolator. Implements a bidimensional linear interpolator.
""" """
def __init__(self): def __init__(self):

View File

@@ -1088,9 +1088,9 @@ class RadialNet(gtk.DrawingArea):
def __draw_node(self, context, node): def __draw_node(self, context, node):
""" """
Draw nodes and your informations Draw nodes and your information
@type : NetNode @type : NetNode
@param : The node will be draw @param : The node to be drawn
""" """
x, y = node.get_cartesian_coordinate() x, y = node.get_cartesian_coordinate()
xc, yc = self.__center_of_widget xc, yc = self.__center_of_widget
@@ -1234,9 +1234,9 @@ class RadialNet(gtk.DrawingArea):
""" """
distance = abs(self.__fisheye_ring - ring) distance = abs(self.__fisheye_ring - ring)
level_of_detail = self.__ring_gap * self.__fisheye_interest level_of_detail = self.__ring_gap * self.__fisheye_interest
spreaded_distance = distance - distance * self.__fisheye_spread spread_distance = distance - distance * self.__fisheye_spread
value = level_of_detail / (spreaded_distance + 1) value = level_of_detail / (spread_distance + 1)
if value < self.__min_ring_gap: if value < self.__min_ring_gap:
value = self.__min_ring_gap value = self.__min_ring_gap

View File

@@ -257,7 +257,7 @@ class NetworkInventory(object):
#remove ports which are no longer up #remove ports which are no longer up
if old_date < new_date: if old_date < new_date:
for defunct_port in old_list: for defunct_port in old_list:
#Check if defunt_port is in ports and that the protocol matches #Check if defunct_port is in ports and that the protocol matches
port_number = int(defunct_port['portid']) port_number = int(defunct_port['portid'])
if port_number in ports: if port_number in ports:
if defunct_port['protocol'] in ports[port_number]: if defunct_port['protocol'] in ports[port_number]:
@@ -664,7 +664,7 @@ class FilteredNetworkInventoryTest(unittest.TestCase):
class PortChangeTest(unittest.TestCase): class PortChangeTest(unittest.TestCase):
def test_port(self): def test_port(self):
"""Verify that the port status (open/filtered/closed) is diplayed """ \ """Verify that the port status (open/filtered/closed) is displayed """ \
"""correctly when the port status changes in newer scans""" """correctly when the port status changes in newer scans"""
from zenmapCore.NmapParser import NmapParser from zenmapCore.NmapParser import NmapParser
inv = NetworkInventory() inv = NetworkInventory()

View File

@@ -84,7 +84,7 @@
class option: class option:
"""A single option, part of a pool of potential options. It's just a name """A single option, part of a pool of potential options. It's just a name
and a flag saying if the option takes no argument, if an agument is and a flag saying if the option takes no argument, if an argument is
optional, or if an argument is required.""" optional, or if an argument is required."""
NO_ARGUMENT = 0 NO_ARGUMENT = 0
REQUIRED_ARGUMENT = 1 REQUIRED_ARGUMENT = 1

View File

@@ -907,7 +907,7 @@ class NmapParserSAX(ParserBasics, ContentHandler):
def _parsing(self, attrs, unique_names, other_names): def _parsing(self, attrs, unique_names, other_names):
# Returns a dict with the attributes of a given tag with the # Returns a dict with the attributes of a given tag with the
# atributes names as keys and their respective values # attributes names as keys and their respective values
dic = {} dic = {}
for at in unique_names: for at in unique_names:
dic[at] = unique(attrs.get(at, "")) dic[at] = unique(attrs.get(at, ""))
@@ -1262,7 +1262,7 @@ class NmapParserSAX(ParserBasics, ContentHandler):
writer.endElement("uptime") writer.endElement("uptime")
##################### #####################
# Sequences elementes # Sequences elements
## TCP Sequence element ## TCP Sequence element
# Cannot use dict() here, because of the 'class' attribute. # Cannot use dict() here, because of the 'class' attribute.
writer.startElement("tcpsequence", writer.startElement("tcpsequence",

View File

@@ -130,17 +130,17 @@ class RecentScans(object):
self.temp_list = [] self.temp_list = []
try: try:
self.recents_scans_file = Path.recent_scans self.recent_scans_file = Path.recent_scans
except: except:
self.recents_scans_file = False self.recent_scans_file = False
if self.recents_scans_file and \ if self.recent_scans_file and \
(access(self.recents_scans_file, R_OK and W_OK) or \ (access(self.recent_scans_file, R_OK and W_OK) or \
access(dirname(self.recents_scans_file), R_OK and W_OK)): access(dirname(self.recent_scans_file), R_OK and W_OK)):
self.using_file = True self.using_file = True
# Recovering saved targets # Recovering saved targets
recent_file = open(self.recents_scans_file, "r") recent_file = open(self.recent_scans_file, "r")
self.temp_list = [t for t in recent_file.read().split(";") \ self.temp_list = [t for t in recent_file.read().split(";") \
if t != "" and t != "\n"] if t != "" and t != "\n"]
recent_file.close() recent_file.close()
@@ -149,7 +149,7 @@ class RecentScans(object):
def save(self): def save(self):
if self.using_file: if self.using_file:
recent_file = open(self.recents_scans_file, "w") recent_file = open(self.recent_scans_file, "w")
recent_file.write(";".join(self.temp_list)) recent_file.write(";".join(self.temp_list))
recent_file.close() recent_file.close()

View File

@@ -175,7 +175,7 @@ if isinstance(umitdb, str):
fs_enc = "UTF-8" fs_enc = "UTF-8"
umitdb = umitdb.decode(fs_enc) umitdb = umitdb.decode(fs_enc)
# pyslite 2.4.0 doesn't handle a unicode database name, though earlier and # pysqlite 2.4.0 doesn't handle a unicode database name, though earlier and
# later versions do. Encode to UTF-8 as pysqlite would do internally anyway. # later versions do. Encode to UTF-8 as pysqlite would do internally anyway.
umitdb = umitdb.encode("UTF-8") umitdb = umitdb.encode("UTF-8")
@@ -183,7 +183,7 @@ connection = sqlite.connect(umitdb)
# By default pysqlite will raise an OperationalError when trying to return a # By default pysqlite will raise an OperationalError when trying to return a
# TEXT data type that is not UTF-8 (it always tries to decode text in order to # TEXT data type that is not UTF-8 (it always tries to decode text in order to
# return a unicdoe object). We store XML in the database, which may have a # return a unicode object). We store XML in the database, which may have a
# different encoding, so instruct pysqlite to return a plain str for TEXT data # different encoding, so instruct pysqlite to return a plain str for TEXT data
# types, and not to attempt any decoding. # types, and not to attempt any decoding.
try: try:
@@ -292,7 +292,7 @@ class UmitDB(object):
def cleanup(self, save_time): def cleanup(self, save_time):
log.debug(">>> Cleaning up data base.") log.debug(">>> Cleaning up data base.")
log.debug(">>> Removing results olders than %s seconds" % save_time) log.debug(">>> Removing results older than %s seconds" % save_time)
self.cursor.execute("SELECT scans_id FROM scans WHERE date < ?", self.cursor.execute("SELECT scans_id FROM scans WHERE date < ?",
(time() - save_time,)) (time() - save_time,))

View File

@@ -238,7 +238,7 @@ used more than once to get even more verbosity"))
def get_target(self): def get_target(self):
"""Returns a string with the target specified, or False if this option """Returns a string with the target specified, or False if this option
wass not called by the user""" was not called by the user"""
return self.options.target return self.options.target
def get_open_results(self): def get_open_results(self):

View File

@@ -307,7 +307,7 @@ class TargetEntry(gtk.Entry):
def update(self): def update(self):
self.set_text(u" ".join(self.ops.target_specs)) self.set_text(u" ".join(self.ops.target_specs))
def changed_cb(self, eidget): def changed_cb(self, widget):
self.ops.target_specs = self.get_targets() self.ops.target_specs = self.get_targets()
def get_targets(self): def get_targets(self):

View File

@@ -783,7 +783,7 @@ class ScanInterface(HIGVBox):
def host_selection_changed(self, widget): def host_selection_changed(self, widget):
self.refresh_port_output() self.refresh_port_output()
# Switch nmap output to show first host occourrence # Switch nmap output to show first host occurrence
model, selection = self.host_view_selection.get_selected_rows() model, selection = self.host_view_selection.get_selected_rows()
for path in selection: for path in selection:
self.go_to_host(model[path][2]) self.go_to_host(model[path][2])

View File

@@ -228,7 +228,7 @@ class ScanNmapOutputPage(HIGVBox):
self._update() self._update()
def set_active_iter(self, i): def set_active_iter(self, i):
"""Set the active entry to an interator into the ScansListStore """Set the active entry to an iterator into the ScansListStore
referred to by this object.""" referred to by this object."""
self.scans_list.set_active_iter(i) self.scans_list.set_active_iter(i)

View File

@@ -238,7 +238,7 @@ class ScriptInterface:
self.current_arguments = [] self.current_arguments = []
self.set_help_texts() self.set_help_texts()
self.prev_script_spec = None self.prev_script_spec = None
self.focussedentry = None self.focusedentry = None
self.liststore = gtk.ListStore(str, "gboolean", object) self.liststore = gtk.ListStore(str, "gboolean", object)
@@ -677,7 +677,7 @@ clicking in the value field beside the argument name.""")
self.set_description(entry) self.set_description(entry)
self.populate_arg_list(entry) self.populate_arg_list(entry)
# Remember the currently pointing script entry # Remember the currently pointing script entry
self.focussedentry = entry self.focusedentry = entry
def update_help_ls_cb(self, widget, extra): # list of scripts def update_help_ls_cb(self, widget, extra): # list of scripts
"""Callback method to display the help for the list of scripts.""" """Callback method to display the help for the list of scripts."""
@@ -696,7 +696,7 @@ clicking in the value field beside the argument name.""")
# convert_widget_to_bin_window_coords was introduced in PyGTK 2.12. # convert_widget_to_bin_window_coords was introduced in PyGTK 2.12.
return return
path = treeview.get_path_at_pos(x, y) path = treeview.get_path_at_pos(x, y)
if not path or not self.focussedentry: if not path or not self.focusedentry:
self.help_buf.set_text("") self.help_buf.set_text("")
return return
path = path[0] path = path[0]

View File

@@ -127,7 +127,7 @@ This module implements GTK Widgets that try their best to adhere to the
GNOME Human Interface Guidelines (aka HIG). GNOME Human Interface Guidelines (aka HIG).
This is mostly implemented by subclassing from the GTK classes, and This is mostly implemented by subclassing from the GTK classes, and
providing defaults that better match the HIG specifications/recomendations. providing defaults that better match the HIG specifications/recommendations.
""" """
from gtkutils import * from gtkutils import *

View File

@@ -148,7 +148,7 @@ class HIGAlertDialog(gtk.MessageDialog):
""" """
HIGfied Alert Dialog. HIGfied Alert Dialog.
Implements the sugestions documented on: Implements the suggestions documented in:
http://developer.gnome.org/projects/gup/hig/2.0/windows-alert.html http://developer.gnome.org/projects/gup/hig/2.0/windows-alert.html
""" """

View File

@@ -146,7 +146,7 @@ class HIGClosableTabLabel(HIGHBox):
self.label_text = label_text self.label_text = label_text
self.__create_widgets() self.__create_widgets()
#self.propery_map = {"label_text" : self.label.get_label} #self.property_map = {"label_text" : self.label.get_label}
def __create_widgets(self): def __create_widgets(self):
self.label = gtk.Label(self.label_text) self.label = gtk.Label(self.label_text)

View File

@@ -191,7 +191,7 @@ class HIGSpinnerImages:
self.rest_pixbuf = self.static_pixbufs[name] self.rest_pixbuf = self.static_pixbufs[name]
def set_size(self, width, height): def set_size(self, width, height):
"""Sets the size of eache pixbuf (static and animated)""" """Sets the size of each pixbuf (static and animated)"""
new_animated = [] new_animated = []
for p in self.animated_pixbufs: for p in self.animated_pixbufs:
new_animated.append(p.scale_simple(width, height, new_animated.append(p.scale_simple(width, height,
@@ -349,11 +349,11 @@ class HIGSpinner(gtk.EventBox):
self.images_width = 32 self.images_width = 32
self.images_height = 32 self.images_height = 32
# Timeout set to 100 miliseconds per frame, just as the # Timeout set to 100 milliseconds per frame, just as the
# Nautilus/Epiphany implementation # Nautilus/Epiphany implementation
self.timeout = 120 self.timeout = 120
# Initialize a cache for ouselves # Initialize a cache for ourselves
self.cache = HIGSpinnerCache() self.cache = HIGSpinnerCache()
self.cache.load_static_from_lookup() self.cache.load_static_from_lookup()
self.cache.load_animated_from_lookup() self.cache.load_animated_from_lookup()

View File

@@ -141,7 +141,7 @@ class HIGTable(gtk.Table):
# TODO: # TODO:
# - Automatic position packing, # - Automatic position packing,
# - Gereric attach function that detects the widget type # - Generic attach function that detects the widget type
def __init__(self, rows=1, columns=1, homogeneous=False): def __init__(self, rows=1, columns=1, homogeneous=False):
gtk.Table.__init__(self, rows, columns, homogeneous) gtk.Table.__init__(self, rows, columns, homogeneous)