Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Git
.git
.gitignore
.github

# Documentation
README.md
CHANGELOG.md
LICENSE.md

# Docker
Dockerfile
.dockerignore
__pycache__
data

# IDE
.vscode
.idea
56 changes: 56 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Push Docker Image

on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
pull_request:
branches: [ main, master ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

*.pyc
data/
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM python:3-alpine

LABEL name photon
LABEL src "https://github.com/s0md3v/Photon"
LABEL creator s0md3v
LABEL dockerfile_maintenance khast3x
LABEL desc "Incredibly fast crawler designed for reconnaissance."
LABEL name=photon
LABEL src="https://github.com/s0md3v/Photon"
LABEL desc="Incredibly fast crawler designed for OSINT."

RUN apk add git && git clone https://github.com/s0md3v/Photon.git Photon
WORKDIR Photon
RUN pip install -r requirements.txt
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
VOLUME [ "/app/data" ]

VOLUME [ "/Photon" ]
# ENTRYPOINT ["sh"]
ENTRYPOINT [ "python", "photon.py" ]
CMD ["--help"]
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<a href="https://github.com/s0md3v/Photon/issues?q=is%3Aissue+is%3Aclosed">
<img src="https://img.shields.io/github/issues-closed-raw/s0md3v/Photon.svg">
</a>
<a href="https://travis-ci.com/s0md3v/Photon">
<img src="https://img.shields.io/travis/com/s0md3v/Photon.svg">
</a>
</p>

![demo](https://image.ibb.co/kQSUcz/demo.png)
Expand Down Expand Up @@ -70,19 +67,21 @@ Still, crawling can be resource intensive but Photon has some tricks up it's sle

#### Docker

Photon can be launched using a lightweight Python-Alpine (103 MB) Docker image.
Photon can be launched using a lightweight Docker image.
To view results, you should open the created folder named `data`.


**Use the prebuild Docker image:**
```bash
$ git clone https://github.com/s0md3v/Photon.git
$ cd Photon
$ docker build -t photon .
$ docker run -it --name photon photon:latest -u google.com
docker run -it -v "$PWD/data:/app/data" ghcr.io/s0md3v/photon:master -u google.com
```

To view results, you can either head over to the local docker volume, which you can find by running `docker inspect photon` or by mounting the target loot folder:

**Or build the docker image on your computer:**
```bash
$ docker run -it --name photon -v "$PWD:/Photon/google.com" photon:latest -u google.com
git clone https://github.com/s0md3v/Photon.git
cd Photon
docker build -t photon .
docker run -it -v "$PWD/data:/app/data" photon:latest -u google.com
```

#### Frequent & Seamless Updates
Expand Down
18 changes: 14 additions & 4 deletions photon.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
from core.colors import good, info, run, green, red, white, end, bad

# Just a fancy ass banner
print('''%s ____ __ __
print(r'''%s ____ __ __
/ %s__%s \/ /_ ____ / /_____ ____
/ %s/_/%s / __ \/ %s__%s \/ __/ %s__%s \/ __ \\
/ ____/ / / / %s/_/%s / /_/ %s/_/%s / / / /
/_/ /_/ /_/\____/\__/\____/_/ /_/ %sv1.3.2%s\n''' %
/_/ /_/ /_/\____/\__/\____/_/ /_/ %sv1.3.2%s
''' %
(red, white, red, white, red, white, red, white, red, white, red, white,
red, white, end))

Expand Down Expand Up @@ -189,7 +190,11 @@
# Extracts host out of the URL
host = urlparse(main_url).netloc

output_dir = args.output or host
# Always use data/** format for Docker compatibility
if args.output:
output_dir = args.output
else:
output_dir = f"data/{host}"

try:
domain = top_level(main_url)
Expand Down Expand Up @@ -374,8 +379,13 @@ def jscanner(url):
minutes, seconds, time_per_request = timer(diff, processed)

# Step 4. Save the results
# Ensure the data directory exists for Docker compatibility
if not args.output: # Only create data directory structure when using default output
data_dir = "data"
if not os.path.exists(data_dir):
os.makedirs(data_dir)
if not os.path.exists(output_dir): # if the directory doesn't exist
os.mkdir(output_dir) # create a new directory
os.makedirs(output_dir) # create a new directory (use makedirs for nested dirs)

datasets = [files, intel, robots, custom, failed, internal, scripts,
external, fuzzable, endpoints, keys]
Expand Down