0

I am trying to capture the output from a whois call made by a python script inside a docker container using subprocess.call. I have tried using Popen and check_output but they throw errors. Here is the code:

live_data = subprocess.call('whois {}'.format(domain), shell=True)
noinot
  • 49
  • 6
  • 2
    Can you share the actual errors? Is being inside a Docker container relevant to your problem (do you have the same problem outside Docker), and if so, can you share your Dockerfile? Can you fix the shell injection vulnerability? – David Maze Jul 30 '18 at 15:33
  • Is the whois binary in the PATH of the calling user? Also, and more important: why calling an external binary where you could a easily either 1) use any of the Python library that does this job or even 2) just open a TCP socket on port 43, send the domain and read the content back since this is basically all that is defined in the whois protocol? – Patrick Mevzek Jul 31 '18 at 00:17
  • I came across pywhois after I asked this and was researching more. The issue is it groups the emails and orgs together but I need them to be in their original data-fields. So I am currently fiddling with it to try to get it to not put them into one list. I am very unfamiliar with whois, so it is sort of a challenge. It sounds like there are more libraries that handle whois. Is there one you suggest that returns the data as a dict, of what it looks like when it is returned on the command line? – noinot Jul 31 '18 at 19:29

0 Answers0