Giter Site home page Giter Site logo

sms_requests_for_gb's Introduction

SWUbanner

Requesting additional data package from my provider

Problem

I'm using a couple of 4G devices with unlimited data plan, but my provider has a data cap 10GB per day after which another 2GB may be requested via SMS.

Luckily my provider also notifies user about 80% and 100% usage of daily data or additional packages and my 4G devices can send/receive messages.

So the plan is something like this:

┌───────────────────┐
│ Login to a device │
└─────────┬─────────┘
          │
┌─────────▼────────────────┐ No
│ Is there any unread SMS? ├─────────┐
└────┬─────────────────────┘         │
  Yes│                               │
┌────▼──────────────────────┐ No     │
│ Is it a 80% notification? ├────────┤
└────┬──────────────────────┘        │
  Yes│                               │
┌────▼───────────────────────────┐   │
│ Send a request for another 2GB │   │
└────────┬───────────────────────┘   │
         │                           │
┌────────▼────────────────────────┐  │
│ (And mark all messages as read) │  │
└────────┬────────────────────────┘  │
         │                           │
┌────────▼────────────┐              │
│ (And logout please) │              │
└─────┬───────────────┘              │
      │                              │
┌─────▼───┐                          │
│ OK, bye │◄─────────────────────────┘
└─────────┘

Implementation

Huawei E3372 (HiLink)

The first device is a USB-dongle which pretends to be a router. Fortunately, the guys from Huawei didn't bother to make things complicated and even provide an ability to disable password.

Endpoints are clear and understandable, only requirement is to request headers to use with each request. Sometimes headers became invalid, so my solution was pretty straightforward: just request new pair before each request.

Kudos to lmoodie for the implementation of the most part of this project.

You can find my implementation in hilinksms.py.

Tested on E3372 with sowftware version 22.328.62.00.1217.
Seems like it works just fine.

TpLink TL-MR100 (cgi_gdpr)

This one was hard.

It's some old 4G router which just does its job.

Someone in TpLink decided to make things complicated and encrypt communication between web interface and API. To communicate with a router you need to know password, request rsa keys, authorize and get jsession id, request token. When you get those artifacts it's time to use them properly and reverse their API to do something. Also, do not forget to log out and avoid doing something while having active session in a browser.

Kudos to 0xf15h for implementing crypto for this device in python which is reused here.

Kudos to hertzg for his implementation of API using Node.js.

My implementation (tplinksms.py) does not cover proper payload formation and consists of intercepted messages from web-client. Maybe in future I'll fix it, but most probably I won't =).

Tested on TpLink TL-MR100 v1 00000001 with software version 1.4.0 0.9.1 v0001.0 Build 210601 Rel.32393n

It may eventually fail while requesting jsession id or (much rare case, actually) rsa keys.
But works again on a retry.

Another issue: SMS may be fetched after 1-2 minutes after receiving. 

Also, if someone curious how web-ui communicates with API:
 - look to /js/proxy.js from router's web-client
 - function called tpAjax
 - outcoming message encrypted by Iencryptor.AESEncrypt
 - incoming response in decrypted by Iencryptor.AESDecrypt

How to use

  1. Install dependencies
  2. Hardcode your IP addresses and/or password (or add parameters)
  3. Modify SMS content if needed.

sms_requests_for_gb's People

Contributors

odayny avatar

Watchers

 avatar

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.