Giter VIP home page Giter VIP logo

credking's Introduction

CredKing

Overview

Easily launch a password spray using AWS Lambda across multiple regions, rotating IP addresses with each request.

Brought to you by:

Black Hills Information Security

Benefits

  • Fully supports all AWS Lambda Regions
  • Multi-threaded processing
  • Generates user/password pairs
  • Easily add new plugins
  • Automatically creates execution role and lambdas

Basic Usage

usage: credking.py [-h] --plugin PLUGIN [--threads THREADS] --userfile USERFILE --passwordfile PASSWORDFILE --access_key ACCESS_KEY --secret_access_key SECRET_ACCESS_KEY [--useragentfile USERAGENTFILE]

Arguments:
  -h, --help                            show this help message and exit
  --plugin PLUGIN                       spraying plugin
  --threads THREADS                     thread count (default: 1)
  --userfile USERFILE                   username file
  --passwordfile PASSWORDFILE           password file
  --access_key ACCESS_KEY               aws access key
  --secret_access_key SECRET_ACCESS_KEY aws secret access key
  --useragentfile                       useragent file

Plugin Usage

Gmail

The Gmail plugin does not require any additional arguments.

Okta

The Okta plugin adds a new required argument called oktadomain.

usage: credking.py <usual arugments> --oktadomain org.okta.com

Installation

Ubuntu 16.04

You can install and run automatically using Python 3 with the following command:

$ git clone https://github.com/ustayready/CredKing
$ cd CredKing
~/CredKing$ python3 credking.py

Note that Python 3 is required.

Bug reports, feature requests and patches are welcome.

Development

You can create new plugins by:

$ cd plugins
$ mkdir newplugin
$ cd newplugin
$ touch __init__.py
$ touch newplugin.py

Next, make sure to include the lambda handler function in your newplugin.py:

def lambda_handler(event, context):
	return your_function(event['username'], event['password'])

CredKing generates a deployment zip file which the lambdas receive when they are created. Because of this, CredKing requires the pre-reqs to be installed directly into the newplugin folder. You can accomplish this by:

$ pip install <pre-req> -t .

Plugin specific arguments

Plugin specific arguments can be specified with no modifications to credking.py, simply pass them as --argumentname value

If your plugin requirements plugin-specific arguments, you can implement a validate function in the __init__.py file of your plugin directory that will be passed an dictionary of all optional arguments.

Below is an example of plugin arugment validation used by the okta plugin's __init__.py.

def validate(args):
    if 'oktadomain' in args.keys():
        return True,None
    else:
        error = "Missing oktadomain argument, specify as --oktadomain org.okta.com"
        return False,error

The okta.py lambda_handler function then accesses the oktadomain argument as shown below.

def lambda_handler(event, context):
	domain = event['args']['oktadomain']
	return okta_authenticate(domain, event['username'], event['password'], event['useragent'])

That's it, enjoy!

credking's People

Contributors

vector-sec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

credking's Issues

Cleanup function can delete Lambda functions not created by CredKing

Hello. The way that the clean_up function is currently set up allows for Lambda functions that are not created by CredKing to be deleted. This occurred in my cloud environment; CredKing was the tool that deleted these functions, confirmed via CloudTrail.

Instead of calling list_functions, I would suggest passing the 'arns' list defined on line 64 in credking.py to the clean_up function and then simply deleting the ARNs that you know were created by CredKing. This would prevent other Lambda functions that were not created by CredKing from being deleted during the clean up process.

IP rotation doesn't work

I've modified the script to display the public IP that is in use by the lambda, and it seems "rotating IP addresses with each request." doesn't work properly. Each region has it's own public IP, but attempts that are scheduled on the same region use the same public IP until it is rotated by aws after a couple of hours.

Is there anything I'm missing?

Not showing success or failed status of credentials

hi,

when i run the command, i dont see any failed or success messages in the response. It should at least show any failed tries if the credentials didn't work.

python3 credking.py --plugin gmail --userfile users.txt --passwordfile test --access_key --secret_access_key

2020-10-29 06:21:54] Execution started at: 2020-10-29 06:21:54.211060
[2020-10-29 06:21:54] Loading credentials from users.txt and test
[2020-10-29 06:21:54] No validate function found for plugin: gmail
[2020-10-29 06:21:54] Creating build deployment for plugin: gmail
[2020-10-29 06:22:00] Created lambda arn:aws:lambda:us-east-2:313147307370:function:gmail_375711230 in us-east-2
[2020-10-29 06:22:00] User/Password Combinations: 40
[2020-10-29 06:22:00] Total Regions Available: 15
[2020-10-29 06:22:00] Total Lambdas: 1
[2020-10-29 06:22:00] Launching spray using arn:aws:lambda:us-east-2:313147307370:function:gmail_375711230...
[2020-10-29 06:22:02] Cleaning up lambdas in us-east-2...
[2020-10-29 06:22:02] Destroying arn:aws:lambda:us-east-2:313147307370:function:gmail_375711230:1 in region: us-east-2
[2020-10-29 06:22:02] End Time: 2020-10-29 06:22:02.186279
[2020-10-29 06:22:02] Total Execution: 7.975219 seconds

I even submitted few valid Gmail credentials in there that I know work but I didn't see any response back.

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.