Giter Site home page Giter Site logo

smsstore's Introduction

smsstore

Minimalistic server written in go that provides REST endpoints to receive messages as a json paylod as defined by the android sms forwarding app "SMS an PC/Telefon - Automatische Umleitung" and expose the recived message.

Supports simplisitc user and autentification support.

API Specifiction

POST /messages Stores a message for a user

Required parameters: user, pass

Example Payload: {"subject": "foo", "message": "bar"}

Test API:

curl -X POST -H 'Content-Type: application/json' -d '{"subject": "foo","message": "bar"}' https://localhost/messages/?user=test&pass=1234

POST /messages Provides last recived message (without subject) for a speified user as text

Required parameters: user, pass

Test API: curl "https://localhost/messages/?user=test&pass=1234"

Usage

Install go (macos)

Install Brew (skip if you already did)

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install go brew update&& brew install golang

Install go (linux)

sudo apt install golang-go

Build

go build smsserve.go

Run

Create the user file and add a user

touch users
echo "test:1234" >> users

Run the server

./smsserve

Turning it into a service

Create a file called /etc/systemd/system/smsstore.service:

[Unit]
Description=smsstore service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=centos
ExecStart=/opt/smsstore/smsserve

[Install]
WantedBy=multi-user.target
  • set your actual username after User=
  • set the proper path to your script in ExecStart=

Start the service:

systemctl start smsstore

To get it to automatically get it to start on boot:

systemctl enable smsstore

Usage for automatic login to a site with a OTP (one time password)

Forwarding the message

Install the app "SMS an PC/Telefon - Automatische Umleitung" on your andrioid phone.

Configure an SMS forwarding to a REST server and anter the url of your server e.g.: curl "https://localhost/messages/?user=test&pass=1234"

Autologon

Install the Tempermonkey brower extention

Adapt the provided "example_userscript.js# userscript to retrieve the message form the server and fill out the web logon form

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.