• Stars
    star
    184
  • Rank 204,342 (Top 5 %)
  • Language
    Go
  • License
    Other
  • Created over 9 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Command line Gmail client

cmdg - A command line client to GMail

Copyright Thomas Habets [email protected] 2015-2021

https://github.com/ThomasHabets/cmdg

License

This software is dual-licensed GPL and "Thomas is allowed to release a binary version that adds shared API keys and nothing else".

Introduction

cmdg is a commandline client to GMail that provides a UI more similar to Pine/Alpine.

It uses the GMail API to interact with your mailbox. This has several benefits.

Benefits over IMAP

  • No passwords stored on disk. (application-specific passwords are also passwords, and can be used for more than GMail). OAuth2 is used instead, and cmdgs access can be revoked here. cmdg can only access your GMail, and cannot lose your password even if the machine it runs on gets hacked.
  • The "labels" model is native in the cmdg UI, unlike IMAP clients that try to map GMail labels onto IMAP.
  • Contacts are taken from your Google contacts
  • TODO: other benefits, I'm sure.

Benefits over the GMail web UI

  • Emacs-ish keys. If there's a need the key mapping can be made configurable.
  • Uses a real $EDITOR.
  • Really fast. No browser, CSS, or javascript getting in the way.
  • Proper quoting. The GMail web UI encourages top-posting. Ugh.
  • It uses 100% keyboard navigation. GMail web UI has very good keyboard navigation for a web app, but still requires mouse for a few things.
  • cmdg works without a graphic terminal.
  • cmdg uses less bandwidth (citation needed), and much less memory.
  • Local GPG integration. There are currently no good ways to integrate GPG with the GMail web UI.

A security difference

  • GMail web UI uses username and password to log in, which means they can be stolen. You should be using U2F Yubikeys, so that losing the password isn't as big of a deal. The user has to re-type the password every now and then, which is an opportunity for the attacker to steal the password.
  • OAuth token in cmdg.conf can be copied, and the thief would be able to access the users GMail until the key is revoked. The access does not expire on its own.

Installing

Building manually

$ go build ./cmd/cmdg
$ sudo cp cmdg /usr/local/bin

Homebrew (maintained by separate author)

brew tap cutzenfriend/homebrew-cmdg
brew install cmdg

Configuring

You need to configure cmdg in order to provide it with authentication so it can talk to GMail on your behalf. To do this you'll need to generate a ClientID and ClientSecret. You can do this with the following steps:

  1. Go to the Google Developers Console.
  2. Select an existing project or create a new project
  3. Navigate to the "APIs & Services > OAuth consent screen" page.
  4. Fill out the OAuth consent screen.
  5. Make sure to add scopes for the various APIs you'll need
    1. Drive API - .../auth/drive.appdata
    2. Gmail API - ../auth/gmail.modify
    3. People API - .../auth/contacts.readonly
  6. Click the button "Create Credentials" and select "OAuth client ID" from the dropdown.
  7. Set the "Application type" to "Desktop app" and make the name anything you'd like.
  8. This should give you a Client ID and Client Secret you can provide to cmdg.
