Socket
Socket
Sign inDemoInstall

@brightsign/bsc

Package Overview
Dependencies
Maintainers
31
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightsign/bsc

Simple Node CLI App to communicate with a BrightSign player over the LAN using the Local DWS REST HTTP APIs.


Version published
Weekly downloads
3
decreased by-57.14%
Maintainers
31
Weekly downloads
 
Created
Source

BrightSign CLI API Tool

The purpose of this package is to allow users to communicate with the BrightSign's Local DWS (Diagnostic Web Server) REST HTTP APIs through a simple CLI tool, bsc.

It is assumed you have the requirements for doing basic node.js development already installed. To support this example, you also need to run the following in this folder:

npm i

Latest Local DWS REST API Documentation as of August 15, 2023. Local DWS APIs

Installing NPM Module from source

First, clone this repository to your preferred location. Once cloned, navigate to the directory that you stored this code in.

The following will need to be run to build the npm module. bsc will be built and ready to use.

npm -g install

Configuring Players Locally

For ease of use this CLI has introduced a locally stored player configuration object. This object stores relevant player information under a "playerName" (that you choose, independent of the player's name in BACon, bDeploy, or any other service where player names are required), allowing the player to be interacted with at the command line by just using the player name. This configuration object is stored in a hidden directory on your home directory path, or ~/.bsc/players.json, and is automatically generated when you use the CLI.

When you first try and use a command, if you have not configured the CLI for at least one player, the command will not be run and instead you will be prompted to configure your first player. Simply enter the name you want to give to your player, the ip address, the username and the password of the player, and the player's storage device. Remember that by default, the player's digest authentication username is 'admin' and the password is the serial number. Additionally, the CLI will automatically set the username to 'admin' and the storage device to 'sd' if those fields are left blank.

Once the CLI has generated the player configuration object, you can freely add, remove and edit the players stored within it. To add a new player, use:

bsc addplayer <playerName> <ipAddress> [username] [password] [storage]

You can remove players from your configuration with:

bsc rmplayer <playerName>

And you can edit a player's properties with:

bsc editplayer <playerName> -p password -i ipaddress -u username -s storage

Note here that none of the options are required but all can be changed at once.

Finally, to view your configuration file and the properties of each player, use:

bsc listplayers

Note to use file upload, the password must not be set on the player. You can easily turn off the password using setpw or from the lDWS front end. This is a WIP and this doc will be updated when this functionality exists.

Usage

This CLI uses a player configuration object to interact with your player(s). To configure the CLI to interact with a player, refer to configuring players locally.

A list of commands and their structure can be seen by typing bsc, bsc -h or bsc --help. There's also a table of the currently supported features and their command structure below in the features section. All commands (except raw and listplayers) use a 'playerName'. This is the name that you set in players.json. Some commands use 'positionals', or options that must be in a certain spot. These positionals are shown in the 'help' section and on the features table. Positionals listed with <> are required and ones with [] are optional. Certain commands also have options. Options are not defined by position but rather by a tag, for example bsc editplayer playerName -i newIP. In that example the new IP address is the option, defined by '-i'. Options can be in whatever order you want. For information on a command and its options, use bsc command with no positionals or options.

Troubleshooting

Sometimes you will run into errors while using this CLI. The CLI has built in error handling that should give you information on the error you encountered as well as troubleshooting tips. However, the error handler does not have info on every possible error, so you may run into errors that are not handled. If this is the case, there are certain troubleshooting steps that you can walk through to hopefully fix your problem.

  1. Check that you can communicate with the player
    1. Is the player on? Is the DWS on?
    2. Is the player on the same LAN as you?
    3. When you make a request with the CLI, does it show in the player's logs?
  2. Check your local player info
    1. Use bsc listplayers. Does that info look right?
    2. Use bsc checkpw playerName. This will return information about your local password and the password on the player
    3. Did you input the correct playerName?
  3. Check the Github issues page
    1. Maybe others have ran into this before
  4. If none of these work, and your own troubleshooting methods also fail, please open a Github issue and/or a Jira issue (under the PE project, linked to PE-52) with reproduction steps.

Note: We ask that if you encounter an error that is not handled by the error handler (if the error is an API error, the error handler will tell you if it doesn't have info on your error. If it's another type of error, that error will be printed on you command line) that you open a Github issue and report it. This will allow the dev team to implement error handling around your error.

Features

FeatureImplemented?FunctionUsage
addplayer[x]Add player configuration to players.jsonbsc addplayer <playerName> <ipAddress> [lDWS username] [lDWS password]
rmplayer[x]Remove player configuration from players.jsonbsc rmplayer <playerName>
editplayer[x]Edit an already existing player's infobsc editplayer <playerName> -i [playerIP] -u [playerUsername] -p [playerPassword]
listPlayers[x]List players and their configuration in players.jsonbsc listplayers
getdi[x]Get device info in the form of a JSON objectbsc getdi <playerName>
putfile[x]Put file/files on a player. Specify a single file or a directory of files and the upload location (optional). Note that this only works when the player does not have a password set. The location option is exclusively a directory, not the filename it will be stored asbsc putfile <playerName> <File/Directory> [location]
getfiles[x]get the files on the player's storage or in a certain directorybsc getfiles <playerName> [path]
delfile[x]Delete a file on the playerbsc delfile <playerName> <path>
reboot[x]Reboot the specified playerbsc reboot <playerName>
checkpw[x]Check if lDWS password is enabledbsc checkpw <playerName>
setpw[x]Change the DWS password, both locally and on the playerbsc setpw <playerName> [newPassword]
screenshot[x]Take a screenshotbsc screenshot <playerName>
raw[x]Make API requests 'raw', not using the locally configured playersbsc raw -i <targetIP> -p [targetPassword] -m <requestMethod> -r <requestRoute> -a [rawResponseBool] -f [file]
settime[x]Set the player's timebsc settime <playerName> <timezone> <time> <date> [applyTimezone]
gettime[x]Get the player's timebsc gettime <playerName>
checkdws[x]Check if the DWS is enabled or notbsc checkdws <playerName>
setdws[x]Toggles DWS on/offbsc setDWS <playerName> <on/off>
getlogs[x]Gets logs from the player and puts them in a local filebsc getlogs <playerName>
facreset[x]Factory resets the playerbsc facreset <playerName>
getreg[x]Gets the registrybsc getreg <playerName> [section] [key]
setreg[x]Edits certain sections of the registrybsc editreg <playerName> <section> <key> <value>

Raw Requests:

bsc also supports raw API requests:

bsc raw -i <targetIp> -p [targetPassword] -m <reqMethod> -r <reqRoute> -a [rawResponse]

For example:

bsc raw -i=192.168.128.148 -p=ABC01A000001 -m=GET -r="info"
bsc raw -i=192.168.128.148 -p=ABC01A000001 -m=GET -r="files/sd"

Push a file with raw command:

bsc raw -i=192.168.128.148 -p=ABC01A000001 -m=PUT -r="files/sd" -f="PATH"

Formatting Responses

Install the tool jq to prettify the JSON response structures.

jq examples

Parse the keys:

bsc raw -a=true -i=192.168.128.101 -p=ABC01A000001 -m=GET -r="info" | jq 'keys'

Prettify the entire response:

bsc raw -a=true -i=192.168.128.101 -p=XAE28N000058 -m=GET -r="info" | jq '.data.result'

Parse the model from /info

bsc raw -a=true -i=192.168.128.101 -p=ABC01A000001 -m=GET -r="info" | jq '.data.result.model'

FAQs

Package last updated on 31 Aug 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc