Code Monkey home page Code Monkey logo

openwrt's Introduction

NodoGsPlash no OpenWrt 19.07

Sistema de controle de acesso com OpenWrt + GoogleSheet/Script

Depedencias

$ opkg install nodogsplash libustream-openssl curl

Comandos

NodoGsPlash

$ /etc/init.d/nodogsplash restart
$ uci show nodogsplash
$ ndsctl clients

Serviços

Servidor GoogleScript

Salva as informações de login em uma planilha do Google. Para controlar o acesso, liberado ou bloqueado, o script rodando em no AP OpenWrt /etc/nodogsplash/start.sh baixa as lista de ALLOW ou DENY na planilha.

/**
* Função POST GoogleWeb
* @param {object} e Request params
* @returns {object} TextOutputs
*/
function doPost(e) {
  let body = JSON.parse(
    decodeURI(e.postData.getDataAsString())
  )
  let pass = decodeURI(body.pass).split("%3b")
  let values = {
    ...body,
    cpf: pass[0],
    ip: pass[1],
  }
  let status = appendRow([
    new Date(),
    values.name, 
    values.mac,,
    values.ip
  ])

  sendEmails({
    message: `
    Dispositivo cadastrado:
    
    Nome: ${values.name}
    MAC: ${values.mac}
    CPF: ${values.cpf}
    IP:  ${values.ip}`
  })
  
  return createTextOutput({body:values, status: status})
    .setMimeType(ContentService.MimeType.JSON);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.