$ cmdg -configure
[It will ask about ClientID and ClientSecret.
For now you have create one at https://console.developers.google.com]
Cut and paste this URL into your browser:
  https://long-url....
Returned code: <code shows up here, just FYI>
$

This creates ~/.cmdg/cmdg.conf.

Running

$ cmdg

For keyboard shortcuts press '?' or F1 in most screens.

To quit, press 'q'.

More Repositories

1

arping

ARP Ping
C
394
star
2

simple-tpm-pk11

Simple PKCS11 provider for TPM chips
C++
249
star
3

injcode

Inject code into a running process
C++
113
star
4

ssh-scripts

Some SSH-related scripts
Python
105
star
5

monotonic_clock

Portable C library for getting monotonic time
C
70
star
6

xor-analyze

Program for cryptanalyzing xor "encryption" with variable key length
C
42
star
7

ax25ms

This project is a set of AX.25 microservices, to be pluggable for any implementation.
C++
31
star
8

tlssh

TLS Shell
C++
25
star
9

eggpd

Erlang BGP daemon
Erlang
25
star
10

sshproxy

SSH Proxy / Load balancer
Go
22
star
11

bthelper

Bluetooth helper tools for setting up serial ports for e.g. SSH
C++
22
star
12

openssl-tpm-engine

TPM engine module for OpenSSL (this is not upstream)
Shell
20
star
13

radiostuff

My collection of gnuradio stuff
Python
20
star
14

rslurp

slurp down a whole HTTP directory, with parallel goodness
Go
19
star
15

sim

Multi Party Authorization version of sudo/doas
C++
16
star
16

gtping

GTP Ping
C
16
star
17

weberl

Like web.py, but for Erlang
Erlang
11
star
18

ind

Indent output from subprocess
C
11
star
19

clipsniff

Sniff the clipboard of a Unix X server.
C++
10
star
20

goircd

Minimalistic simple Internet Relay Chat (IRC) server
Go
10
star
21

pipebench

Measures the speed of stdin/stdout communication. I would actually recommend 'pv' over this program. I put it on github in order to collect everything in one place.
C
9
star
22

dejitun

De-jitter tunnel
C++
8
star
23

yhsmpam

YubiHSM PAM module backend
Python
8
star
24

hamtransfer

Tool for transferring files over amateur radio using modern techniques
Rust
7
star
25

goodpipe

Rust
7
star
26

qpov

Tool for converting Quake demo files to POV-Ray
Go
6
star
27

dotfiles

My dotfiles
C++
6
star
28

tlscheck

Quickly check TLS certificates of frontends and backends
Go
6
star
29

libopenpty

openpty() for platforms that don't have it
C
6
star
30

diamond_linking_example

Example of a diamond linking thingy with version problems. See http://blog.habets.pp.se/2012/05/Shared-libraries-diamond-problem
C
6
star
31

multitraceroute

Fast traceroute that does TCP, UDP and ICMP traceroute in parallel and shows the results in one big table.
Python
5
star
32

tcpstats

Collect stats on TCP connections on close()
Python
5
star
33

wifispace

GNURadio program for measuring how busy wifi channels are
C++
5
star
34

lightwave

Like google wave, but much dumber and written in erlang
Erlang
5
star
35

zipbrute

Old project for brute forcing zip file passwords I found in an old backup from 2001.
C
4
star
36

tarweb

Serve a static website from a tar file
C++
4
star
37

hamwebby

Web interface for remote rig control of ham radios
JavaScript
4
star
38

opwgen

Generate passwords like OPIE generates OTPs: readably
C
4
star
39

fluxbox

Fluxbox window manager
4
star
40

netmap

Make and organize network maps from data directly out of your routers
Go
4
star
41

gopload

Self-contained simple HTTP upload handler using websockets to show progress
Go
4
star
42

openvpn

OpenVPN, with SSL Engine (TPM) support
C
3
star
43

cert-sig-pin

Extract a certificate signature suitable for Chrome public key pinning.
Go
3
star
44

pam_externalpass

Spawn external program from PAM to do authentication
Shell
3
star
45

yurate

Curate Youtube videos so that you don't miss any subscribed content.
JavaScript
3
star
46

temp-to-cloud

Upload temperature measurements to Stackdriver
Go
3
star
47

go-uuid

Local mirror of deleted codesite project
Python
2
star
48

firewalls-at-the-source

Go
2
star
49

x11type

Simulate keypresses in X
Shell
2
star
50

travelling-amateur

Tool for finding rules for operating amateur radio while visiting another country.
JavaScript
2
star
51

autoscan

Web and LCD/button UI for scanning from a USB scanner directly into Google Drive
Go
2
star
52

udportknock

UDP portknock script
Shell
2
star
53

pgsql

Postgresql useful commands, to be run with psql [databasename] -f <filename>
2
star
54

brain

My brain
POV-Ray SDL
2
star
55

ychares

Yubikey challenge-response script
Python
2
star
56

netcat

netcat-openbsd with fixed TCP_MD5SIG for Linux
C
2
star
57

yoracle

Yubikey oracle
Python
2
star
58

3ggraph

Graph live information from a 3G dongle
Python
2
star
59

rustradio

Like GNURadio, but in Rust
Rust
2
star
60

irssi

irssi with TPM support
C
2
star
61

kybertest

CLI to encrypt files using quantum-resistant cryptography
C++
2
star
62

livecount

A widget for a web page (e.g. a blog post) that shows how many people (browsers) currently have the page open
Rust
2
star
63

airthingy

Tools for airthings API and bluetooth
Go
2
star
64

roodit

My reddit scripts
Python
2
star
65

drive-du

Cmdline and cloud tool for listing folder sizes in Google Drive
Go
2
star
66

mdsort

Maildir sorter
Python
1
star
67

closite

Redirect user to the closest site using javascript
JavaScript
1
star
68

smoog

My smugmug scripts
Python
1
star
69

openvpn-debian

OpenVPN, with SSL Engine (TPM) support
C
1
star
70

ndping

Like ARPing, but for IPv6
1
star
71

profy

Always-on VPN client scripts intended for Raspberry Pi or other small computers
Shell
1
star
72

libdropprivs

Example code (will be library) for dropping privileges
C
1
star
73

gr-habets38

My gnuradio components for gnuradio 3.8+
C++
1
star
74

doublecross-cpp

Experiments in making C++11 versions of things that exist in other languages. Such as the Maybe Monad from Haskell.
C++
1
star
75

tleservice

TLEService is a microservice for calculating satellite orbits.
Go
1
star
76

flight-radiation

Radiation data from a recent flight between LHR and SFO
Shell
1
star
77

sparslog

My implementation of an IKEA sparsnäs SDR receiver
Rust
1
star
78

keffos

Silly OS I wrote as a teenager
C
1
star