Guide / The Cyber Rakshak command line
The Cyber Rakshak command line
Sign in from a terminal, set up error monitoring in a project, and read your company's laptops, security events and servers.
Install
cyberrakshak shows what the console shows you, and nothing more; for security it only reads. It needs Node.js 18 or later and has no dependencies.
npm install -g @cyberrakshak/cli
cyberrakshak --helpSign in
- Run
cyberrakshak login. Your browser opens at app.cyberrakshak.ai. - Sign in as you do on the website, with two-factor if you use it. If you signed in to the website more than 10 minutes earlier, it asks you to confirm it is you.
- Check the computer's name on Connect the command line? and press Allow. Back in the terminal, you are signed in.
The browser hands the sign-in back only to your own computer (http://127.0.0.1), with a one-time code that works once, for a minute, and only with a secret the command keeps in memory.
cyberrakshak login # opens your browser
cyberrakshak login --no-browser # SSH and servers: shows a code instead
cyberrakshak login --read-only # a sign-in that only reads: it cannot make app keys
cyberrakshak whoami # who you are signed in as, and what your account has
cyberrakshak logout # ends the sign-in, then removes it from this computerOn a server or over SSH, cyberrakshak login --no-browser shows a code instead. On any phone or computer, open app.cyberrakshak.ai/cli/activate, sign in, type the code and press Continue. The next page shows which computer asked and where it asked from: check them, then press Allow. The code lasts 10 minutes.
Where the sign-in is kept, and when it ends
- It is kept for your user only:
%APPDATA%\cyberrakshak\credentials.jsonon Windows,~/.config/cyberrakshak/credentials.jsonon macOS and Linux. - It works only for the command line: it does not open the website, the apps or anything else. It is not one of your plan's computers.
- It ends when you run
cyberrakshak logout, when you revoke it, after 30 days unused, or a year after it was made. - To see and revoke them: Sign-in & two-factor → Command line in the console lists every computer the command line is signed in on, each with Revoke.
CI and servers
When CYBERRAKSHAK_TOKEN is set, it is used as the sign-in. Give CI and servers a read-only one: this prints it once, without saving it, so you can store it as a secret.
cyberrakshak login --no-browser --read-only --print-tokenA job that only reports its failures (cyberrakshak run) needs no sign-in at all, only the site's app key.
Set up error monitoring
These commands are for the websites your account monitors for errors, which is in early access: see Monitor errors in your apps, servers and scripts.
cyberrakshak sites # your websites, with monitoring state, app key and open problems
cyberrakshak keys create example.com # the site's app key, shown once (--replace makes a new one in its place)
cyberrakshak init --site example.com # in your project's folder: the library, the key in .env, how it starts
cyberrakshak test # sends a test problem with the app key and checks it arrived
cyberrakshak run -- ./backup.sh # runs it; if it fails, reports it
cyberrakshak errors example.com # the site's problems (--resolved, --platform server, --page 2)initworks out what the folder is (Node.js, React Native or Expo, PHP, Python, Android, iOS, otherwise shell scripts), installs the library with its package manager and writes the key to.envasCR_MONITOR_KEY(EXPO_PUBLIC_CR_MONITOR_KEYfor Expo), never into a file git tracks. It warns you when.envis not in.gitignore. For Android and iOS it prints the lines to add, and for mobile apps it says where the key goes.--no-installonly says what to run.testsends a warning named "Test from the Cyber Rakshak command line" with the app key, then checks the site's Errors page until it is there (up to 15 seconds).runruns the command as it is and ends with its exit code. If it fails, it reports the command's name (never its arguments), its exit code and the last 20 lines of its standard error, scrubbed by the same rules as every library. Ctrl+C is not reported.
Read your company's security
cyberrakshak laptops # your company's laptops and their status (--status critical, --search …)
cyberrakshak alerts # security events not reviewed yet (--all for every one)
cyberrakshak servers # your servers and what they saw in 24 hours
cyberrakshak servers alerts # the newest alerts (--period 24h|7d|30d, --serious)Laptops and security events are for whoever manages the company in the console (its owner and admins). A company that asks its managers for two-factor sign-in shows them nothing without it, here as on the website. Servers are for the accounts that see Servers in the console. Nothing here quarantines, blocks or changes a setting: do that in the console.
In scripts
Every command takes --json: one JSON document on standard output (an error is {"error": {"code", "message"}}), with notes and progress on standard error. No request waits longer than 15 seconds.
| Exit code | Meaning |
|---|---|
| 0 | Done. |
| 1 | It ran and did not succeed (a test that did not arrive, a download that did not match, a key that is already there). |
| 2 | The command or its options were wrong. |
| 3 | Not signed in, or the sign-in has ended. |
| 4 | Not available on your account, or not found on it. |
| 5 | The console could not be reached, did not answer in 15 seconds, or had a problem answering. |
run ends with the command's own exit code. The source code is on GitHub, under the MIT licence.
More in the guide
- Get started on a Windows computerCreate an account, install Cyber Rakshak and switch protection on, in about ten minutes.
- Using the appWhat each screen of Cyber Rakshak for Windows shows, and what its buttons do.
- Company computersProtect every computer in an office from one console. Employees do not need their own accounts.
- Plans and billingBuy, renew or change your plan, and what happens when a trial or plan ends.
- TroubleshootingWhat a message means and what to do about it.
- Monitor errors in your apps, servers and scriptsSend what goes wrong in your own Node.js, React Native, PHP, Python, Android and iOS code, and your shell scripts, to your website's Errors page.