Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 103 def get_comp(stdout=subprocess.PIPE, stderr=None, wait=False):
- 104 num = 1
- 105 commandline = "./rocks_list_random_hosts.sh %d" % num
- 106
- 107
- 108 process = subprocess.Popen(commandline, shell=True, stdout=stdout,stderr=stderr)
- 109
- 110 lines = []
- 111
- 112 try:
- 113 for line in process.stdout:
- 114 lines.append(line)
- 115
- 116 except KeyboardInterrupt:
- 117 process.terminate()
- 118
- 119 finally:
- 120 output = ''.join(lines)
- 121 del lines
- 122
- 123
- 124 #o = output.split(' ')
- 125 #print '"'+o[0]+'",'
- 126 print output.strip()
- 127 print socket.gethostbyname(output.strip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement