''' TCP server and HTTP server HHHHH it's a test the next project is a command line like metasploit this project had may errors ''' import socket import ftplib import string import signal import struct import select import urllib import io, re import os, sys import telnetlib, ssl import http.server, http.client import time, datetime, uuid, uu import selectors import __future__ socket.hostflags=0xffff socket.server_address=('192.168.1.5', 153) socket.log_path='home\\var\\logs\\logs.log' socket.filter_path='home\\var\\block\\address.ip' socket.main_path='home\\main.html' mode="a+" def stdout(stdout=""):return sys.stdout.write(stdout) def stderr(stderr=""):return sys.stderr.write(stderr) class stdin: def read(stdin=1):return sys.stdin.read(stdin) def readline(stdin=1):return sys.stdin.readline(stdin) def readlines(stdin=1):return sys.stin.readlines(stdin) def exit(code):return sys.exit(code) def debug_print(text="", file=sys.stdout, end="\n"):return print(text, file=file, end=end) #class socket:pass def start(message): debug_print("start on %s %s" % (socket.server_address[0], socket.server_address[1])) socket.server_socket=socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) socket.server_socket.bind(socket.server_address) socket.server_socket.listen(socket.hostflags) socket.client_socket, socket.client_address=socket.server_socket.accept() try: socket.client_useragent=socket.server_socket.recv(socket.hostflags) except: socket.server_socket.send(message.encode()) debug_print("connection sucsess on: "+socket.client_address[0]+':'+str(socket.client_address[1])) pass with open(socket.filter_path, mode) as filter_mode: if socket.client_address[0] in filter_mode: socket.client_socket.recv(socket.hostflags) socket.client_socket.send(message.encode()) else: socket.client_socket.send(message.encode()) socket.client_socket.close() socket.server_socket.close() debug_print("connection sucsess on: "+socket.client_address[0]+':'+str(socket.client_address[1]))