Giter Club home page Giter Club logo

suspicious-logger's Introduction

Suspicious Logger

A CLI tool for examining Google Apps login events.

Setup

To start you need Maxmind's GeoIPlite data files:

./GeoIP_data/update.sh

Then install the required Python modules:

pip install -r requirements.txt

This tool is developed with python3 in mind, but aside from some UTF-8 handling it will mostly work in python2.

Next, you must provision OAuth credentials for the tool to run:

  1. Log in to GApps using a Superadmin account.
  2. Go to the Google APIs Credentials page and select "Create credentials".
  3. Select "OAuth Client ID" as the type of credential to create.
  4. For "application type" select "Other" and enter "SuspiciousLogger" or something which will clearly be associated with the purpose.
  5. The API credentials page will now yield a client_id and client_secret.
  6. Copy client_secrets.json.example to client_secrets.json.
  7. Copy and paste the client_id and client_secret into the matching fields in client_secrets.json.
  8. Finally, run a test query in the tool (i.e. ./SuspiciousLogger.py ${USER}@example.com list), this will lead to the tool presenting a URL.
    1. Copy and paste the URL into a browser session where your Superadmin account from step one is logged in.
    2. Accept the access requested by the tool, which will yield a code.
    3. Paste the code from the prior step into the SuspiciousLogger prompt.

NOTE: This API is near real-time but inexplicably lags behind email notices of "suspicious logins" by days, weeks or even months. THANKS GOOGLE.

Examples

List all logins from an IP:

./SuspiciousLogger.py 10.0.0.33 list

List all logins from a CIDR block:

./SuspiciousLogger.py 10.0.0.0/24 list

List all logins for a User:

./SuspiciousLogger.py [email protected] list

List only successful logins:

./SuspiciousLogger.py [email protected] events login_success

List all failed google_password events:

./SuspiciousLogger.py [email protected] events login_failure --filters 'login_type==google_password'

List all suspicious logins:

./SuspiciousLogger.py all events login_success --filters 'is_suspicious==true'

List all suspicious logins for a user:

./SuspiciousLogger.py [email protected] events login_success --filters 'is_suspicious==true'

List all suspicious SAML logins from a CIDR block:

./SuspiciousLogger.py 10.0.0.0/24 events login_success --filters 'login_type==saml,is_suspicious==true'

List all non-suspicious, non-SAML logins from a CIDR block:

./SuspiciousLogger.py 10.0.0.0/24 events login_success --filters 'login_type<>saml,is_suspicious<>true'

API Documentation

The documentation for the google-api-python-client library is avialable here:

https://developers.google.com/api-client-library/python/start/get_started

Documentation on some relevant event types for events and "--filters":

https://developers.google.com/admin-sdk/reports/v1/reference/activity-ref-appendix-a/admin-gmail-events
https://developers.google.com/admin-sdk/reports/v1/reference/activity-ref-appendix-a/login-event-names

suspicious-logger's People

Contributors

maxrp avatar

Watchers

 avatar  avatar

Forkers

dustinak

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.