I have a python script on raspberry pi 3 and I want to secure my script as much as possible. The user can only contact with the touch screen so there is no external hardware like keyboard, mouse etc. What should I take measure against stolen? For example disabling usb ports, encoding script...
Everything a Raspberry Pi 3 "knows" is on that little micro-SD card. The only way to gain some security is to physically secure the device in an enclosure that prevents the user from getting the SD card. And you need to make your software hard to break into -- difficult for an interpreted language like python -- but made a lot easier if there's no keyboard or other ports available. Again, protected inside the enclosure. If the users can literally only get to the touch screen, then I have a hard time imagining how they'd steal your software.
Related
I've been trying to write a script that sends specific key presses to the game, however they just get "ignored", while the script can send the exact same key presses to any other window without a problem. I'm using WIN 10 x64, python 3.9 and pyautogui and pywinatuo.
Is there an easy way around this? Please consider my inexperience with coding when answering.
I had a similar problem and ended up sending the desired keystroke out to a serial port, using the 'serial' module the writing some code on a 'pro micro' using an arduino ide which would accept any character coming in on the serial port and would then output said character or string to a the usb. The neat thing about the pro micro is the serial port and the usb can be same physical connection. While I had to make exceptions for some special characters like \r and \n it works quite well. Where my application that would not recognize keyboard or mouse inputs from pyautogui or pywinauto, it now does recognize them when coming from the usb as it looks like any other piece of hardware. If you are interested I will send/post the code for the pro micro and some examples of how I used it.
For normal GUI apps there is no easy way to distinguish real clicks vs pywinauto's ones. If you set monitoring keyboard/mouse hooks, there is no such info in HOOK structures. So the answer is no.
I am making a python script that interacts with Kodi on my raspberry pi to control it with my standard tv remote and I was wondering, could I also control my Xbox with it? I am assuming it can be done as you can already use the Xbox controller on your computer so you should be able to do it in reverse with Bluetooth.
If someone could briefly go over a possible way to do this that would be great. (And preferably in python 3.)
Nevermind, I have found a library that should work: https://pypi.org/project/xbox-smartglass-core/
This library allows you to do any function you can do in the Xbox smart-glass app on your phone or on the Xbox companion app for windows. One of those features is sending keypresses.
I'm looking to write a program to change the DPI setting on my logitech G502 mouse (My goal being to use the program with AutoHotkey to help automate a task where I switch my DPI allot and to learn a bit about USB). I'm fairly fluent in C++ , C# and python. But I'm not at all knowledgeable on USB or drivers.
So far I have: used the program USBlyser to identify a Control transfer sent to my mouse when using Logitech's software, which byte of the data corresponds to my DPI setting, and the product ID and Vendor ID of my mouse.
After looking around on the net I decided PyUSB would be a good option for communicating to my mouse. After installing libUsb for use with PyUSB I realised that this then replaces my current mouse driver and makes it unusable.
Am I just going about this all wrong? In my head all I want to do is send to my mouse the data "10 FF 0E CA 01 00 00", should I instead be somehow communicating with my existing logitech driver to do this? Or can I set-up libUsb without interfering with existing drivers?
Any help will be appreciated, cheers Bradley.
libusb doesn't interfere with anything. In PyUSB you choose to communicate directly with the device. To do this any other app holding this USB port have to be stopped.
Windows driver in your mouse case.
I think it may be possible for you to push the DPI activation code while driver is still using mouse, but how, I have no idea now.
Or you may detach mouse temporarily , pass the code, and then release mouse back to Windows, hoping that DPI config wouldn't be reseted.
If that doesn't pass, you may always completely emulate mouse driver. It is very easy.
There are code samples for PyUSB on internet on how to interpret mouse data. So you do it and you pass the recognized command to OS either directly through Windows API or using PyMouse library.
In this case you do not need driver, because your program is one, and it sends to mouse whatever you want.
You have a lot of options how to do what you want.
For instance, if this is only for your local use, and there is interface already doing what you want, automate that interface using pywinauto to perform a macro to activate/disable higher DPI.
There are more possibilities.
You can replace Windows driver with your own version, which will support what you wish, thus making your own layer in mouse stack. But this is extreme.
I think you should start in order I wrote:
See whether you can use PyUSB to send bytes needed without detaching mouse from OS
If not, see whether detaching mouse, changing DPI, and returning mouse back to OS using PyUSB keeps the set DPI.
3.1 If not, make your own artificial driver using PyUSB and PyMouse
or
3.2 Use pywinauto to automate the existing interface to change DPI for you.
I have been working with some drones and robotics projects using arduino and python. There was a kickstarter project for a neat little hex copter, that hasn't been managed well.
I was lucky, i got my copter and then some time later after some frustrated email exchanges, i finally recieved the camera as well. To this day, their forum has people still complaining. Their maker forum is now down and their wiki hasn't been updated with any specifics on the camera.
http://www.flexbot.cc/wiki/index.php?title=Main_Page#Hardware
Their app to accompany the drone still doesn't support the camera module. Not that it'd matter, as their code isn't very well documented or annotated.
https://github.com/HexAirbot
There are some tips on switching the camera on the comments page of their kickstarter campaign.
https://www.kickstarter.com/projects/1387330585/hex-a-copter-that-anyone-can-fly/posts/1093716
So, sob story over, i'm stuck with this neat little wifi camera that i am unsure on how to connect to. I know how to switch it on and it does have a micro-usb port on it.
What library in Python could i use to stream an image from this camera given that it is a wifi camera. If i wanted the video stream as a numpy matrix.
I need to interface with the camera, so i can connect and disconnect.
Then, be able to read images frame by frame with ffmpeg. I have some python modules that can detect and read from a camera, but how can my code ensure that the camera is connected?
Totally stuck. Any help would be appreciated.
Considering you are building for the android platform, you will more than likely need to use some sort of java/python driver/interface, unless you just use java.
Here is an article on java/python, and using python from within java.
Using Python from within Java
I am new to coding and I am trying to control ESCs through a PS3 controller which will be coded on the Raspberry Pi B+. I think this can be done, but i have read in a lot of places that I need to use an additional board? Is this the case?
I have found some code which i was going to manipulate..
http://www.raspians.com/Knowledgebase/ps3-dualshock-controller-inst...
http://mechnable.com/content/raspberry-pi-controlling-4-servos-via-...
Please advise me on if I need another board?
My project: is to create a system which can VTOL. So I wanted to control the ESCs with an input from the PS3 controller.