Giter Site home page Giter Site logo

metasploit-webapp's Introduction

Metasploit framework via HTTP service

There are metasploit framework running in background by msfrpcd that act like a internal server and msfrpc client running in web interface for using metasploit console.

Requirement

  • Linux operating system
  • Nodejs (to run web interface)

Installation

Installing Dependencies

Make sure it is a latest packages on system.

sudo apt-get update
sudo apt-get upgrade

Install the dependent packages that Metasploit framework need.

sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev 
libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer 
libyaml-dev curl zlib1g-dev

Installing Ruby using RVM

Because Metasploit coding by Ruby and install with Rubygem.

curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
RUBYVERSION=$(wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/.ruby-version -q -O - )
rvm install $RUBYVERSION
rvm use $RUBYVERSION --default
ruby -v

Installing Nmap

External tools work with Metasploit framework for scanning target.

mkdir ~/Development
cd ~/Development
git clone https://github.com/nmap/nmap.git
cd nmap 
./configure
make
sudo make install
make clean

Configuring Postgre SQL Server

Switch to be postgres user so we can create db for Metasploit framework.

sudo -s
su postgres

Create user to work with db (the name must as same as in config file). In config file we use msfdev and create db msf_dev_db owned by msfdev.

createuser msfdev -P -S -R -D
createdb msf_dev_db -O msfdev
exit
exit

Installing Metasploit framework

We download the latest Metasploit framework via Git.

cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework

Install using bundler the required gem and versions.

cd metasploit-framework

# If using RVM set the default gem set that is create when you navigate in to the folder
rvm --default use ruby-${RUBYVERSION}@metasploit-framework

gem install bundler
bundle install

If want to run a command in any user under the Metasploit folder then create a link by this command.

cd metasploit-framework
sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'

Create the databases.yml file that will be contain the configuration parameters used by Metasploit framework.

sudo nano /opt/metasploit-framework/config/database.yml

Copy the YAML entries and make sure the password that you entered

production:
 adapter: postgresql
 database: msf_dev_db
 username: msfdev
 password: (your password as same as config file)
 host: 127.0.0.1
 port: 5432
 pool: 75
 timeout: 5

Create environment variable so it is loaded by msfconsole when running and load the variable in to your currnet shell.

sudo sh -c "echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile"

source /etc/profile

RUN!!

we run the Metasploit to test the system.

msfconsole

Usage

Metasploit framework

We run Metasploit framework with msfrpcd that metasploit rpc daemon to open service waiting client to connect back.

#change directory to Metasploit framework folder and running with root permission
sudo ./msfrpcd -U <username as same as config> -P <password as same as config> -a localhost -f

Metasploit-webapp

We run web interface with Node.js after your download this repo via Git.

node ./bin/www

Open web browser and go to http://localhost:3000 then interface will appear.

THANKS

https://www.darkoperator.com/installing-metasploit-in-ubunt/

metasploit-webapp's People

Contributors

mister2tone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

metasploit-webapp's Issues

Confused about entry point of project.

Hi I fork this project and run with yarn start. I found app.js that use express to host your application but this file not to run when start application. Can you explain this point for me get it please.

Thank.

"Cannot connect to msfrpcd"

Hello,
When trying to run the interface, it says "Cannot connect to msfrpcd". I have set up the server correctly and provided details in config file. It seems there is port missing. Is this the default value??

Error: Cannot find module '../config/msfrpc-client.json'

I am trying to run "node ./bin/www" but receive the following error

─(root㉿kali)-[/home/kali/metasploit-webapp/bin]
└─# node www
internal/modules/cjs/loader.js:905
throw err;
^

Error: Cannot find module '../config/msfrpc-client.json'
Require stack:

  • /home/kali/metasploit-webapp/lib/msfrpc-connection.js
  • /home/kali/metasploit-webapp/app.js
  • /home/kali/metasploit-webapp/bin/www
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object. (/home/kali/metasploit-webapp/lib/msfrpc-connection.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object. (/home/kali/metasploit-webapp/app.js:7:14)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object. (/home/kali/metasploit-webapp/bin/www:7:11)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/home/kali/metasploit-webapp/lib/msfrpc-connection.js',
    '/home/kali/metasploit-webapp/app.js',
    '/home/kali/metasploit-webapp/bin/www'
    ]
    }

In msfrpcd-client there is no port specified

To connect to metasploit rpc service, you must specify a port..
It is not by default in msfrpcd-config.json. Deploying this gives these errors:

`module.js:675
throw err;
^

SyntaxError: /root/msfws/config/msfrpc-client.json: Unexpected string in JSON at position 124
at JSON.parse ()
at Object.Module._extensions..json (module.js:672:27)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/root/msfws/lib/msfrpc-connection.js:3:22)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/root/msfws/app.js:7:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)`
you should fix this

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.