Giter Site home page Giter Site logo

phage-nz / ph0neutria Goto Github PK

View Code? Open in Web Editor NEW
299.0 35.0 67.0 30.3 MB

ph0neutria is a malware zoo builder that sources samples straight from the wild. Everything is stored in Viper for ease of access and manageability.

License: Apache License 2.0

Python 97.93% Shell 2.07%

ph0neutria's Introduction

ph0neutria

ph0neutria malware crawler
v1.0.1
https://github.com/phage-nz/ph0neutria

Note: This project is not actively maintained.

About

ph0neutria is a malware zoo builder that sources samples straight from the wild. Everything is stored in Viper for ease of access and manageability.

This project was inspired by Ragpicker (https://github.com/robbyFux/Ragpicker, formerly known as "Malware Crawler"). However, ph0neutria aims to:

  • Limit the scope of crawling to only frequently updated and reliable sources.
  • Maximise the effectiveness of individual indicators.
  • Offer a single, reliable and well organised storage mechanism.
  • Not do work that can instead be done by Viper.

What does the name mean? "Phoneutria nigriventer" is commonly known as the Brazillian Wandering Spider: https://en.wikipedia.org/wiki/Brazilian_wandering_spider

Sources

As of version 1.0.0 all sources are created as 'plugins', found in the plugin sub-directory of the core scripts folder. Default sources are:

  • 0xffff0800's Malware Library (credit: http://0day.coffee).
  • CleanMX (requires approved user-agent).
  • Cymon, which includes: Abuse.ch trackers, Bambenek C2 feed, Cyber Crime Tracker, Malc0de, URLVir and VX Vault.
  • Hybrid Analysis (requires vetted API key).
  • OTX.
  • Shodan, using the Malware Hunter search facility.
  • URLhaus.

Each plugin has parameters that must be completed prior to operation. You'll find these at the top of each plugin file.

VirusTotal is a core component of ph0neutria that cannot be disabled. IP lists are fed into it to discover URL's that are known for the IP's. If you have a standard 5 request/minute API key then I'd encourage being conservative with what you feed it. You can do this by:

  • Reducing the number of Cymon feeds.
  • Reducing your OTX subscription count.
  • Setting the Hybrid Analysis SCORE_MIN parameter to 100.

Screenshots

CLI
CLI
CLI
Web
Web
Web

Version Notes

  • 0.6.0: Tor proxying requires pysocks (pip install pysocks) and at least version 2.10.0 of python requests for SOCKS proxy support.
  • 0.9.0: OSINT functionality pulled from Phage Malware Tracker (private project) - requires VirusTotal API key. More robust retrieval of wild files. Local URL and hash caching (reduces API load).
  • 0.9.1: Updated to use V3 Viper API. No longer compatiable with V2.
  • 1.0.0: Major update. Pull from Safari Guide malware pipeline. Plugin architecture. Python 3.0.
  • 1.0.1: Source update (added 0xffff0800's library). Samples can now be tagged with VirusTotal sourced classification.

Installation

The following script will install ph0neutria along with Viper and Tor:

wget https://raw.githubusercontent.com/phage-nz/ph0neutria/master/install.sh  
chmod +x install.sh  
sudo ./install.sh  

Simple as that!

Optional:

Configure additional ClamAV signatures:

cd /tmp  
git clone https://github.com/extremeshok/clamav-unofficial-sigs  
cd clamav-unofficial-sigs  
cp clamav-unofficial-sigs.sh /usr/local/bin  
chmod 755 /usr/local/bin/clamav-unofficial-sigs.sh  
mkdir /etc/clamav-unofficial-sigs  
cp config/* /etc/clamav-unofficial-sigs  
cd /etc/clamav-unofficial-sigs

Rename os..conf to os.conf, for example:

mv os.ubuntu.conf os.conf  

Modify configuration files:

  • master.conf: search for "Enabled Databases" and enable/disable desired sources.
  • user.conf: uncomment the required lines for sources you have enabled and complete them. user.conf overrides master.conf. You must uncomment user_configuration_complete="yes" once you've completed setup for the following commands to succeed.

For more configuration info see: https://github.com/extremeshok/clamav-unofficial-sigs

mkdir /var/log/clamav-unofficial-sigs  
clamav-unofficial-sigs.sh --install-cron  
clamav-unofficial-sigs.sh --install-logrotate  
clamav-unofficial-sigs.sh --install-man  
clamav-unofficial-sigs.sh  
cd /tmp/clamav-unofficial-sigs  
cp systemd/\* /etc/systemd  
cd ..  
rm -rf clamav-unofficial-sigs*  

It'll take a while to pull down the new signatures - during which time ClamAV may not be available.

Usage

Take precautions when piecing together your malware zoo:

Ensure Tor is started:

service tor restart

Start the Viper API and web interface:

cd /opt/viper  
sudo -H -u spider python3 viper-web

Take note of the admin password that is created when Viper is started. Use this to log into http://<viper IP\>:<viper port>/admin (default: http://127.0.0.1:8080/admin) and retrieve the API token from the Tokens page.

The main Viper web interface will be available at http://<viper IP>:<viper port> (default: http://127.0.0.1:8080).

  • Complete the config file at: /opt/ph0neutria/core/config/settings.conf
  • Complete the parameters at the top of each plugin. If you wish to disable the plugin, set DISABLED = True: /opt/ph0neutria/core/plugins/*.py

Start ph0neutria:

cd /opt/ph0neutria  
sudo -H -u spider python3 run.py

You can press Ctrl+C at any time to kill the run. You are free to run it again as soon as you'd like - you can't end up with database duplicates.

To run this daily, create a script in /etc/cron.daily with the following:

#!/bin/bash  
cd /opt/ph0neutria && sudo -H -u spider python3 run.py*

Tags and Notes

Tags:
{1},{2},{3}

  • Date stamp.
  • Sample domain.
  • Host ASN.
  • Host country.

Notes:
{1)({2}) via {3}

  • Sample URL.
  • Host IP address.
  • URL source.

The original name of the file forms the identifying name within Viper.

References

ph0neutria's People

Contributors

daemon604 avatar maxou56800 avatar phage-nz avatar rmarsollier avatar srcr avatar the-c0d3r 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ph0neutria's Issues

Installation problem

I am having issues with installation. When I try to install, get this:
usermod: user 'clamav' does not exist
sed: can't read /etc/clamav/clamd.conf: No such file or directory
./install.sh: line 62: /etc/init.d/clamav-daemon: No such file or directory

ImportError: cannot import name soupParse

Hello Chris,

I was thrilled by your tool and thought it might be an excellent "feeder" of my Cuckoo and MISP instance.
Unfortunately, during the install, I have a little problem.

Could you help me with this?

root@ubuntu:/opt/ph0neutria# sudo -H -u spider python run.py
Traceback (most recent call last):
File "run.py", line 5, in
from util.Malc0de import getMalc0deList
File "/opt/ph0neutria/util/Malc0de.py", line 4, in
from StringUtils import isValidUrl, soupParse
ImportError: cannot import name soupParse
root@ubuntu:/opt/ph0neutria#

I've installed the beautifulsoup via easyinstall and it looks fine. Still it can't find the soupParse. (Nor can I) :-)

Thanks a lot for your help.

Cheers
Marcus

Don't store HTML files

Hello,

Did you allow me to add a piece of code for disable support of HTML pages?
Because sometime we get HTML page with:

"Site Suspended!"

I think its useless to store this content in Viper.

viper-api missing

I installed and went to use, but it looks like viper-api is missing when attempting to use:

sudo -H -u spider python viper-api

I checked viper's github and it is not there either?

Nothing in the database

I'm getting the same issues as per #27. Nothing is showing up in the database but stdout says it already exists in viper.

screenshot 2019-03-08 at 12 09 16

I'm running the viper web interface and ph0neutria as the same user "spider". I've created a user in the webgui and named it spider, generated an API key and used that in the settings.conf file. The web interface is running on 0.0.0.0:8080 and have also added that in to the settings.conf file.

There's a .viper/ under /home/spider and an admin.db and viper.db file too. Although viper.db has an old date.

When I log in as either spider or admin user nothing is listed. Not sure where it's getting written.

Can anyone help?

run.py issue

Hi, I was trying to run the "run.py" file, but i am getting this error
root@ubuntu:/opt/ph0neutria# sudo -H -u spider python3 run.py
Traceback (most recent call last):
File "run.py", line 3, in
from core.core_utils import start_core
File "/opt/ph0neutria/core/core_utils.py", line 3, in
from .config_utils import get_base_config
File "/opt/ph0neutria/core/config_utils.py", line 3, in
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

Can you help me with this?

No module named 'ConfigParser'

I'm trying to test this program but there is an error when I run the run.py file. I did some research and it said that configparser was renamed to all lowercase. I'm not all to familiar with python, but what would be a fix for this issue?

NoSectionError: No section: 'Core'

My environment: Ubuntu 20.04, Python3.7.11
I had install requirements.txt but I run the command and occurs that errors:
from ph0neutria.core.string_utils import fuzzy_score_string
Error by image below:
Screenshot from 2021-10-12 00-28-44
How can fix this error? Thank you.

Viper API

I have been working on the Viper project for sometime now and - hopefully - soon they will merge my PR (viper-framework/viper#534). I noticed that this project makes use of the API and therefore I would like to

  • give you a heads up that there will be changes to the API (soon-ish)
  • ask whether you could have a look into the new API design (before it's merged) and maybe give some feedback/improvement suggestions.. :-)

Still Issue with run.py

I did the pull request and made appropriate to the config files, when i ran it gave me this error:
root@ubuntu:/opt/ph0neutria# sudo -H -u spider python3 run.py
Traceback (most recent call last):
File "/usr/lib/python3.6/configparser.py", line 1138, in _unify_values
sectiondict = self._sections[section]
KeyError: 'Core'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run.py", line 3, in
from core.core_utils import start_core
File "/opt/ph0neutria/core/core_utils.py", line 5, in
from .malware_utils import get_malware_urls, queue_malware_list
File "/opt/ph0neutria/core/malware_utils.py", line 4, in
from .file_utils import profile_url_file, clean_up
File "/opt/ph0neutria/core/file_utils.py", line 4, in
from .crypto_utils import hash_file, random_string
File "/opt/ph0neutria/core/crypto_utils.py", line 16, in
BASECONFIG = get_base_config(ROOTDIR)
File "/opt/ph0neutria/core/config_utils.py", line 127, in get_base_config
user_agent = parser.get('Core', 'useragent')
File "/usr/lib/python3.6/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.6/configparser.py", line 1141, in _unify_values
raise NoSectionError(section)
configparser.NoSectionError: No section: 'Core'

I am not sure what to do, please help

Viper Django issue

This weekend I did a clean install of this project to use the new version of viper and ran into some issues. With the correct directories being owned by spider I ran into issues with ph0neutria submitting files.

the script output is as follows:
adding to Viper: ace/MY_BIN/my_Bin.exe
Problem submitting file ace/MY_BIN/my_Bin.exe to Viper. Status code: 405. Continuing.

with viper showing that first POST was used to submit then followed by a GET request.:
2018-02-26 22:58:19 - django.server - WARNING - basehttp.py:124 - "GET /api/v3/project/default/malware/upload/ HTTP/1.1" 401 74
2018-02-26 22:58:21 - django.server - INFO - basehttp.py:124 - "POST /api/v3/project/default/malware/upload HTTP/1.1" 301 0

I can try to provide more info tomorrow, and once fixed i should be able to provide a rough ansible playbook for install

Thanks,
Will

Send new malware to cuckoo

Hello Chris,

just to make you aware, I've added some code to have the cuckoo submit script on the same machine being triggered to analyse the new downloaded malware automatically.

Although I'm very sure that there is a much, much better way to add this functionality to your code, it might still be worth thinking of such an addition within the main distro.

I put this into FileUtil:

_## My additions

submit to cuckoo

bashCommand = "/opt/cuckoo/utils/submit.py --remote [IP Address of your cuckoo]:[API-Port of your cuckoo] --memory --unique " + filePath
logging.info("Sending to Cuckoo: " + bashCommand)
os.system(bashCommand)

My additions_

And please don't jam at me because of this obviouse bad style of code. I'm not in python at all, but it still works. :-)

Cheers from the other side of the world.
Marcus

Viper

Hi Chris,
As i was running the ph0neutria, I found that when i updated the viper web interface it still showed me that there were zero results i.e. that there were no addition to the DB. I am curious whether the addition to Viper happens after the ph0neutria has crawled through all the samples?
Also please add "numpy" as it was also an error saying no module.

Viper tags config Issue

just downloaded and installed this, and on first run i get an error from the python script more specifically config parser.

it seems as though no value exists in the current config related to the newly added Viper addtags, although configpaser is still checking for it
here is the error just in case
image

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.