import subprocess
for number in range(1,21):
domains_ip = subprocess.run(f"ping lbsg.sm{number}.net", shell=True, capture_output=True, text=True)
print(domains_ip)```
How do I make my program ping all of these domains and send their IP at once without it taking forever to individually ping each and every domain?
I play minecraft and I'm trying to make a domain pinger that sends the IP of all of these mc servers so I can join Minecraft via them without having to join the server through the lobby
#๐ need help with domain pinger
13 messages ยท Page 1 of 1 (latest)
@split nebula
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
A faster way would be to create the ICMP packets yourself using sockets and struct, or a library like Scapy.
Although, this way, you may need to do the DNS resolution yourself. I can't remember if Scapy can handle that for you automatically.
honestly im new to this and dont know what icmp packets are or how to use sockets, how do i learn that stuff
ICMP packets are what ping sends by default.
OHHH i see now
thank you
You could also start the processes in a non-blocking manner too, or using a thread pool.
For non-blocking process creation:
https://stackoverflow.com/a/16071877/3000206
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.