Skip to content

The node-firewalla package is a NodeJS module which allows you communicate with your Firewalla box

License

Notifications You must be signed in to change notification settings

lesleyxyz/node-firewalla

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-firewalla

Package to talk your firewalla box & API

If you want to get your firewalla token, or want to help reverse engineering firewalla, checkout firewalla-tools

If you like my work, give this repository a or consider Buying Me A Coffee ☕

Installation

npm install node-firewalla

Examples

import { SecureUtil, NetworkService, FWGroup, FWGroupApi, HostService } from 'node-firewalla'

// Import your public & private key (by file name)
SecureUtil.importKeyPair(publicKeyPath, privateKeyPath)

// Login & get firewalla box
let { groups } = await FWGroupApi.login()
let fwGroup = FWGroup.fromJson(groups[0])

// Send a ping message
let networkService = new NetworkService(fwGroup)
let pingResult = await networkService.ping()

// List all hosts connected to your firewalla
let hostService = new HostService(fwGroup)
let hosts = await hostService.getAll()

Authenticating

First time

To authenticate the first time with your firewalla box, use the create-etp-token script in firewalla-tools. This will generate a public & private key that you need to keep.

Other times

Now you simply have to use SecureUtil to import your keys.

import { SecureUtil } from 'node-firewalla'

// using a file name e.g. etp.public.pem
SecureUtil.importKeyPair(publicKeyPath, privateKeyPath)

// using a string e.g. "----BEGIN PUBLIC KEY---- ..."
SecureUtil.importKeyFromString(publicKeyPath, privateKeyPath)

Then to get your firewalla box(es) (a.k.a FWGroup), you will have to login first.

import { FWGroupApi, FWGroup } from 'node-firewalla'

let { groups } = await FWGroupApi.login()
let fwGroup = FWGroup.fromJson(groups[0], "192.168.1.1")

Currently this package doesn't fully support cloud communication, so you will still have to supply your box's IP like above.

Now you can use all the service classes to your hearts content :)

Services

To use a service, you first have to supply the FWGroup (box) to its constructor, e.g.

import { AlarmService } from 'node-firewalla'

// Ignore all current alarms
let alarmService = new AlarmService(fwGroup)
let pingResult = await alarmService.ignoreAll()

AlarmService

Manage alarms

.getAll

.getById

.getDetailsById

.ignoreAll

.ignoreById


BoxService

Manage your box

.shutdown

.shutdownCancel

.reboot

.upgrade


FeatureService

Manage features that your box uses

.enableFeature

.disableFeature


HostService

Manage hosts connected to your box

.getAll

.wakeHost


InitService

Get initial data of your box

.init

.liveStats (WIP)


NetworkService

Manage your firewalla network

.ping

.runSpeedTest

.getSpeedtestResults

.getMonthlyDataUsage

.getLast12MonthlyDataUsage

.getNetworkMonitorData

.getDataPlan

.getMyPublicKey

About

The node-firewalla package is a NodeJS module which allows you communicate with your Firewalla box

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published