mirror of
https://github.com/BishopFox/eyeballer.git
synced 2026-11-07 17:06:52 -10:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f844fb186 | ||
|
|
f0f7c81fe6 | ||
|
|
e1bbcbd2a0 | ||
|
|
0879c1e1eb | ||
|
|
496bd6fb86 | ||
|
|
66dbb9c1d7 | ||
|
|
1eafce6f7c |
No files matched your search
@@ -118,3 +118,4 @@ results.html
|
||||
!requirements-gpu.txt
|
||||
!tests/models/*
|
||||
!tests/data/*
|
||||
!docs/*
|
||||
@@ -3,8 +3,21 @@ Give those screenshots of yours a quick eyeballing.
|
||||
|
||||
Eyeballer is meant for large-scope network penetration tests where you need to find "interesting" targets from a huge set of web-based hosts. Go ahead and use your favorite screenshotting tool like normal (EyeWitness or GoWitness) and then run them through Eyeballer to tell you what's likely to contain vulnerabilities, and what isn't.
|
||||
|
||||
|
||||
### Example Labels
|
||||
|
||||
| Old-Looking Sites | Login Pages |
|
||||
| ------ |:-----:|
|
||||
|  |  |
|
||||
|
||||
| Homepages | Custom 404's |
|
||||
| ------ |:-----:|
|
||||
|  |  |
|
||||
|
||||
## Setup
|
||||
|
||||
Eyeballer uses TF.keras on Tensorflow 2.0. This is (as of this moment) still in "beta". So the pip requirement for it looks a bit weird. It'll also probably conflict with an existing TensorFlow installation if you've got the regular 1.0 version installed. So, heads-up there. But 2.0 should be out of beta and official "soon" according to Google, so this problem ought to solve itself in short order.
|
||||
|
||||
Download required packages on pip:
|
||||
```
|
||||
sudo pip3 install -r requirements.txt
|
||||
@@ -15,6 +28,20 @@ Or if you want GPU support:
|
||||
sudo pip3 install -r requirements-gpu.txt
|
||||
```
|
||||
|
||||
**NOTE**: Setting up a GPU for use with TensorFlow is way beyond the scope of this README. There's hardware compatibility to consider, drivers to install... There's a lot. So you're just going to have to figure this part out on your own if you want a GPU. But at least from a Python package perspective, the above requirements file has you covered.
|
||||
|
||||
**Training Data** You can find our training data here:
|
||||
|
||||
https://www.dropbox.com/sh/7aouywaid7xptpq/AAD_-I4hAHrDeiosDAQksnBma?dl=1
|
||||
|
||||
Pretty soon, we're going to add this as a TensorFlow DataSet, so you don't need to download this separately like this. It'll also let us version the data a bit better. But for now, just deal with it. There's two things you need from the training data:
|
||||
|
||||
1. `images/` folder, containing all the screenshots (resized down to 224x140. We'll have the full-size images up soon)
|
||||
2. `labels.csv` that has all the labels
|
||||
3. `bishop-fox-pretrained-v1.h5` A pretrained weights file you can use right out of the box without training.
|
||||
|
||||
Copy all three into the root of the Eyeballer code tree.
|
||||
|
||||
## Predicting Labels
|
||||
To eyeball some screenshots, just run the "predict" mode:
|
||||
|
||||
@@ -28,6 +55,9 @@ Or for a whole directory of files:
|
||||
eyeballer.py --weights YOUR_WEIGHTS.h5 predict PATH_TO/YOUR_FILES/
|
||||
```
|
||||
|
||||
Eyeballer will spit the results back to you in human readable format (a `results.html` file so you can browse it easily) and machine readable format (a `results.csv` file).
|
||||
|
||||
|
||||
## Training
|
||||
To train a new model, run:
|
||||
```
|
||||
@@ -45,3 +75,5 @@ You just trained a new model, cool! Let's see how well it performs against some
|
||||
```
|
||||
eyeballer.py --weights YOUR_WEIGHTS.h5 evaluate
|
||||
```
|
||||
|
||||
The output will describe the model's accuracy in both recall and precision for each of the program's labels. (Including "none of the above" as a pseudo-label)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
|
||||
from Augmentor.Operations import Operation
|
||||
from keras.applications.mobilenet import preprocess_input
|
||||
from tensorflow.keras.applications.mobilenet import preprocess_input
|
||||
|
||||
|
||||
class EyeballerAugmentation(Operation):
|
||||
|
||||
+7
-2
@@ -31,7 +31,7 @@ class EyeballModel:
|
||||
image_width, image_height = 224, 224
|
||||
input_shape = (image_width, image_height, 3)
|
||||
|
||||
def __init__(self, weights_file, print_summary=False, seed=None):
|
||||
def __init__(self, weights_file, print_summary=False, seed=None, quiet=False):
|
||||
"""Constructor for model class.
|
||||
|
||||
Keyword arguments:
|
||||
@@ -60,6 +60,8 @@ class EyeballModel:
|
||||
if print_summary:
|
||||
print(self.model.summary())
|
||||
|
||||
self.quiet = quiet
|
||||
|
||||
# Pull out our labels for use in generators later
|
||||
data = pd.read_csv("labels.csv")
|
||||
self.training_labels = data.loc[data['evaluation'] == False] # noqa: E712
|
||||
@@ -216,7 +218,10 @@ class EyeballModel:
|
||||
raise FileNotFoundError
|
||||
|
||||
results = []
|
||||
for screenshot in progressbar.progressbar(screenshots):
|
||||
bar = progressbar.ProgressBar()
|
||||
if self.quiet:
|
||||
bar = progressbar.NullBar()
|
||||
for screenshot in bar(screenshots):
|
||||
# Load the image into memory
|
||||
img = None
|
||||
try:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import numpy as np
|
||||
import math
|
||||
from keras.preprocessing import image
|
||||
import tensorflow as tf
|
||||
|
||||
from copy import deepcopy
|
||||
from matplotlib import pyplot as plt
|
||||
from eyeballer.model import DATA_LABELS
|
||||
@@ -10,8 +11,8 @@ class HeatMap():
|
||||
def __init__(self, screenshot_path, model, threshold=0.5, boxsize=28, step=7):
|
||||
self.model = model
|
||||
|
||||
img = image.load_img(screenshot_path, target_size=(self.model.image_width, self.model.image_height))
|
||||
img = image.img_to_array(img)
|
||||
img = tf.keras.preprocessing.image.load_img(screenshot_path, target_size=(self.model.image_width, self.model.image_height))
|
||||
img = tf.keras.preprocessing.image.img_to_array(img)
|
||||
|
||||
self.screenshot = img
|
||||
self.boxsize = boxsize
|
||||
@@ -43,7 +44,7 @@ class HeatMap():
|
||||
labels.append(label)
|
||||
|
||||
plt.figure()
|
||||
screenshot_image = image.load_img(self.screenshot_path, target_size=(self.model.image_width, self.model.image_width))
|
||||
screenshot_image = tf.keras.preprocessing.image.load_img(self.screenshot_path, target_size=(self.model.image_width, self.model.image_width))
|
||||
_, subplots = plt.subplots(1, len(heatmaps))
|
||||
# This is a little janky, but matplotlib returns a list above if there's multiple subplots, and just a single subplot if there's only one
|
||||
# it would have been easier if it was always a list. But alas
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
Augmentor
|
||||
click
|
||||
matplotlib
|
||||
numpy
|
||||
numpy==1.16.4
|
||||
keras
|
||||
pandas
|
||||
pillow
|
||||
sklearn
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#TODO
|
||||
@@ -25,7 +25,8 @@ class PredictTest(unittest.TestCase):
|
||||
model_kwargs = {
|
||||
"weights_file": weights_file,
|
||||
"print_summary": False,
|
||||
"seed": None
|
||||
"seed": None,
|
||||
"quiet": True
|
||||
}
|
||||
self.model = EyeballModel(**model_kwargs)
|
||||
|
||||
@@ -33,7 +34,8 @@ class PredictTest(unittest.TestCase):
|
||||
model_kwargs = {
|
||||
"weights_file": None,
|
||||
"print_summary": False,
|
||||
"seed": 12345678
|
||||
"seed": 12345678,
|
||||
"quiet": True
|
||||
}
|
||||
same_seed_model = EyeballModel(**model_kwargs)
|
||||
|
||||
@@ -48,7 +50,8 @@ class PredictTest(unittest.TestCase):
|
||||
model_kwargs = {
|
||||
"weights_file": None,
|
||||
"print_summary": False,
|
||||
"seed": 12345678
|
||||
"seed": 12345678,
|
||||
"quiet": True
|
||||
}
|
||||
same_seed_model = EyeballModel(**model_kwargs)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#TODO
|
||||
Reference in new issue
Block a user