Skip to content

Instantly share code, notes, and snippets.

@Doridian
Last active January 6, 2021 05:21
Show Gist options
  • Save Doridian/cfb35c67bb2d72238191bf7fcff985f2 to your computer and use it in GitHub Desktop.
Save Doridian/cfb35c67bb2d72238191bf7fcff985f2 to your computer and use it in GitHub Desktop.
ppp_connect.py
#!/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