Last active
January 6, 2021 05:21
-
-
Save Doridian/cfb35c67bb2d72238191bf7fcff985f2 to your computer and use it in GitHub Desktop.
ppp_connect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, tty, termios | |
#fh = open('/tmp/chatlog', 'a') | |
tty.setraw(sys.stdin.fileno()) | |
str = '' | |
while True: | |
ch = sys.stdin.read(1) | |
i = ord(ch) | |
#fh.write("%d %s\n" % (i, ch)) | |
if i == 13 or i == 10: | |
#fh.write("%s\n" % str) | |
#fh.flush() | |
if 'ATDT' in str: | |
sys.stdout.write("CONNECT\n") | |
sys.stdout.flush() | |
exit(0) | |
else: | |
sys.stdout.write("OK\n") | |
sys.stdout.flush() | |
str = '' | |
str += ch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment