Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bundle add obsws
bundle install
Use
main.rb
Pass host
, port
and password
as keyword arguments.
require "obsws"
class Main
INPUT = "Mic/Aux"
def run
OBSWS::Requests::Client
.new(host: "localhost", port: 4455, password: "strongpassword")
.run do |client|
# Toggle the mute state of your Mic input and print its new mute state
client.toggle_input_mute(INPUT)
resp = client.get_input_mute(INPUT)
puts "Input '#{INPUT}' was set to #{resp.input_muted}"
end
end
end
Main.new.run if $PROGRAM_NAME == __FILE__
Passing OBSWS::Requests::Client.run a block closes the socket once the block returns.
Method names for requests match the API calls but snake cased.
example:
# GetVersion
resp = r_client.get_version
# SetCurrentProgramScene
r_client.set_current_program_scene("BRB")
For a full list of requests refer to Requests
Register blocks with the Event client using the on
method. Event tokens should match the event name but snake cased.
The event data will be passed to the block.
example:
class Observer
def initialize
@e_client = OBSWS::Events::Client.new(host: "localhost", port: 4455, password: "strongpassword")
# register blocks on event types.
@e_client.on :current_program_scene_changed do |data|
...
end
@e_client.on :input_mute_state_changed do |data|
...
end
end
end
For a full list of events refer to Events
For both request responses and event data you may inspect the available attributes using attrs
.
example:
resp = @r_client.get_version
p resp.attrs
@e_client.on :input_mute_state_changed do |data|
p data.attrs
end
If a general error occurs an OBSWSError
will be raised.
If a connection attempt fails or times out an OBSWSConnectionError
will be raised.
If a request fails an OBSWSRequestError
will be raised with a status code.
req_name
code
For a full list of status codes refer to Codes
To enable logs set an environmental variable OBSWS_LOG_LEVEL
to the appropriate level.
example in powershell:
$env:OBSWS_LOG_LEVEL="DEBUG"
To run all tests:
bundle exec rake -v
For the full documentation:
FAQs
Unknown package
We found that obsws demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.