Advertisement
opexxx

update_armitage.sh

Feb 23rd, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.99 KB | None | 0 0
  1. #!/bin/bash
  2. KVER=`uname -a`
  3.  
  4. function print_good ()
  5. {
  6.     echo -e "\x1B[01;32m[*]\x1B[0m $1"
  7. }
  8. ########################################
  9.  
  10. function print_error ()
  11. {
  12.     echo -e "\x1B[01;31m[*]\x1B[0m $1"
  13. }
  14. ########################################
  15.  
  16. function print_status ()
  17. {
  18.     echo -e "\x1B[01;34m[*]\x1B[0m $1"
  19. }
  20. ########################################
  21.  
  22. function install_armitage_osx
  23. {
  24.     if [ -e /usr/bin/curl ]; then
  25.         print_status "Downloading latest version of Armitage"
  26.     curl -# -o /tmp/armitage.tgz http://www.fastandeasyhacking.com/download/armitage-latest.tgz && print_good "Finished"
  27.     if [ $? -eq 1 ] ; then
  28.             print_error "Failed to download the latest version of Armitage make sure you"
  29.         print_error "are connected to the internet and can reach http://www.fastandeasyhacking.com"
  30.     else
  31.         print_status "Decompressing package to /usr/local/share/armitage"
  32.         tar -xvzf /tmp/armitage.tgz -C /usr/local/share
  33.     fi
  34.  
  35.     # Check if links exists and if they do not create them
  36.     if [ ! -e /usr/local/bin/armitage ]; then
  37.         print_status "Linking Armitage in /usr/local/bin/armitage"
  38.         sh -c "echo java -jar /usr/local/share/armitage/armitage.jar \$\* > /usr/local/share/armitage/armitage"
  39.         ln -s /usr/local/share/armitage/armitage /usr/local/bin/armitage
  40.     else
  41.         print_good "Armitage is already linked to /usr/local/bin/armitage"
  42.         echo java -jar /usr/local/share/armitage/armitage.jar \$\* > /usr/local/bin/armitage
  43.     fi
  44.  
  45.     if [ ! -e /usr/local/bin/teamserver ]; then
  46.         print_status "Copying Teamserver in /usr/local/bin/teamserver"
  47.         ln -s /usr/local/armitage/teamserver /usr/local/bin/teamserver
  48.         perl -pi -e 's/armitage.jar/\/usr\/local\/share\/armitage\/armitage.jar/g' /usr/local/share/armitage/teamserver
  49.     else
  50.         print_good "Teamserver is already linked to /usr/local/bin/teamserver"
  51.         perl -pi -e 's/armitage.jar/\/usr\/local\/share\/armitage\/armitage.jar/g' /usr/local/share/armitage/teamserver
  52.     fi
  53.     print_good "Finished"
  54.     fi
  55. }
  56. ########################################
  57.  
  58. function install_armitage_linux
  59. {
  60.     if [ -e /usr/bin/curl ]; then
  61.     print_status "Downloading latest version of Armitage"
  62.     curl -# -o /tmp/armitage.tgz http://www.fastandeasyhacking.com/download/armitage-latest.tgz && print_good "Finished"
  63.     if [ $? -eq 1 ] ; then
  64.         print_error "Failed to download the latest version of Armitage make sure you"
  65.         print_error "are connected to the internet and can reach http://www.fastandeasyhacking.com"
  66.         else
  67.         print_status "Decompressing package to /usr/local/share/armitage"
  68.         sudo tar -xvzf /tmp/armitage.tgz -C /usr/local/share >>outfile 2>&1
  69.     fi
  70.  
  71.     # Check if links exists and if they do not create them
  72.     if [ ! -e /usr/local/bin/armitage ]; then
  73.         print_status "Creating link for Armitage in /usr/local/bin/armitage"
  74.         sudo sh -c "echo java -jar /usr/local/share/armitage/armitage.jar \$\* > /usr/local/share/armitage/armitage"
  75.         sudo ln -s /usr/local/share/armitage/armitage /usr/local/bin/armitage
  76.     else
  77.         print_good "Armitage is already linked to /usr/local/bin/armitage"
  78.         sudo sh -c "echo java -jar /usr/local/share/armitage/armitage.jar \$\* > /usr/local/share/armitage/armitage"
  79.     fi
  80.  
  81.     if [ ! -e /usr/local/bin/teamserver ]; then
  82.         print_status "Creating link for Teamserver in /usr/local/bin/teamserver"
  83.         sudo ln -s /usr/local/share/armitage/teamserver /usr/local/bin/teamserver
  84.         sudo perl -pi -e 's/armitage.jar/\/usr\/local\/share\/armitage\/armitage.jar/g' /usr/local/share/armitage/teamserver
  85.     else
  86.         print_good "Teamserver is already linked to /usr/local/bin/teamserver"
  87.         sudo perl -pi -e 's/armitage.jar/\/usr\/local\/share\/armitage\/armitage.jar/g' /usr/local/share/armitage/teamserver
  88.     fi
  89.     print_good "Finished"
  90.     fi
  91. }
  92.  
  93. if [[ "$KVER" =~ Darwin ]]; then
  94.     install_armitage_osx
  95.  
  96. elif [[ "$KVER" =~ buntu ]]; then
  97.     install_armitage_linux
  98.  
  99. else
  100.     print_error "The script does not support this platform at this moment."
  101.     exit 1
  102. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement