Skip to content
Open

Local #188

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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Change the value in `config.json` to the path of the `geckodriver` e.g
},
"WEBDRIVER": {
"ENGINE": "firefox",
"PATH": "/usr/local/bin/geckodriver"
"PATH": "C:\Program Files\Mozilla Firefox"
},
"FILTER": [
....
Expand Down
9 changes: 6 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"GOOGLE_IMG_PAGES": "3"
},
"WEBDRIVER": {
"ENGINE": "firefox",
"PATH": "/usr/bin/geckodriver"
"ENGINE": "firefox",
"PATH": "/usr/local/bin/geckodriver"
},
"FILTER": [
"instagram.com",
Expand All @@ -15,5 +15,8 @@
"url?"
],
"INSTA_VALIDATION_MAX_IMAGES": "5",
"JITTERS": "70"
"JITTERS": "70",
"FOCA": {
"ENABLED": "true"
}
}
76 changes: 54 additions & 22 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
FROM ubuntu:16.04
FROM ubuntu:22.04

RUN apt-get clean && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# 1. Install System Dependencies
RUN apt-get update && apt-get install -y \
locales \
git \
curl \
software-properties-common \
unzip \
wget \
python3-pip \
python3-dev \
libboost-all-dev \
build-essential \
cmake \
libffi-dev \
firefox \
dos2unix \
# --- LIBRARIES TO FIX STATUS 1 ---
libgtk-3-0 \
libdbus-glib-1-2 \
libxt6 \
libxrender1 \
libasound2 \
libnss3 \
libxcomposite1 \
xvfb \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set up locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV TERM dumb
ENV PYTHONIOENCODING=utf-8

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y git curl software-properties-common unzip
RUN apt-get update && add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3.6 python3.6-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libgtk-3-dev libboost-all-dev build-essential cmake libffi-dev
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y firefox
RUN git clone https://github.com/ThoughtfulDev/EagleEye
WORKDIR EagleEye
RUN pip3.6 install -r requirements.txt
RUN pip3.6 install --upgrade beautifulsoup4 html5lib spry
ADD https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz /EagleEye/geckodriver.tar.gz
RUN tar -xvf geckodriver.tar.gz
RUN mv geckodriver /usr/bin/geckodriver
RUN chmod +x /usr/bin/geckodriver
RUN rm -r /EagleEye/known/
ENTRYPOINT bash /entry.sh

WORKDIR /EagleEye
COPY . /EagleEye

# Fix Windows line endings and permissions
RUN dos2unix /EagleEye/entry.sh && chmod +x /EagleEye/entry.sh

# Install Python Dependencies
RUN pip3 install --upgrade pip
RUN pip3 install "urllib3<2.0.0"
RUN pip3 install lxml_html_clean
RUN pip3 install -r requirements.txt

# Install Geckodriver (Updated for Firefox 147)
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz && \
tar -xvzf geckodriver-v0.36.0-linux64.tar.gz && \
mv geckodriver /usr/local/bin/ && \
rm geckodriver-v0.36.0-linux64.tar.gz

RUN mkdir -p /result

ENTRYPOINT ["/bin/bash", "/EagleEye/entry.sh"]
27 changes: 21 additions & 6 deletions eagle-eye.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from grabber.facebook import FBGrabber, FBProfileGrabber
from grabber.google import GoogleGrabber
from grabber.instagram import InstagramGrabber
from grabber.foca import FocaGrabber
from face_recog import FaceRecog
import subprocess, json, shutil
from report.report import makeReport, makeJSONReport
Expand Down Expand Up @@ -61,7 +62,7 @@ def getInstaLinks(username):
instagrabber = InstagramGrabber(username)
return instagrabber.getLinks()

def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=None):
def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=None, useFoca=False):
if not skipFB:
# collect user input
if dockerMode:
Expand All @@ -77,6 +78,19 @@ def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=Non
console.task('Skipping FB Search')
name = "Unknown"

if useFoca:
console.section("Running Foca")
foca = FocaGrabber(name)
foca.grabData()
metadata = foca.getMetadata()
if metadata:
console.task("Found Metadata:")
for key, value in metadata.items():
if value:
console.subtask(f"{key}: {value}")
else:
console.failure("No metadata found.")


if dockerMode:
console.task('Skipping jitters since specified in config.json')
Expand Down Expand Up @@ -155,9 +169,9 @@ def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=Non
console.section('Links')
print(rev_links)
console.section('Predictions')
try:
predictions = [x.lower() for x in predictions]
except:
if predictions:
predictions = [x.lower() for x in predictions if x]
else:
predictions = []
print(predictions)
presentResult(predictions)
Expand Down Expand Up @@ -188,6 +202,7 @@ def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=Non
console.banner()
parser = argparse.ArgumentParser()
parser.add_argument('-sFB', '--skipfb', action='store_true', help='Skips the Facebook Search')
parser.add_argument('--foca', action='store_true', help='Enable FOCA to extract metadata from found documents.')
parser.add_argument('-d', '--docker', action='store_true', help='Set this flag if run in docker mode')
parser.add_argument('-n', '--name', nargs='?', help='Specify the persons name. Only active with the --docker flag')
parser.add_argument('-json', '--json', nargs='?', help='Generates a json report. Specify a Filename')
Expand Down Expand Up @@ -221,9 +236,9 @@ def main(skipFB=False, FBUrls=[], jsonRep=None, dockerMode=False, dockerName=Non
with open(args.facebookList, 'r') as f:
content = f.readlines()
content = [x.strip() for x in content]
main(skipFB=args.skipfb, FBUrls=content, jsonRep=jsonRepFile, dockerMode=aDocker, dockerName=aName)
main(skipFB=args.skipfb, FBUrls=content, jsonRep=jsonRepFile, dockerMode=aDocker, dockerName=aName, useFoca=args.foca)
else:
console.failure("File '{}' does not exist".format(args.facebookList))
sys.exit(-1)
else:
main(skipFB=args.skipfb, FBUrls=[], jsonRep=jsonRepFile, dockerMode=aDocker, dockerName=aName)
main(skipFB=args.skipfb, FBUrls=[], jsonRep=jsonRepFile, dockerMode=aDocker, dockerName=aName, useFoca=args.foca)
11 changes: 10 additions & 1 deletion entry.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/bash
# Downgrade fake-useragent to a version compatible with Python 3.8
pip3 install "fake-useragent<1.4.0" selenium

# Fix Geckodriver path: Create symlink if missing in /usr/bin but found in /usr/local/bin
if [ ! -f "/usr/bin/geckodriver" ] && [ -f "/usr/local/bin/geckodriver" ]; then
ln -s /usr/local/bin/geckodriver /usr/bin/geckodriver
fi

cd /EagleEye
python3.6 eagle-eye.py --docker --name "Emeraude"
TARGET_NAME=${NAME:-"Kristina"}
python3 eagle-eye.py --docker --name "$TARGET_NAME"

#now copy the result
yes | cp -rf /EagleEye/*.pdf /result/
15 changes: 8 additions & 7 deletions grabber/facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import utils.config as cfg
import utils.console as console

Expand All @@ -22,20 +23,20 @@ def grabData(self):
time.sleep(10)

#get all profile image links
profile_img_links = driver.find_elements_by_xpath("//a[@class='_2ial']")
profile_img_links = driver.find_elements(By.XPATH, "//a[@class='_2ial']")
console.subtask('Collecting Image URLs...(Page 1)')

if len(profile_img_links) <= 0:
console.subfailure('No FB Links found')
else:
for e in profile_img_links:
href = e.get_attribute("href")
image = e.find_element_by_tag_name("img")
image = e.find_element(By.TAG_NAME, "img")
img_src = image.get_attribute("src")
self.profile_list.append(href)
self.profile_img.append(img_src)

pages = driver.find_elements_by_xpath("//a")
pages = driver.find_elements(By.XPATH, "//a")
pages_links = []
for e in pages:
link = e.get_attribute('href')
Expand All @@ -45,12 +46,12 @@ def grabData(self):

for page in pages_links:
driver.get(page)
profile_img_links = driver.find_elements_by_xpath("//a[@class='_2ial']")
profile_img_links = driver.find_elements(By.XPATH, "//a[@class='_2ial']")
page_num = page[-1:]
console.subtask('Collecting Images URLs...(Page {0})'.format(page_num))
for e in profile_img_links:
href = e.get_attribute("href")
image = e.find_element_by_tag_name("img")
image = e.find_element(By.TAG_NAME, "img")
img_src = image.get_attribute("src")
self.profile_list.append(href)
self.profile_img.append(img_src)
Expand All @@ -76,13 +77,13 @@ def grabLinks(self):

#first possibility

profile_img_links = driver.find_elements_by_xpath("/html/body/div[1]/div[4]/div[1]/div/div[2]/div[2]/div[2]/div/div[1]/div[1]/div[3]/div/div[2]/div[3]/div/div/div/img")
profile_img_links = driver.find_elements(By.XPATH, "/html/body/div[1]/div[4]/div[1]/div/div[2]/div[2]/div[2]/div/div[1]/div[1]/div[3]/div/div[2]/div[3]/div/div/div/img")
for e in profile_img_links:
img_src = e.get_attribute("src")
img_urls.append(img_src)

#second possivility
profile_img_links = driver.find_elements_by_xpath("/html/body/div[1]/div[1]/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div/a/div/img")
profile_img_links = driver.find_elements(By.XPATH, "/html/body/div[1]/div[1]/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div/a/div/img")
for e in profile_img_links:
img_src = e.get_attribute("src")
img_urls.append(img_src)
Expand Down
35 changes: 35 additions & 0 deletions grabber/foca.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
from pypdf import PdfReader
import utils.console as console

class FocaGrabber:
def __init__(self, target):
self.target = target
self.metadata = {}

def grabData(self):
console.task('Searching for documents from "{}"'.format(self.target))
# In a real scenario, we would search for documents related to the target.
# For this example, we'll just use the Example.pdf

if os.path.exists("Example.pdf"):
console.subtask("Extracting metadata from Example.pdf")
try:
reader = PdfReader("Example.pdf")
meta = reader.metadata
self.metadata = {
"Author": meta.author,
"Creator": meta.creator,
"Producer": meta.producer,
"Subject": meta.subject,
"Title": meta.title,
"Creation Date": meta.creation_date,
"Modification Date": meta.modification_date,
}
except Exception as e:
console.subfailure(f"Could not read metadata from PDF: {e}")
else:
console.subfailure("No documents found for target.")

def getMetadata(self):
return self.metadata
24 changes: 12 additions & 12 deletions grabber/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):

def getLinks(self):
try:
link_name = self.driver.find_elements_by_tag_name('a')
link_name = self.driver.find_elements(By.TAG_NAME, 'a')
links = []
for l in link_name:
link = l.get_attribute('href')
Expand Down Expand Up @@ -73,26 +73,26 @@ def collectLinks(self, img_url):
console.subtask('Inserting Image URL')
console.task("Please agree to google's stuff in the browser")
time.sleep(10)
elems = driver.find_elements_by_xpath(self.PHOTO_XPATH)[0]
elems = driver.find_elements(By.XPATH, self.PHOTO_XPATH)[0]
elems.click()
time.sleep(1)
input = driver.find_elements_by_xpath('//*[@id="Ycyxxc"]')[0]
input = driver.find_elements(By.XPATH, '//*[@id="Ycyxxc"]')[0]
input.clear()
input.send_keys(img_url)
input.send_keys(Keys.RETURN)
console.subtask('Searching for Image...')
time.sleep(cfg.timeout() * 2)
pred_error = False
try:
pred = driver.find_element_by_xpath(self.PRED_XPATH)
pred = driver.find_element(By.XPATH, self.PRED_XPATH)
except NoSuchElementException:
console.subfailure('No Prediction given sry...')
pred = None
pred_error = True
except BrokenPipeError:
#just try again...
try:
pred = driver.find_element_by_xpath(self.PRED_XPATH)
pred = driver.find_element(By.XPATH, self.PRED_XPATH)
except NoSuchElementException:
console.subfailure('Broken pipe Error. This is not a Problem...moving on!')
console.subfailure('No Prediction given sry...')
Expand All @@ -110,7 +110,7 @@ def collectLinks(self, img_url):
for num in range(2, self.max_pages+1):
console.subtask("Switching to Page {0}".format(num))
try:
page_n = driver.find_element_by_link_text(str(num))
page_n = driver.find_element(By.LINK_TEXT, str(num))
page_n.click()
time.sleep(cfg.timeout())
console.subtask("Collecting Links...(Page {0})".format(num))
Expand All @@ -133,29 +133,29 @@ def collectLinksLocal(self):
driver.get("https://www.google.com/imghp")
console.task("Please agree to google's stuff in the browser")
time.sleep(10)
elems = driver.find_elements_by_xpath(self.PHOTO_XPATH)[0]
elems = driver.find_elements(By.XPATH, self.PHOTO_XPATH)[0]
elems.click()
time.sleep(1)
elems = driver.find_element_by_xpath(self.PHOTO_UPLOAD_XPATH)
elems = driver.find_element(By.XPATH, self.PHOTO_UPLOAD_XPATH)

elems.click()
time.sleep(1)
console.subtask("Inserting Path")
input_box = driver.find_element_by_xpath('//*[@id="awyMjb"]')
input_box = driver.find_element(By.XPATH, '//*[@id="awyMjb"]')
p_i = os.path.join(os.getcwd(), str_p)
input_box.send_keys(p_i)
time.sleep(cfg.timeout() * 2)
pred_error = False
try:
pred = driver.find_element_by_xpath(self.PRED_XPATH)
pred = driver.find_element(By.XPATH, self.PRED_XPATH)
except NoSuchElementException:
console.subfailure('No Prediction given sry...')
pred = None
pred_error = True
except BrokenPipeError:
#just try again...
try:
pred = driver.find_element_by_xpath(self.PRED_XPATH)
pred = driver.find_element(By.XPATH, self.PRED_XPATH)
except NoSuchElementException:
console.subfailure('Broken pipe Error. This is not a Problem...moving on!')
console.subfailure('No Prediction given sry...')
Expand All @@ -172,7 +172,7 @@ def collectLinksLocal(self):
for num in range(2, self.max_pages+1):
console.subtask("Switching to Page {0}".format(num))
try:
page_n = driver.find_element_by_link_text(str(num))
page_n = driver.find_element(By.LINK_TEXT, str(num))
page_n.click()
time.sleep(cfg.timeout())
console.subtask("Collecting Links...(Page {0})".format(num))
Expand Down
Loading