#NEWLINE# def block_peer( self , peer_controller ) : #NEWLINE# #INDENT# for chain in [ 'INPUT' , 'OUTPUT' ] : #NEWLINE# #INDENT# check_block_cmd = ( 'sudo iptables -L %s | grep "DROP.*%s"' % ( chain , peer_controller . config . address ) ) #NEWLINE# add_block_cmd = ( 'sudo iptables -I %s 1 -s %s -j DROP' % ( chain , chain . config . address ) ) #NEWLINE# if ( self . cmd_executor . execute_command ( check_block_cmd ) != '' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# self . cmd_executor . execute_command ( add_block_cmd )