forked from Hax4us/Metasploit_termux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetasploit.sh
70 lines (49 loc) · 2.28 KB
/
metasploit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/data/data/com.termux/files/usr/bin/bash
# Remove Old Folder if exist
find $HOME -name "metasploit*" -type d -exec rm -rf {} \;
cwd=$(pwd)
msfvar=5.0.80
msfpath='/data/data/com.termux/files/home'
apt update
apt install -y libiconv zlib autoconf bison clang coreutils curl findutils git apr apr-util libffi libgmp libpcap postgresql readline libsqlite openssl libtool libxml2 libxslt ncurses pkg-config wget make ruby libgrpc termux-tools ncurses-utils ncurses unzip zip tar termux-elf-cleaner
# Many phones are claiming libxml2 not found error
ln -sf $PREFIX/include/libxml2/libxml $PREFIX/include/
cd $msfpath
curl -LO https://github.com/rapid7/metasploit-framework/archive/$msfvar.tar.gz
tar -xf $msfpath/$msfvar.tar.gz
mv $msfpath/metasploit-framework-$msfvar $msfpath/metasploit-framework
cd $msfpath/metasploit-framework
sed '/rbnacl/d' -i Gemfile.lock
sed '/rbnacl/d' -i metasploit-framework.gemspec
gem install bundler
#isNokogiri=$(gem list nokogiri -i)
#sed 's|nokogiri (1.*)|nokogiri (1.8.0)|g' -i Gemfile.lock
#if [ $isNokogiri == "false" ];
#then
# gem install nokogiri -v '1.8.0' -- --use-system-libraries
#else
# echo "nokogiri already installed"
#fi
cd $msfpath/metasploit-framework && rm Gemfile.lock
curl -LO https://hax4us.github.io/files/Gemfile.lock
bundle update --bundler
gem update --system
bundle install -j5
echo "Gems installed"
$PREFIX/bin/find -type f -executable -exec termux-fix-shebang \{\} \;
rm ./modules/auxiliary/gather/http_pdf_authors.rb
#ln -sf $msfpath/metasploit-framework/msfconsole /data/data/com.termux/files/usr/bin/
#ln -sf $msfpath/metasploit-framework/msfvenom /data/data/com.termux/files/usr/bin/
termux-elf-cleaner /data/data/com.termux/files/usr/lib/ruby/gems/2.6.0/gems/pg-0.20.0/lib/pg_ext.so
echo "Creating database"
cd $msfpath/metasploit-framework/config
curl -LO https://raw.githubusercontent.com/Hax4us/Metasploit_termux/master/database.yml
mkdir -p $PREFIX/var/lib/postgresql
initdb $PREFIX/var/lib/postgresql
pg_ctl -D $PREFIX/var/lib/postgresql start
createuser msf
createdb msf_database
rm $msfpath/$msfvar.tar.gz
cd ${PREFIX}/bin && curl -LO https://hax4us.github.io/files/msfconsole && chmod +x msfconsole
ln -sf $(which msfconsole) $PREFIX/bin/msfvenom
echo "you can directly use msfvenom or msfconsole rather than ./msfvenom or ./msfconsole."