Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
To provide an easy-to-use, object-oriented instrument interface for the DATAQ DI-2008 from within any Python environment.
The intent of this project is not to provide an API that will be useful in 100% of use cases, but will target the 90%. In my experience, most of us need pretty basic functionality and have only modest timing requirements when working with such instrumentation. As a result of this, the API will attempt to abstract away the lowest-level functionality which may result in a hiding or loss of feature implementation available in the hardware. If this happens to you, feel free to use the nuts and bolts exposed herein to inform your own development or, better yet, send us a pull request!
Check out the documentation!
The hardware drivers must be installed before this package may be utilized. Hardware drivers may be downloaded from the manufacturer's product page.
Once drivers are installed:
$> pip install di2008
The objects provided are tested and demonstrated to function well, however, there are still some features that have not been implemented.
Items marked out have already been completed. The list is in approximate order of priority and marked out items have been completed.
Regarding the specifics of usage, it may be very helpful for the user to read the device documentation so that some of the concepts enshrined herein are more precisely interpreted. Specifically, the concept of a "scan list" is somewhat unique to the product and difficult to abstract. As the project matures, more of the hardware idiosyncrasies are expected to be exposed to the user.
When deploying using pyinstaller
in a windows environment, the pyusb
library doesn't
play well with libusb-1.0.dll
, so you will need to package libusb0.dll
into your
pyinsteller *.spec
file using the following line:
datas=[('C:\\Windows\\System32\\libusb0.dll', '.'),],
Place device into 'USB' mode, not COM mode!!!
The device setting is persistent and will not need to be changed again.
If you see a COM port in your device manager with the label DATAQ DI-2008
then the device is NOT in the correct mode!
To read a few analog inputs, device setup is relatively simple.
Di2008
instanceSome sample code might be more illuminating. A simple script to set up the scan list and to print the values every second:
from time import sleep
from di2008 import AnalogPort, RatePort, Di2008
# create each of the inputs that need to be sampled
an0 = AnalogPort(1, analog_range=10.0, filter='average')
an1 = AnalogPort(2, thermocouple_type='j')
an2 = AnalogPort(3, thermocouple_type='j')
rate = RatePort(5000)
daq = Di2008()
daq.create_scan_list(
[an0, an1, an2, rate]
)
daq.start()
while True:
print(f'{an0.value:.02f}')
print(f'{an1.value:.02f}')
print(f'{an2.value:.02f}')
print(f'{rate.value:.02f}')
print()
sleep(1.0)
FAQs
Object-oriented API for DATAQ DI-2008
We found that di2008 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.