Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. 103 def get_comp(stdout=subprocess.PIPE, stderr=None, wait=False):
  2. 104 num = 1
  3. 105 commandline = "./rocks_list_random_hosts.sh %d" % num
  4. 106
  5. 107
  6. 108 process = subprocess.Popen(commandline, shell=True, stdout=stdout,stderr=stderr)
  7. 109
  8. 110 lines = []
  9. 111
  10. 112 try:
  11. 113 for line in process.stdout:
  12. 114 lines.append(line)
  13. 115
  14. 116 except KeyboardInterrupt:
  15. 117 process.terminate()
  16. 118
  17. 119 finally:
  18. 120 output = ''.join(lines)
  19. 121 del lines
  20. 122
  21. 123
  22. 124 #o = output.split(' ')
  23. 125 #print '"'+o[0]+'",'
  24. 126 print output.strip()
  25. 127 print socket.gethostbyname(output.strip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement