Writing to share an update on my previous request.
So, after reviewing my code over, it seems like my last print statement
"print(ResolvedAddresses)" was not properly indented inside the for loop - and
for that reason the output was coming our as empty.
After I aligned that with the rest of the l
Hi Martin,
Thank you for taking the time to write such a detailed response. Very much
appreciate it.
I tried the code again with modifications that you suggested and even though
none of the public addresses resolved; I did get little more details.
I am still working on finding a solution for th
Hello Nym,
Here is the updated code: https://bpaste.net/show/358583e1a0bd
It's short. I have included inline here:
import socket
ListOfIPAddresses = []
with open('top500ips.csv', 'r') as f:
for line in f:
line = line.strip()
ListOfIPAddresses.append(line)
Thank you all for your responses. I have taken your feedback and made changes
to my code.
-Danny, per your suggestion, I have renamed some of my variables to make their
purpose little more clearer.
- Alan, I have created a new host list (ResolvedAddresses) which is storing
the output from socke
On 20/07/15 00:55, Nym City via Tutor wrote:
Thank you for your response. I gave it another try:
As suggested, first I ran the concept just in the terminal, and it worked fine:
names =['173.252.120.6', '98.139.183.24']
import socket
for name in names:
socket.gethostbyaddr(name)
print(
> for name in domains:
> socket.gethostbyaddr(name)
> print(name)
>
> output:
> 173.252.120.6
> 98.139.183.24
>
> What am I missing? Thank in advance.
>
You have confused yourself a little because the variable names you've
chosen are slightly misleading. Specifically, "name" is really an
Thank you for your response. I gave it another try:
As suggested, first I ran the concept just in the terminal, and it worked fine:
>>> names =['173.252.120.6', '98.139.183.24']
>>> import socket
>>> for name in names:
socket.gethostbyaddr(name)
print(name)
output:
('edge-star-shv-12-f
On Jul 18, 2015 3:50 PM, "Nym City via Tutor" wrote:
>
> Thank you all for your responses. I have a follow up question:
>
> So if gethostbyname_ex() takes only a single hostname string, how can I
use it to go through a list of hostnames and get their IP resolution as an
output?
>
Look into loops.
Thank you all for your responses. I have a follow up question:
So if gethostbyname_ex() takes only a single hostname string, how can I use it
to go through a list of hostnames and get their IP resolution as an output?
This would mean,socket.gethostbyaddr() would also not work for my second
pro
On 12/07/15 23:36, Nym City via Tutor wrote:
import csv
import socket
domains = open('top500domains.csv', 'r')
for domain in domains:
domain = socket.gethostbyname(str(domains))
You are passing your file object to gethostbyname()
print(domains + "\n")
For the code above, I receive
One other thing to note: if you're working with a comma-separated
value file (CSV), then you may want to use the 'csv' module to parse
it.
https://docs.python.org/3.5/library/csv.html
This should allow you to walk through the file as if it were a
sequence of records. In contrast, if you're d
On 12Jul2015 22:36, Nym City wrote:
Hello,
I am working on a 2 individual programs. In the first program, I am taking in a
list of domains in .csv format and want to get the associated IPs.
In the second program, I want to import in a list of IP .csv and than get the
associated domains out.
Ev
Hello,
I am working on a 2 individual programs. In the first program, I am taking in a
list of domains in .csv format and want to get the associated IPs.
In the second program, I want to import in a list of IP .csv and than get the
associated domains out.
Eventually I want to get both of the abo
13 matches
Mail list logo