You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
831 B

import asyncio, telnetlib3
import time
import os, random
import glob
async def shell(reader, writer):
intro = open("varia80", "r")
lines = intro.readlines()
for line in lines:
time.sleep(0.03)
writer.write('\r' + line)
time.sleep(0.5)
displayrandomfile(reader, writer)
writer.close()
def displayrandomfile(reader, writer):
path = os.getcwd()
file_list = glob.glob(f"{path}/*.txt")
filename = random.choice(file_list)
file1 = open(filename,"r")
writer.write('\r\n')
lines = file1.readlines()
for line in lines:
time.sleep(0.1)
writer.write('\r' + line)
loop = asyncio.get_event_loop()
coro = telnetlib3.create_server(port=6023, shell=shell, encoding='UTF-8')
server = loop.run_until_complete(coro)
loop.run_until_complete(server.wait_closed())