J-Link GDB Server receving a connection by Python - python

Hello great people of the internets
I am using J-Link GDB Server to accept GDB clients and execute commands via J-link Commander.
I am using a fully automated python code that needs to send write and read requests to change/read registries in a perihfallical whitin the Cortex-M3. I can execute those commands in the J-Link Commander via mem32 and w4, but I want to connect to J-Link GDB Server via TCP/IP in python and send those requests.
How in gods name can I do this?
Thank you!

Related

Communicate with unix-domain socket through scripting

I'm getting bus error when attempt to write to unix-socket from my client application, so I wanted to debug my connection and communicate through this socket by writing some basic script commands directly from command line bash/python for debugging my connection.
Seems like simple echoing operation is not supported on the socket, Perhaps there's a simple python package to communicate with the socket ?

Sending commands to clients computer using sockets

I am fairly new to sockets in python and I want to know how i can remotely run commands to another computer. At the moment, I've looked a bit into sockets and I know how to send text messages across networks. And yes, I've port-forwarded my PC.
If this explanation is confusing, let me give examples:
When you
import os
in the python shell and use
os.system(<command>)
, it will run the specified command in your shell. I want to achieve that, but on a remote computer. I am able to establish a connection and I'm successfully able to transfer bytes over a WLAN.
Issue: I don't know how to send python commands via. sockets and I would like to learn how to do it. I know I could implement the code onto the client's connection side of things, but I don't want it hardcoded. I want something like a 'live terminal' of the client's computer allowing me to type commands in and watch them being performed remotely on the client's computer. I'd appreciate some help!
P.S. I'm using Python 3.7.4
You have to do roughly the same thing you were doing with sending text messages. You must have had a client running your python script and your own computer(the server) running a script as well. The only difference between you sending a text message to the client and you sending a command would be in the python script the client is running.
In that python script, instead of printing the command to the console, you can just execute that command using os.system()

Telnet client control panel python

I am working on Jasmin SMS gateway and I want to use its CLI module using my python script. It serves this module as telnet. I am not sure ho to send and receive commands from telnet. I have tried telnetlib but I do not know how to use it properly. Jamsin SMS Gateway can be found here:
https://jasmin.readthedocs.io/en/latest/management/jcli/index.html#architecture
I found pexpect library that works great with telnet and ssh clients. I can perform all the tasks of Jamsin's CLI module using my scripts.
There is also a web interface available written in Django and work perfectly with jasmin using pexpect. Its called JasminWebPanel.

Dronekit Python - Is it possible to send commands from Nodejs?

I'm trying to use Dronekit Python 2 for creating a minimalistic GCS (ground station). From the examples it looks like python scripts always finish and the connection with the vehicle is lost. That said, Is there any way to code a python script that works like a thread and only exit once it get's a command from Nodejs? Nodejs has the python-shell module that is supposed to send messages to python via STDIN. So my goal is to run python script from Nodejs python-shell, and then send commands to dronekit (connect, arm, takeoff, etc). Thanks for your help!
I believe you can build your GUI in nodejs and use UDP or websocket to communicate with python code, where you build a dronekit wrapped with UDP or websocket.

Batch execution of SAS using a Telnet connection in Python

I have been interested in finding an alternative to the UI in SAS for quite some time now. We license SAS on our server instead of our desktops, so furthermore we have to launch a remote desktop application to execute code.
I was able to use a Telnet connection instead to remotely connect to the server, and batch execute SAS programs. Then I was interested in whether a python script could be made to connect remotely, and batch execute code, and this script could be executed in jEdit as a BeanShell script.
So far, I have Python code which successfully opens and closes the Telnet connection. It can do basic shell functions like call "dir". However, when I pass the exact same line that I use to execute SAS from command prompt on the remote server with a telnet connection in Python, nothing happens.
Is it possible the server is preventing me from executing code from a script? I use a "read_until" statement for the prompt before running any code.
Here's a few ideas...
The issue you are having above may be related to Local Security Policy settings in Windows (if it is running on a windows server). I'm far from an expert on that stuff but I remember older SAS/Intranet installations required some rumaging around in there to get them working.
As an alternative to the approach you are trying above you could also setup a SAS session on the server that listens for incoming socket requests as per this article:
http://analytics.ncsu.edu/sesug/2000/p-1003.pdf
And finally... Not sure if this helps or not by I remotely execute SAS jobs using PSEXEC. A description of how I set it all up can be found here:
http://www.runsubmit.com/questions/260/hide-sas-batch-jobs-winxp
Good luck
This paper outlines how you can use a Python script to connect to a Unix server using SSH, copy the SAS program written locally onto the server, batch submit it, and download the results back to your local machine, all using a BeanShell macro script for jEdit.

Categories

Resources