socket.py



from socket import *

serverSocket = socket(AF_INET, SOCK_STREAM)

serverSocket.bind(('', 2603)) # 2603 port h apni dal do tum aab
serverSocket.listen(1)
while True:
    print ''
    connectionSocket, addr = serverSocket.accept()
    try:
        message = connectionSocket.recv(1024)
        filename = message.split()[1]
        f = open(filename[1:])
        outputdata = f.read()
        f.close()
     
        connectionSocket.send('HTTP/1.0 200 OK\r\n\r\n')
     
        for i in range(0, len(outputdata)):
            connectionSocket.send(outputdata[i])
        connectionSocket.close()
    except IOError:
     
        connectionSocket.send('<h1>Hacked By HR07_HACKER<br><br><h2>Jai Hind Jai Bharat<hr>') # Yaha apna deface page add kar sakte aap :-)
     
        connectionSocket.close()
serverSocket.close()

4 comments:

  1. very helpful #socket_of_shubhamyadavethicalhacker thanks for this amazing code.

    ReplyDelete
  2. It's seriously very nice ....it actually made me understood that brackets.......I was very annoyed with that brackets....but now I m relaxed....a very big thanks to u Shubham sir��������������

    ReplyDelete
  3. Very helpful article 🙂👍…can you make articles on setup iptables rules in linux

    ReplyDelete

Search Here

Advertisement