I'm trying to use AT commands to setup a BGS2-W modem on a custom board to connect to a site over TLS, but the modem is not reacting to my commands and no certificates are being set.
I'm using the command
AT^SBNW
to send the commands as documented in Transport Layer Security for Client
TCP/IP Services doc (https://ptelectronics.ru/wp-content/uploads/organizatsiya_bezopasnogo_ssl-soedineniya.pdf#page=8).
Unfortunately, the document provides no examples, and I haven't been able to find any samples showing the usage of this command online.
The document linked has a java commandline tool attached that will send a cert from a PC, however I am unable to use this tool (I don't have the connection to the modem).
If anyone has any idea's on how to use this command I could very much use the help.
Note: I'm trying to set the certificates from within code running on a PIC18 - this isn't a final incarnation, I just need the certificates loaded so I can connect to our secure server.
Well, guess this one isn't going to find an answer anytime soon :)
So, its fairly easy to capture the output from the javatool - I'm using Com0Com to emulate 2 connected ports, then using termite to manually input on one port while telling the java app to connect to the other.
The first query from the java app expects an "OK" response, I find it easiest to send the response before starting the java app (I guess it gets cached in the recv buffer of the emulated port).
The javatool then sends "AT^SBNW=is_cert,1\r", and you can type in the reply in termite "SECURE CMD READY: SEND COMMAND ..."
After this a large binary dump comes through. You can decode the dump using the structure described in Application Note 62 (https://ptelectronics.ru/wp-content/uploads/organizatsiya_bezopasnogo_ssl-soedineniya.pdf). That should get all the data required to generate the same binary within code.
Related
Actually I'm using D-Feet (D-Feet can be used to inspect D-Bus interfaces of running programs and invoke methods on those interfaces) to connect to a BLE peripheral that advertises proximity profile.
When I try the Connect() method on the remote object /org/bluez/hci0/dev_88_6B_0F_00_C4_3A every thing is fine and the connection succeed but when I try to connect only the proximity profile using ConnectProfile("0x1802") method an error occurs saying that the host is down:
g-io-error-quark: GDBus.Error:org.bluez.Error.Failed: Host is down
(36)
Can anyone help me solving this problem (I'm blocked for 2 weeks and there still to much to deal with in the project :/)
ConnectProfile("0x1802")
ConnectProfile (and the Bluez API in general) does not deal with handles, only UUIDs. Your input argument does not look like a UUID: I suggest you find the remote service UUID that matches the handle (I'm assuming your current input argument is a handle).
I believe you can find the UUID with d-feet (after Connect() the service objects should be there) or with bluez command line tools.
This may not be in the right location, so tell me and I'll move it.
I am a recent EE grad and I was hired to build a system that exists on a SoC with a simple 32-bit processor. The system basically monitors several external devices and performs some DSP on it, and then is supposed to send the results using a WiFi device (in my case I have the ESP8266 using UDP) to an email server for logging/notification.
I have been trying to find a library that I can use, but my uC can only program in C and I have it set up for UDP, and everything is in C++ using some other protocol, or something else completely.
I am great at DSP, decent at SoC's and uC's, but when it come to this email server communication thing I am at a loss.
I have successfully configured everything for the sensors, the datapath, the DSP, and connected the system to my WiFi via UDP, but I have yet to figure out how to send data to any servers.
Could someone help me understand how I should go about this?
I have looked into some simple SMTP commands such as HELO, MAIL, RCPT, DATA, etc. but I cannot understand how I actually should implement them in my code.
When I send out the WiFi data via UDP what type of data do I send and how do I format it? Do I need to send any other kind of flags? How should I expect the response? I also know the data has to be transformed into base 64 which is confusing me further.
I am also not super familiar with UDP to begin with, I have been using libraries that are part of the SoC's default library to connect to my WiFi.
I know these may either seem like obvious or stupid questions but it is were I no longer have any knowledge, and everything I find online doesn't make sense, or doesn't attempt to explain it, just gives a pre-made solution
I have found the RFC2821 but it doesn't get any clearer.
I know that's a lot but any help at all would be a lifesaver!
Since you are asking this question, I'm assuming that you are not booting and running an OS suitable for micro-controllers such as an embedded variant of Linux or such. If you were, you would simply be able to take advantage of possibly built in applications or other existing code.
But you don't mention having written an Ethernet stack, so are you using some other library or operating environment which might have some of the functionality needed for an implementation of SMTP?
If you don't and really do need to write your own SMTP client to run directly on the processor you are using, then you should be able to find plenty of examples of source code for this. A quick google search of How To Write an SMTP client showed a few articles with some example code. One article seems to be an exact hit, but you need to look at it further.
However, I would highly suggest just sitting down with a telnet client and connect to an SMTP server you are allowed to use and try the commands you need to just send a message. If you only need to send text, you don't need to get involved in MIME encoding or anything like that.
I was wondering, what would be the easiest way to encrypt a message, into a 128-bit with a key. I wanted to code something on my personal computer, that would use LuaSocket, and based on what is sent to my PC, the computer executes X command. This is just something easy, and something for me to code, so I can remotely access my computer, from another computer. I want to make the script first require a password, before granting access to ANY command. But, if someone is spying on the connection, they can take the password, and abuse my PC. So, is there a simple way to securely communicate between MY PC, and the PC that is connecting with my PC (dunno much about encryption)? (somewhat-off-topic: how do you get LuaSocket to reply to the client? lua.org explains client-to-server, but how do you do server-to-client?)
how do you get LuaSocket to reply to the client?
The server obtains the request using client:receive and sends its response using client:send. Please note that even if the documentation calls the variable "client", it doesn't mean the client side of the connection. Instead it means the "connection to the client" from the server's point of view, returned by client:accept.
See http://w3.impa.br/~diego/software/luasocket/old/luasocket-2.0-beta/introduction.html
here is the situation:
I have written a C program doing some wireless measurements on a WRT54GL Router (OpenWRT White Russian, Busybox 1.00, Dropbear client v0.49). Please note that i can not use a more up to date version of the operating system on the router or install additional packages (just scripts or small programs are allowed).
Up to now, i log my measurements results every 15 minutes from the router to the server via a
cat localfile | ssh target_address cat ">" remotefile
which i call from my C program (system()) for every logfile which is created or present at the moment the log starts. What i don't like is, that the system call opens a new shell for every single call, causing some overhead. The good thing is that in this way the data is encrypted and because i do a connection for every file, i can directly get per file feedback from the server, so that i can remove the logs from the router. (Other approaches calling scripts from the router on the server, which then return values for the logging did not work, as the dropbear ssh client does not support this return).
So what i'm asking for: what could be a more elegant way to do so and to reduce this overhead ? By now, i've read a few tutorials about how to use TLS / TCP Sockets (so i can send the data encrypted to the server). Another possibility could be a HTTP PUT or POST, but there i am not sure how i could get feedback for the data being send. So i would just like to hear your oppions and how you guys would try to tackle this.
Best regards
Since you're talking about log files, this sounds like a job for the syslog protocol.
I am pretty sure OpenWRT supports it out of the box.
So, i am assuming that i will need to use sockets(i am a newbie to C).
The program will be for Windows(in pure C). And i shall be using these examples
http://cs.baylor.edu/~donahoo/practical/CSockets/winsock.html
My question is, instead of the client program connecting via TCP, i want the server to accept connections via a web browser i.e via HTTP.
So if the server program is running you type http://yourip:port/?gettemps and the server responds, but how do i do it?
As you might have guessed, this program will be for monitoring temps, remotely, via a web browser. But not for the CPU, for the GPU using AMD's ADL library(so yeah, only AMD cards).
The simplest option that is supported by most web servers is CGI - Common Gateway Interface.
Microsoft, of cource, has their own way of running web apps - ISAPI.
HTTP is quite a big standard, you might want to use some library such as libcurl to handle the details for you.
If you decide to code it yourself, HTTP is running over TCP so you first need to open a TCP socket at the standard HTTP port 80. Then simply listen on the socket and parse the incoming HTTP data - a great summary is given here: http://www.jmarshall.com/easy/http/.
Web browsers sends http get request to the server via tcp. If you are writing a web server from scratch than, you will need to parse data from web browser. http get request are string like for example GET /images/logo.png HTTP/1.1. So tokenize that string as it comes through tcp and get the command.
As you received your commands to the server call appropriate functions to handle your request.
Here is an great example of simple http server. You might want to make server multi-threaded as you may have multiple simultaneous users.
If you have already set up your web server to run the app on the appropriate port you can use getenv("QUERY_STRING") to access the web equivalent of command line parameters.
It would be better to call your program directly rather than just using the server to access a single default program as your example does, thus you could use http://yourip:port/yourprogram?cmd=gettemps. In this example getenv("QUERY_STRING") would return 'cmd=gettemps'.