A (CTRL + A) in telnet client

Asked

Viewed 33 times

0

I’m making a telnet client in python and I need to send a code to another machine but the code needs to put a Ctrl + To (CODE) but when I put ^A (code) does not work, heeelp me

serv = raw_input("[+] SERVER: ")
port = raw_input("[+] PORT: ")
tn = telnetlib.Telnet(serv, port)
mess = ("^AXXXX")
tn.write(mess)
out=tn.read_all()
print(out)
tn.close()

1 answer

1

Ctrl + To is byte 1. You can test as follows:

import sys
print(sys.stdin.readline())

Spin and type Ctrl + To and Enter, the result:

'\x01\n'

so to send it just send this character:

mess = "\x01XXXX"

or

mess = chr(1) + "XXXX"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.