Advertisement
v1ral_ITS

metasploitinstall.sh

Mar 30th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.03 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4.  
  5. print_pgp_key() {
  6.  
  7.   cat <<-EOF
  8.  
  9. -----BEGIN PGP PUBLIC KEY BLOCK-----
  10.  
  11. Version: GnuPG v1
  12.  
  13.  
  14.  
  15. mQINBFDAy/0BEAC8I5bw5gLQqHKx5JCacYcXFL6AZowl3qIOTxo5yfBl8CepNpWY
  16.  
  17. OOERvIUJb17WehhhbWOo9WjpBalDXBRtI1NvfArewOT8fLm7BdhYe8U45moBfkYi
  18.  
  19. xFtNrPw3pdIltHQISrB8PufhliN8obQuq0rcxYV8NblvYo4gIGNjBfO1QGvBNmp7
  20.  
  21. kBtjlAuZguScZmUTdPOwfv8fqN52X9tCv1ahQk1hg8XG9YwW0vXb5z93jkLXBb5b
  22.  
  23. sRCnou4m9IV6vOv2HVNRyMKT7uht3z4FqflP9NkySl4daCdZgmXbf169vvLdwLrC
  24.  
  25. lVymwAbwvuyILZv4JW1w0Kx8nWiTuK5A886882i83lxnkh1vC9jInva4/5hTrbRw
  26.  
  27. XJb7qOyh7sxa5GOfgq1NwVfLkrvVCMystrPu18sF1ORfg1UTFcz86RYdxpmoZvk7
  28.  
  29. EeABiLCQDZKOf0fV3U9CxLj8gXPjPY1Lu6udZUN6NG1ALJjsPkGnbpQEqEJlKNAG
  30.  
  31. +rF+tp73TrG0PW8C/THL7fN93ET3wn5tfNu86Liui9wd8ZLuPJNEYeE6eyPAgXJ4
  32.  
  33. p69Yb4ou5um5jWnzaVameECBZvtc4HOhy3nTEiVMDcKv/o8XxKOCLpjW1RSDirKl
  34.  
  35. ZRIsJYPx2yuJSVMCsN5Sghp5+OCsQ+On4OFWxCskemvy97ftkv/fwUI7mQARAQAB
  36.  
  37. tCJNZXRhc3Bsb2l0IDxtZXRhc3Bsb2l0QHJhcGlkNy5jb20+iQI9BBMBCgAnAhsD
  38.  
  39. BQsJCAcDBRUKCQgLBRYCAwEAAh4BAheABQJXyXj4BQkMrEd3AAoJEM37X6UgB7lU
  40.  
  41. GBAP/2h3lRymPIwJ7m3dKQ0ftphAvYarWdy1Y/KF2HYgmWeLjuzLlCWyiTG4pDjT
  42.  
  43. R/EtAdRsXVGI8JFI2QpPrlSlOetGipcSsjwZjq2NeflrpjixmB7srT8HX0OoVCcx
  44.  
  45. j7nxFwKs0oEd09fABO/K8ix5yNmDDv5y7jhz/hBfKTEqPXaY4btCZUw4A1tv8f1x
  46.  
  47. w5oRtnveDbJGUhnEZwDvj88xJGtHj0yHDZMCU+mHEL3MMs7bfugDHjOBKo+OzGNc
  48.  
  49. ZyAz1BjjRUt0CNfyTvzyPOEeKyhmxp/bA1X6BS+x5GqnbWP+fyWcL7hcrXpnwHDk
  50.  
  51. ZYajpML6COo8ryY45Mrf/GOBErKUauQVN0DBbliRMMTmpbDv/uxYk5B8JnlXnRES
  52.  
  53. KX4OFhOxkcCCIZLdq2uNBuatIz0fqBmLLLKavnff1NQ8/HM+elNf4k030wH+NE+p
  54.  
  55. ipzzNDId0kVbhZzdLEN/C81JW5YIBSDUqx5HBll2FpJ029zC9QWKzkclS1GwH4Lp
  56.  
  57. 63aufnM39Gjt5VqRmfLVfg9WsOGlZfn1BFSFH9UoT4UmktKmFDQWiEl2WzbcSLDz
  58.  
  59. At8hXxrXlNIb6SfRgjkFtjdVLsCWh9PHABrhpqy9BJ7A6dIIN1Dc8ryDmLqciKEZ
  60.  
  61. WLTjph8NdAAXi8fLEUcU2n9QSARwqT6QwtcP/O7c6UVPEjY3uQINBFDAy/0BEAC5
  62.  
  63. Ayq56LCeXqzf6LdlomjPNioSN9Cevi2VC/bJ4rgNWtenH6EH8F05xaXHePDuNWk9
  64.  
  65. gTadI6Row6OPa0QvMgex4wndZTPsEUZv3dBLf+JQYMnGmut40LRvhivYDfrH+C5I
  66.  
  67. g4CWJF19sBDopb2cPc1NlS0xoTlAfnu70T9i6ZwOJ0pL1BjSr2lnBfpP43sj9qO3
  68.  
  69. aK17pn134xgQGIlgheoQ4svF0+Rtq7jAw5Vmn6JXhklXrgdKJ4o6s0VOQWjfiGzC
  70.  
  71. Mxli0T+sr4WJpjtdtdCBmQRd/4CS0dzmlJvNgFeRIOBbJcwVYr+ttIQ7lbBKHkZ3
  72.  
  73. trjf6ohLWI0iyVmJ+ba7QKUJJP9YvjiunP5arU/gskPyEuvROfnyWJAGJAoByQXX
  74.  
  75. CZg10hysnGqww4oT0j7jdd9ZIMrf8GSxPaFennh+Wsva7raPTWBCzY5hla2cmcgG
  76.  
  77. EaOnbjf2clAW3MyGmllQpBGIDtOK8GppE8DnVhhM49uIDTHF2AikMltjqwzd6HV9
  78.  
  79. 39VA77Imal/PKNHyOWEAdmIRgYwHx+cEjzJAQSQkd0G3PSfJLBaf/0Vo1nBav8q9
  80.  
  81. VjgqhEFaNTzEj5Hqn6ldwKUul4Vb+AoSiz5Z1du32ul1CtcozUJTcWJL9ebZ8YbS
  82.  
  83. qy7Ol4slSW3ukNaG6tBTqQYb9liIdvdQUG6oJhmzbwARAQABiQIlBBgBCgAPAhsM
  84.  
  85. BQJXyXjnBQkMrEdiAAoJEM37X6UgB7lUJ9YP+gIFmDyjBdTD+pX+6z9FBb8p7SF8
  86.  
  87. hLEpP51m1CSAfquDfaMOVRQ6d4P3N0KjPQs7uz1uqjQliyaek4jtEqMfkPdYwcvj
  88.  
  89. 8Zv17u41fAkS3BJFg3cR2+jtzF69sA/phHR+/a6MSnm/W+0YFOQHBKO6MIwC0an5
  90.  
  91. qHzG1MBic6rb8qjZlsJowwlF06ZrSmodhulB2q2JMAqUvQd923wJtMIlur4wavpn
  92.  
  93. iKdCYomlNcPF/UMVutUn0XuP7ca0yFXJgKJznLAFQ8g+b8aLyvodZYHjblaizkoj
  94.  
  95. EWDN3zPTQebnP7N8wTl0+rc2F3Bmnak6+m0P/F1kYXyz3obSvQXwe3rYAkxarcg9
  96.  
  97. 5wXQRn6hN0PBb5lD05Ytx/peZrYpYFe4CYPtiL+y7sseExQhrRjpWr3FKGCKBpsr
  98.  
  99. QkGUk3MiZ4iHVvlyKv/Z9IMYNRmVzMXUM2QAbRgYD0x4kvdXso6YR2rn8sC89c/O
  100.  
  101. xIBK1HRwVgfRofUe9PmdeKhsBVYEQkNb8V18YP0GswrBc4cjoGqDwV64yPAotP2t
  102.  
  103. B9QhqjJFM9xDT/wJSxKi1uzzSwQBfpD/ylsTB6/v1K3dksvQ6cVZqaBt4g2hq78r
  104.  
  105. Eq+ZyncUD2z3eXXrlVheqJdXZXoayQFaTo4iIAc7wbraZZ6mDr6mxxFMlUqO2qxT
  106.  
  107. h3RIcafYvaF7yUDA
  108.  
  109. =hQKe
  110.  
  111. -----END PGP PUBLIC KEY BLOCK-----
  112.  
  113. EOF
  114.  
  115. }
  116.  
  117.  
  118.  
  119. install_deb() {
  120.  
  121.   LIST_FILE=/etc/apt/sources.list.d/metasploit-framework.list
  122.  
  123.   PREF_FILE=/etc/apt/preferences.d/pin-metasploit.pref
  124.  
  125.   if [ ! -f $LIST_FILE ]; then
  126.  
  127.     echo -n "Adding metasploit-framework to your repository list.."
  128.  
  129.     echo "deb $DOWNLOAD_URI/apt lucid main" > $LIST_FILE
  130.  
  131.     print_pgp_key | apt-key add -
  132.  
  133.   fi
  134.  
  135.   if [ ! -f $PREF_FILE ]; then
  136.  
  137.     mkdir -p /etc/apt/preferences.d/
  138.  
  139.     cat > $PREF_FILE <<EOF
  140.  
  141. Package: metasploit*
  142.  
  143. Pin: origin downloads.metasploit.com
  144.  
  145. Pin-Priority: 1000
  146.  
  147. EOF
  148.  
  149.   fi
  150.  
  151.   echo -n "Updating package cache.."
  152.  
  153.   apt-get update > /dev/null
  154.  
  155.   echo "OK"
  156.  
  157.   echo "Checking for and installing update.."
  158.  
  159.   apt-get install -y --force-yes metasploit-framework
  160.  
  161. }
  162.  
  163.  
  164.  
  165. install_rpm() {
  166.  
  167.   echo "Checking for and installing update.."
  168.  
  169.   REPO_FILE=/etc/yum.repos.d/metasploit-framework.repo
  170.  
  171.   GPG_KEY_FILE=/etc/pki/rpm-gpg/RPM-GPG-KEY-Metasploit
  172.  
  173.   if [ ! -f $REPO_FILE ]; then
  174.  
  175.     echo -n "Adding metasploit-framework to your repository list.."
  176.  
  177.  
  178.  
  179.     cat > /etc/yum.repos.d/metasploit-framework.repo <<EOF
  180.  
  181. [metasploit]
  182.  
  183. name=Metasploit
  184.  
  185. baseurl=$DOWNLOAD_URI/rpm
  186.  
  187. gpgcheck=1
  188.  
  189. gpgkey=file://$GPG_KEY_FILE
  190.  
  191. enabled=1
  192.  
  193. EOF
  194.  
  195.     print_pgp_key > ${GPG_KEY_FILE}
  196.  
  197.   fi
  198.  
  199.   yum install -y metasploit-framework
  200.  
  201. }
  202.  
  203.  
  204.  
  205. install_pkg()
  206.  
  207. {
  208.  
  209.   (
  210.  
  211.     cd ~/Downloads
  212.  
  213.  
  214.  
  215.     echo "Downloading package..."
  216.  
  217.     curl -O "$DOWNLOAD_URI/osx/metasploitframework-latest.pkg"
  218.  
  219.  
  220.  
  221.     echo "Checking signature..."
  222.  
  223.  
  224.  
  225.     if pkgutil --check-signature metasploitframework-latest.pkg; then
  226.  
  227.       echo "Installing package..."
  228.  
  229.       installer -pkg metasploitframework-latest.pkg -target /
  230.  
  231.     fi
  232.  
  233.  
  234.  
  235.     echo "Cleaning up..."
  236.  
  237.     rm -fv metasploitframework-latest.pkg
  238.  
  239.   )
  240.  
  241. }
  242.  
  243.  
  244.  
  245. DOWNLOAD_URI=http://downloads.metasploit.com/data/releases/metasploit-framework
  246.  
  247. PKGTYPE=unknown
  248.  
  249. ID=`id -u`
  250.  
  251.  
  252.  
  253. if [ -f /etc/redhat-release ] ; then
  254.  
  255.   PKGTYPE=rpm
  256.  
  257. elif [ -f /etc/system-release ] ; then
  258.  
  259.   # If /etc/system-release is present, this is likely a distro that uses RPM.
  260.  
  261.   PKGTYPE=rpm
  262.  
  263. else
  264.  
  265.   if uname -sv | grep 'Darwin' > /dev/null; then
  266.  
  267.     PKGTYPE=pkg
  268.  
  269.   else
  270.  
  271.     PKGTYPE=deb
  272.  
  273.   fi
  274.  
  275. fi
  276.  
  277.  
  278.  
  279. if [ "$ID" -ne 0 ]; then
  280.  
  281.   if ! hash sudo 2>/dev/null; then
  282.  
  283.     echo "This script must be executed as the 'root' user or with sudo"
  284.  
  285.     exit 1
  286.  
  287.   else
  288.  
  289.     echo "Switching to root user to update the package"
  290.  
  291.     sudo -E $0 $@
  292.  
  293.     exit 0
  294.  
  295.   fi
  296.  
  297. fi
  298.  
  299.  
  300.  
  301. case $PKGTYPE in
  302.  
  303.   deb)
  304.  
  305.     install_deb
  306.  
  307.     ;;
  308.  
  309.   rpm)
  310.  
  311.     install_rpm
  312.  
  313.     ;;
  314.  
  315.   *)
  316.  
  317.     install_pkg
  318.  
  319. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement