@api_view(('<STR_LIT:GET>',))<EOL>def whois_list(request, format=None):
results = []<EOL>for ip in Ip.objects.select_related().all():<EOL><INDENT>interface = ip.interface<EOL>user = interface.device.node.user<EOL>device = interface.device<EOL>results.append({<EOL>'<STR_LIT:address>': str(ip.address),<EOL>'<STR_LIT:user>': user.username,<EOL>'<STR_LIT:name>': user.get_full_name(),<EOL>'<STR_LIT>': device.name,<EOL>'<STR_LIT>': device.node.name<EOL>})<EOL><DEDENT>for interface in Interface.objects.select_related().all():<EOL><INDENT>if interface.mac is None:<EOL><INDENT>continue<EOL><DEDENT>user = interface.device.node.user<EOL>device = interface.device<EOL>results.append({<EOL>'<STR_LIT:address>': str(interface.mac).replace('<STR_LIT:->', '<STR_LIT::>'),<EOL>'<STR_LIT:user>': user.username,<EOL>'<STR_LIT:name>': user.get_full_name(),<EOL>'<STR_LIT>': device.name,<EOL>'<STR_LIT>': device.node.name<EOL>})<EOL><DEDENT>return Response(results)<EOL>
Retrieve basic whois information related to a layer2 or layer3 network address.