py3 conversion

This commit is contained in:
Michel Oosterhof
2018-01-31 17:04:35 +04:00
parent 1edad71802
commit 1f0be9b3cf

View File

@ -200,7 +200,7 @@ class command_iptables(HoneyPotCommand):
def is_valid_table(self, table): def is_valid_table(self, table):
if self.user_is_root(): if self.user_is_root():
# Verify table existence # Verify table existence
if not table in self.tables.iterkeys(): if not table in list(self.tables.keys()):
self.write( """%s: can\'t initialize iptables table \'%s\': Table does not exist (do you need to insmod?) self.write( """%s: can\'t initialize iptables table \'%s\': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.\n""" % (command_iptables.APP_NAME, table) ) Perhaps iptables or your kernel needs to be upgraded.\n""" % (command_iptables.APP_NAME, table) )
self.exit() self.exit()
@ -215,7 +215,7 @@ Perhaps iptables or your kernel needs to be upgraded.\n""" % (command_iptables.A
def is_valid_chain(self, chain): def is_valid_chain(self, chain):
# Verify chain existence. Requires valid table first # Verify chain existence. Requires valid table first
if not chain in self.current_table.iterkeys(): if not chain in list(self.current_table.keys()):
self.write("%s: No chain/target/match by that name.\n" % command_iptables.APP_NAME) self.write("%s: No chain/target/match by that name.\n" % command_iptables.APP_NAME)
self.exit() self.exit()
return False return False
@ -308,7 +308,7 @@ Options:
chains = [chain] chains = [chain]
else: else:
chains = self.current_table.iterkeys() chains = iter(self.current_table.keys())
# Output buffer # Output buffer
output = [] output = []
@ -334,7 +334,7 @@ Options:
chains = [chain] chains = [chain]
else: else:
chains = self.current_table.iterkeys() chains = iter(self.current_table.keys())
# Output buffer # Output buffer
output = [] output = []
@ -372,7 +372,7 @@ Options:
chains = [chain] chains = [chain]
else: else:
chains = self.current_table.iterkeys() chains = iter(self.current_table.keys())
# Flush # Flush
for chain in chains: for chain in chains: