Skip to content

Commit e6753b4

Browse files
author
Douglas Bienstock
committed
initial commit
0 parents  commit e6753b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3450
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.pyc
2+
.idea/
3+
message.json
4+
*.log.*
5+
*.DS_Store

Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM python:3
2+
3+
ENV PYTHONUNBUFFERED=1
4+
ENV OAUTHLIB_RELAX_TOKEN_SCOPE=1
5+
ENV DOCKER_CONTAINER=1
6+
ENV DJANGO_ENV=prod
7+
ENV DJANGO_SITE=localhost
8+
ENV ERROR_LOG=/var/log/oauth/error.log
9+
ENV AUDIT_LOG=/var/log/oauth/audit.log
10+
ENV DEBUG_LOG=/var/log/oauth/debug.log
11+
ENV SECRET_KEY=%=we7z9!5q0tojpv^lm)lcb@tdp4@thjfs7nrvkojdc^gq2cg2
12+
RUN mkdir /opt/app
13+
RUN mkdir /opt/sock
14+
RUN mkdir /var/log/oauth
15+
WORKDIR /opt/app
16+
COPY ./app /opt/app
17+
18+
RUN pip3 install -r /opt/app/requirements.txt
19+
RUN pip3 install uwsgi
20+
21+
CMD ["uwsgi", "--ini", "/opt/app/uwsgi.ini"]

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# PwnAuth
2+
3+
A web application framework for launching and managing OAuth abuse campaigns.
4+
5+
## Minimum requirements
6+
7+
* An Internet accessible server (tested running Ubuntu 16.04)
8+
* Nginx
9+
* Docker
10+
* Docker Composer
11+
* A Valid SSL certificate
12+
13+
## Installation
14+
15+
16+
1. Clone the repository onto your server
17+
2. Inside `Dockerfile` customize the settings to your site. Change `DJANGO_SITE` to match the FQDN of the domain you are using. Change the `SECRET_KEY` to a new random value
18+
3. Configure your SSL certificates and NGINX. I have provided a sample NGINX configuration in `nginx/oauth.conf`
19+
2. Run `setup.sh` as root. This will build the docker services for the OAuth application as well as setup an initial Django administrator for you to use the application with.
20+
21+
## Modules
22+
23+
PwnAuth is designed to be modular. A new Identity Provider can easily be supported by developing the necessary database models and views to interact with the Resource Server.
24+
As long as you follow the module implementation guidelines, the GUI will automatically detect the module and it will be ready for use.
25+
26+
### Office 365
27+
28+
1. You must create a new OAuth application with microsoft at the [Microsoft App Portal](https://apps.dev.microsoft.com)
29+
2. Be sure to create a secret key and ensure your scopes include `user.read` and `offline_access`
30+
3. Import the application settings into the application using the GUI
31+
4. Send out your phishing emails using the `authorization_url_full` link and wait for responses!
32+
33+
## Usage
34+
35+
PwnAuth is designed to be interacted with inside of a browser. There is also an API available available for power users. To learn more about using PwnAuth see the wiki.

app/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oauth.settings")
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError:
10+
# The above import may fail for some other reason. Ensure that the
11+
# issue is really that Django is missing to avoid masking other
12+
# exceptions on Python 2.
13+
try:
14+
import django
15+
except ImportError:
16+
raise ImportError(
17+
"Couldn't import Django. Are you sure it's installed and "
18+
"available on your PYTHONPATH environment variable? Did you "
19+
"forget to activate a virtual environment?"
20+
)
21+
raise
22+
execute_from_command_line(sys.argv)

app/oauth/__init__.py

Whitespace-only changes.

app/oauth/migrations/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.6 on 2018-04-21 17:43
3+
from __future__ import unicode_literals
4+
5+
import django.contrib.sites.models
6+
from django.db import migrations, models
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='Site',
19+
fields=[
20+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('domain', models.CharField(max_length=100, unique=True, validators=[django.contrib.sites.models._simple_domain_name_validator], verbose_name='domain name')),
22+
('name', models.CharField(max_length=50, verbose_name='display name')),
23+
],
24+
options={
25+
'verbose_name': 'site',
26+
'verbose_name_plural': 'sites',
27+
'db_table': 'django_site',
28+
'ordering': ('domain',),
29+
},
30+
managers=[
31+
('objects', django.contrib.sites.models.SiteManager()),
32+
],
33+
),
34+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.6 on 2018-04-21 17:45
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
import os
7+
8+
def insert_site(apps, schema_editor):
9+
Site = apps.get_model('sites', 'Site')
10+
11+
Site.objects.create(
12+
domain= os.getenv('DJANGO_SITE', 'google.com'),
13+
name= os.getenv('DJANGO_SITE', 'google.com')
14+
)
15+
16+
class Migration(migrations.Migration):
17+
18+
dependencies = [
19+
('sites', '0001_initial'),
20+
]
21+
22+
operations = [
23+
migrations.RunPython(insert_site)
24+
]

app/oauth/migrations/site_migrations/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)