Skip to content

Instantly share code, notes, and snippets.

View simonmorley's full-sized avatar

Simon Morley simonmorley

  • London
View GitHub Profile
@simonmorley
simonmorley / common-curls.md
Last active January 18, 2017 20:25
Common API calls for the Cucumber WiFi API

Each request must be authorized with a bearer. Get this bearer by using the oauth flow explain elsewhere. Or, use the login API below. Set your token in your ENV:

T=my-secure-token

##Log a user in

curl -F grant_type=password \
BSS 82:2a:a8:48:cf:4e(on wlan0-1)
TSF: 86435509345 usec (1d, 00:00:35)
freq: 5180
beacon interval: 100 TUs
capability: ESS (0x0011)
signal: -74.00 dBm
last seen: 1860 ms ago
Information elements from Probe Response frame:
SSID: Unruly-Hive
RSN: * Version: 1
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mosquitto Websockets</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="config.js" type="text/javascript"></script>
<script type="text/javascript">
var mqtt;
" plugins expect bash - not fish, zsh, etc
set shell=bash
" which key should be the <leader>
" (\ is the default, but ',' is more common, and easier to reach)
let mapleader=","
" pathogen will load the other modules
execute pathogen#infect()
@simonmorley
simonmorley / gist:e8318ad1db8474494ce15432d724af77
Last active September 12, 2016 10:37
SocketMan OpenWRT Test Makefile
# Copyright (C) 2016 Cucumber WiFi
#
# This is free software, licensed under the GNU General Public License v2.
CUCUMBER="-D__OPENWRT__"
# CUCUMBER += "-D__OPENWRT__"
# TARGET_CFLAGS += $(FPIC)
# TARGET_CFLAGS += "-DPUMPY"
# TESTING=-DPUMPY
@simonmorley
simonmorley / Coova Chilli OpenWRT Working Init
Created September 3, 2016 18:08
OpenWRT init file for coova chilli, including support for multiple coova instances
#! /bin/sh
### BEGIN INIT INFO
# Provides: chilli
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start CoovaChilli daemon at boot time
# Description: Enable CoovaChilli service provided by daemon.
### END INIT INFO
{
"c_state": nil,
"chain": "FORWARD",
"created_at": "2016-07-04T16:15:10.048+01:00",
"ct_tag": "auto_isolate_traffic",
"dest_ip": "local",
"dest_port": nil,
"layer7": nil,
"layer7kernel": nil,
"limit": nil,
SESSION TIMELINES
Includes the timeline of sessions, average session, max, count etc.
curl 'https://api.ctapp.io/api/v1/reports?interval=day&sessions=true' -H 'origin: https://my.ctapp.io' -H "authorization: Bearer $BEARER" --compressed
SESSIONS
curl 'https://api.ctapp.io/api/v1/sessions' -H "authorization: Bearer $bearer" --compressed
require "base64"
require "google/api_client"
key_file = "./google.p12"
key_secret = 'notasecret'
key = Google::APIClient::KeyUtils.load_from_pkcs12(key_file, key_secret)
service_account_email = '@developer.gserviceaccount.com'
auth_params = {
token_credential_uri: "https://accounts.google.com/o/oauth2/token",
@simonmorley
simonmorley / google pubsub golang pull example
Created March 26, 2016 12:31
google pubsub golang pull example
package main
import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/cloud"
"google.golang.org/cloud/pubsub"
"io/ioutil"
"log"
)