Compare commits

...

2 Commits

Author SHA1 Message Date
Sasha MOREL f86fa0d6a7 Suicide at keyboard interrupt
That's a bug, the program does not close at keyboard interruption because of threads, I pu a suicide function at the end, but suicide is never the solution.
2021-09-02 12:51:38 +02:00
Sasha MOREL 867c6daca5 Note on security 2021-09-02 12:41:56 +02:00
2 changed files with 11 additions and 3 deletions

View File

@ -15,3 +15,9 @@ These libraries are under GNU GPL v3. See [license](LICENSE) for more details.
This program requires Python interpretator and access to Android API. Access to Android API is provided by the API addon and the termux-api package. This program requires Python interpretator and access to Android API. Access to Android API is provided by the API addon and the termux-api package.
Once installed, just run the sms.py script with the python interpretator and connect a browser to phone, on port 8080. Once installed, just run the sms.py script with the python interpretator and connect a browser to phone, on port 8080.
# Note on security
This webserver listen on HTTP, so the traffic between phone and browser is in plain text.
The webserver will only serve the first IP (v4 ou v6) that connect to it, all the other will recieve a 403 error. The server log will show that the server locks on a specific IP when the first client will connect.

6
sms.py
View File

@ -8,7 +8,7 @@ from socket import AF_INET6
from threading import Thread from threading import Thread
from time import sleep from time import sleep
from cgi import FieldStorage from cgi import FieldStorage
from sys import exit from os import kill, getpid
sms_list_program = '/data/data/com.termux/files/usr/bin/termux-sms-list' sms_list_program = '/data/data/com.termux/files/usr/bin/termux-sms-list'
sms_send_program = '/data/data/com.termux/files/usr/bin/termux-sms-send' sms_send_program = '/data/data/com.termux/files/usr/bin/termux-sms-send'
@ -357,4 +357,6 @@ if __name__ == '__main__':
except KeyboardInterrupt: except KeyboardInterrupt:
print ('Interrupt received, closing process…') print ('Interrupt received, closing process…')
server.server_close () server.server_close ()
exit (0) # BUG: the program must kill itself to end or the user must send Ctrl+C several time to close
# TODO: find another way to close the program in one action, suicide is never the solution
kill (getpid (), 15)