Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- from socket import gethostbyaddr
- from sys import argv
- DELIM = ","
- def main():
- if len(argv) != 3:
- print "Usage: %s infile outfile" % argv[0]
- return
- with open(argv[1], "r") as fin, open(argv[2], "w") as fout:
- for line in fin:
- chunk = line.strip().split(DELIM)
- string = "{user}@{host},{pwd}\n".format(user=chunk[1], pwd=chunk[2], host=gethostbyaddr(chunk[0])[0])
- fout.write(string)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement