TL;DR: I am following the example at https://github.com/digidotcom/xbee-python/blob/master/examples/communication/socket/SocketTCPClientSample/SocketTCPClientSample.py to POST data to our server but cannot figure out how to use SSL with it.
I have an XBIB-U-DEV board with an embedded LTE Cat 1 cellular modem. This modem is currently connected through USB to a Raspberry Pi 3 running Kali Linux. I want to be able to run a python script on the Kali OS that will Try a requests.post
to our server with a fallback from ethernet to wifi to cellular.
I was provided Digi’s SocketTCPClientSample.py example (link in TL;DR) by a colleague and have been able to adapt that to our needs with one exception: making the call over SSL. I cannot simply ssl.wrap_socket
as I am using xsocket.socket
per the example. Attempting to do so just reveals that an xsocket.socket
is not a socket
with the error of “AttributeError: ‘socket’ object has no attribute ‘getsockopt’”.
- I do not have a static IP which limits options a bit.
- Yes, the cellular contract is active; I can run the original example without ssl just fine.
- When I make the POST with cellular and thus no SSL, I receive a response of 400 Bad Request with “The plain HTTP request was sent to HTTPS port” but using wifi with with the same exact payload succeeds with 200 OK.