
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
electronsourcecontroller2-tspspi
Advanced tools
Python library and CLI for our custom electron gun slow-control system
Work in progress
The communication library from eguncom.py
implements most of the
communication protocol with the electron beam slow-control system.
class ElectronGunControl
The ElectronGunControl
class implements asynchronous and synchronous
communication with the serially / USB attached control system. The port file
is passed to the constructor
ctrl = ElectronGunNotConnected(portFile = '/dev/...')
When no port file is passed it defaults to /dev/ttyU0
.
The exposed public methods are:
Method | Description | Synchronous | Asynchronous callback |
---|---|---|---|
id() | Queries the current version | with sync = True | cbIdentify(controller, versionDate, versionRevision) |
getPSUVoltage(channel) | Queries the current voltage on the given channel | with sync = True | cbVoltage(controller, channel, voltageVolts) |
getPSUCurrent(channel) | Queries the current current on the given channel | with sync = True | cbCurrent(controller, channel, currentMicroamps) |
getPSUModes() | Checks if PSUs are off, in voltage limited or current limited mode | with sync = True | cbPSUMode(controller, states) |
getFilamentCurrent() | Queries the filament current | with sync = True | cbFilamentCurrent(controller, current) |
off() | Disabled all high voltage and filament currents | ||
setPSUPolarity(channel, polarity) | Sets polarity to POLARITY_POS or POLARITY_NEG | ||
setPSUEnable(channel) | Enables the given PSU channel | ||
setPSUDisable(channel) | Disables the given PSU channel | ||
setPSUVoltage(channel, voltage) | Sets the given channel to the given voltage | ||
setFilamentCurrent(currentMa) | Sets the filament current or target current to the specified milliamps | ||
setFilamentOn() | Enabled the filament supply | ||
setFilamentOff() | Disabled the filament supply | ||
runInsulationTest() | Runs an insulation test with low current limits | with sync = True | cbInsulation(isOk, listOfShorts) |
beamOn() | Runs the slow beam on sequence (slowly heating filament to previously set setFilamentCurrent, ramping up voltages) | with sync = True | cbBeamon() |
Example to perform a synchronous:
with ElectronGunControl() as ctrl:
# Currently a hack to wait for the control system to reset when using the
# primary port
time.sleep(5)
# We want to see the voltages reported by the system so we
# define a lambda that just prints the voltages while ramping up
# during insulation test and beam on sequence
ctrl.cbVoltage = lambda c,chan,v : print("Voltage for channel {} is {} V".format(chan, v))
# Query it's identity
ret = ctrl.id(sync = True)
print("ID call returned {}".format(ret))
# Run insulation test
print("Running insulation test")
ret = ctrl.runInsulationTest(sync = True)
print("Insulation test returned: {}".format(ret))
# Run beam on sequence ...
ret = ctrl.beamOn(sync = True)
print("Beam on successfully returned: {}".format(ret))
print("Sweeping focus voltage")
for focusVoltage in range(1750,1950):
print("New focus voltage {}".format(focusVoltage))
ctrl.setPSUVoltage(3, focusVoltage)
time.sleep(1)
ctrl.off()
print("Off, done ...")
FAQs
Python library and CLI for our custom electron gun slow-control system
We found that electronsourcecontroller2-tspspi 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.