0
지속적는 ... 충돌 텔넷 서버 원인 ? 또한 내 서버가 버퍼 오버 플로우로 공격받을 수있는 기회가 있습니까?파이썬 텔넷 서버 충돌
이 내 스크립트 (그것은 매우 기본적인 스크립트)
#!/usr/bin/env python
import sys
import socket
import urllib2
def main():
s = socket.socket() # Create a socket object
host = ''
BUFFER_SIZE = 2048
port = 43 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.listen(120) # Now wait for client connection.
while True:
data = ''
print 'waiting for connection...'
c, addr = s.accept() # Establish connection with client.
print 'Got connection from', addr
data = c.recv(BUFFER_SIZE)
print 'requested website: '+data
print x
c.send(x)
c.close() # Close the connection
if __name__ == '__main__':
main()
서버가 충돌 할 때 오류 메시지와 추적을 얻습니까? – geoffspear
재미있는 부분을 잘라낸 것 같아요. 파일이 존재하는지 또는 동일한 파일 이름인지를 확인하지 않고 파일을 열려고합니다. 이것이 파이썬이 충돌하는 이유입니다. – Mathias
print x 앞에 x = urllib2.urlopen ('http : // localhost : 2020 /? id ='+ data) .read() 문자열에서 잘못된 문자를 제거 할 수있는 방법이 있습니까? PHP에서 htmlspecialchar() 또는 뭔가가 있습니다. @Mathias –