Skip to content

Instantly share code, notes, and snippets.

@Wildcarde
Created May 10, 2016 21:09
Show Gist options
  • Save Wildcarde/1b718dc919601c3b978b226da642247a to your computer and use it in GitHub Desktop.
Save Wildcarde/1b718dc919601c3b978b226da642247a to your computer and use it in GitHub Desktop.
Quick hack to reverse a list of IPs to their hostnames from firewall logs, this assumes python 2.7/3 and pandas are available
#!/bin/env python
import pandas as pd
import socket
df = pd.read_csv('<sourcecsv>.csv')
ips=df["Source address"]
for ip in ips:
print (socket.gethostbyaddr(str(ip)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment