# NervesBackdoor

This RESTish API covers the following basic needs:

- Network setup (eth0)
- Database backup and restore
- Password reset (thru file upload) 

## API

curl http://nerves.local:31680/ping
curl http://nerves.local:31680/data/$DB.db3 --output /tmp/$DB.db3
curl -F 'data=@/tmp/$DB.db3' http://nerves.local:31680/upload?path=/data/$DB.db3
curl http://nerves.local:31680/net/state/eth0
curl http://nerves.local:31680/net/setup/eth0 -H "Content-Type: application/json" -X POST -d '{"method":"dhcp"}'
curl http://nerves.local:31680/net/setup/eth0 -H "Content-Type: application/json" -X POST -d '{"method":"static", "address":"", "prefix_length":8, "gateway":"", "name_servers":[""]}'
curl http://nerves.local:31680/app/start/$APP
curl http://nerves.local:31680/app/stop/$APP

## Helpers

Application.get_all_env :nss
ls "/data"
VintageNet.get(["interface", "eth0", "type"])
VintageNet.get(["interface", "eth0", "state"])
VintageNet.get(["interface", "eth0", "connection"])
VintageNet.configure("eth0", %{type: VintageNetEthernet, ipv4: %{method: :dhcp}})
VintageNet.configure("eth0", %{type: VintageNetEthernet, ipv4: %{method: :static, address: "", prefix_length: 8, gateway: "", name_servers: [""]}})

## Installation

Install into nerves project as described at

If [available in Hex](, the package can be installed
by adding `nerves_backdoor` to your list of dependencies in `mix.exs`:

def deps do
    {:nerves_backdoor, "~> 0.1.0"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](

## Research

- Restrict cowboy listener to usb0 interface
- Device discovery