Advertisement
coolproxies

ASSCLEANER

May 27th, 2019
15,873
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.40 KB | None | 0 0
  1. #!/bin/bash
  2. #BANNER
  3. echo -e "\e[1m .--.----------------."
  4. echo " / \ \ \ \ \ \ \ \ \ "
  5. echo -E " / \ \ "
  6. echo -E " / \ \ "
  7. echo -E " / | |"
  8. echo -E " | d8b | |"
  9. echo -E " | d888b || | | | | | | | |"
  10. echo -E " | 88888 || | | | | | | | |"
  11. echo -E " | Y888P | |"
  12. echo -E " \ Y8P | |"
  13. echo -E " \ // /"
  14. echo -E " \ // /"
  15. echo -E " \ /| | | | | | | | ||"
  16. echo -E " --- || | | | | | | | |"
  17. echo -E " \ \ "
  18. echo -E " \ \ "
  19. echo -e " \ \e[1;36mASSCLEANER\e[0m \ "
  20. echo -E " \ \ "
  21. echo -E " \ \ \ \ \ \ \ \ \ "
  22. echo -e " \................\ \e[0m"
  23. echo ""
  24. echo -e " ______________________________"
  25. echo -e " | - \e[1;36mSENTRY.MBA § COMUNNITY\e[0m - |"
  26. echo -e " | |"
  27. echo -e " | **************************** |"
  28. echo -e " | ▬▬ι═══════- ☯ -═══════ι▬▬ |"
  29. echo -e " | \e[36;3;1mBy BISHA\e[0m \e[0m|"
  30. echo -e " | **************************** |"
  31. echo -e " |______________________________|"
  32. echo ""
  33. echo ""
  34.  
  35.  
  36. INICIO=0
  37. while [ $INICIO -ne 3 ];do
  38.  
  39.  
  40. echo -e "\e[1;36m[-] Choose an option:\e[0m"
  41. echo "[1] Start"
  42. echo "[2] Help"
  43. echo "[3] Exit"
  44. read INICIO
  45.  
  46.  
  47. if [ $INICIO == 1 ];then
  48.  
  49.  
  50. echo ""
  51. echo -e "\e[1;36m[-] Load file:\e[0m"
  52. read -e ARCHIVO
  53. echo ""
  54.  
  55.  
  56. echo -e "\e[1;36m[-] Choose an option:\e[0m"
  57. echo "[1] Replace"
  58. echo "[2] Filter"
  59. echo "[3] Delete to"
  60. echo "[4] Count lines"
  61. echo "[5] Split up"
  62. echo "[6] Remove duplicates"
  63. read OPCION
  64. echo ""
  65.  
  66.  
  67. if [ $OPCION == 1 ];then
  68. echo "[-] Enter string to be replaced:"
  69. read TERM1
  70. echo "[-] Enter substitution string:"
  71. read TERM2
  72. echo ""
  73.  
  74.  
  75. elif [ $OPCION == 2 ];then
  76. echo -e "\e[1;36m[-] Choose type of search:\e[0m"
  77. echo "[1] Normal search"
  78. echo "[2] Negative search"
  79. read SEARCH
  80. if [ $SEARCH == 1 ];then
  81. echo ""
  82. echo "[-] Enter filter:"
  83. read FILTRO
  84. echo ""
  85. elif [ $SEARCH == 2 ];then
  86. echo ""
  87. echo "[-] Enter filter:"
  88. read FILTRO
  89. echo ""
  90. else
  91. echo -e "\e[0;36m\e[1mYou must choose a valid option, nibba.\e[0m"
  92. echo ""
  93. exit
  94. fi
  95.  
  96.  
  97. elif [ $OPCION == 3 ];then
  98. echo "[-] Enter string or character:"
  99. read FINAL
  100. echo ""
  101.  
  102.  
  103. elif [ $OPCION == 5 ];then
  104. echo -e "\e[1;36m[-] Divide the file:\e[0m"
  105. echo "[1] By number of files"
  106. echo "[2] By size"
  107. read SPLIT
  108. echo ""
  109.  
  110.  
  111. elif [ $OPCION == 4 ];then
  112. echo ""
  113.  
  114.  
  115. elif [ $OPCION == 6 ];then
  116. echo ""
  117.  
  118.  
  119. else
  120. echo ""
  121. echo -e "\e[0;36m\e[1mYou must choose a valid option, nibba.\e[0m"
  122. echo ""
  123. exit
  124. fi
  125.  
  126.  
  127. echo "[-] Delete null lines? Y/N"
  128. read LINEA
  129. echo ""
  130.  
  131.  
  132. echo "[-] Delete blank spaces? Y/N"
  133. read ESPAC
  134. echo ""
  135.  
  136.  
  137. echo ""
  138. echo "[-] Debugging file: " $ARCHIVO"..."
  139. echo ""
  140. echo ""
  141. echo -e "\e[1;36m----------------------- Running -----------------------\e[0m"
  142. echo ""
  143.  
  144.  
  145. echo "" > cleancombo.txt
  146.  
  147.  
  148. if [ $OPCION == 1 ];then
  149. echo "[-] Substituting strings..."
  150. sed 's/'$TERM1'/'$TERM2'/g' $ARCHIVO > cleancombo.txt
  151.  
  152.  
  153. elif [ $OPCION == 2 ];then
  154. if [ $SEARCH == 1 ];then
  155. echo "[-] Filtering lines using string" $FILTRO"..."
  156. grep $FILTRO $ARCHIVO > filteredcombo.txt
  157. elif [ $SEARCH == 2 ];then
  158. echo "[-] Filtering lines using string" $FILTRO"..."
  159. grep -v $FILTRO $ARCHIVO > filteredcombo.txt
  160. fi
  161.  
  162.  
  163. elif [ $OPCION == 3 ];then
  164. echo "[-] Deleting content of lines until" $FINAL"..."
  165. sed 's/.*['$FINAL']//' $ARCHIVO > cleancombo.txt
  166.  
  167.  
  168. elif [ $OPCION == 4 ];then
  169. echo "[-] Counting lines..."
  170. echo -e "\e[1m[-] Number of lines:\e[0m" `wc -l $ARCHIVO`
  171.  
  172.  
  173.  
  174. elif [ $OPCION == 5 ];then
  175. if [ $SPLIT == 1 ];then
  176. echo -e "\e[1;36m[-] Enter the number of files for output:\e[0m"
  177. read NF
  178. split -d -n $NF $ARCHIVO
  179. echo "[-] File divided into " $NF "parts\e[0m"
  180. elif [ $SPLIT == 2 ];then
  181. echo -e "\e[1;36m[-] Enter the size of divided parts\e[0m"
  182. read SF
  183. split -b $SF $ARCHIVO
  184. fi
  185.  
  186.  
  187. elif [ $OPCION == 6 ];then
  188. echo "[-] Removing duplicates..."
  189. sort $ARCHIVO | uniq > cleancombo.txt
  190. fi
  191.  
  192.  
  193. if [ $LINEA == 'Y' ];then
  194. echo "[-] Removing leftover lines..."
  195. sed -i '/^\s*$/d' cleancombo.txt
  196. fi
  197.  
  198.  
  199. if [ $ESPAC == 'Y' ];then
  200. echo "[-] Removing leftover spaces..."
  201. sed -i 's/ //g' cleancombo.txt
  202. fi
  203.  
  204. echo ""
  205. echo -e "\e[1;36m----------------------- Output ------------------------\e[0m"
  206. echo ""
  207. echo ""
  208.  
  209.  
  210. echo "Debugging..."
  211. if [ $OPCION == 1 ] || [ $OPCION == 3 ] || [ $OPCION == 5 ] || [ $OPCION == 6 ];then
  212. #cp cleancombo.txt $ARCHIVO
  213. echo "test"
  214. fi
  215.  
  216. echo ""
  217. echo -e "\e[1;36m-------------------------------------------------------"
  218. echo "----------------- It's already clean! -----------------"
  219. echo "-------------------------------------------------------"
  220. echo "--------------------- ASSCLEANER ----------------------"
  221. echo -e "-------------------------------------------------------\e[0m"
  222. echo ""
  223. # notify-send "WORK FINISH"
  224.  
  225.  
  226. elif [ $INICIO == 2 ];then
  227. echo ""
  228. echo -e "\e[0;36m\e[1m------------------------------------- HELP -----------------------------------"
  229. echo ""
  230. echo -e "[1] Replace:\e[0m enter a string to be replaced by another string."
  231. echo ""
  232. echo -e "\e[0;36m\e[1m[2] Filter:\e[0m delete all lines execpt those contaning specified string."
  233. echo ""
  234. echo -e "\e[0;36m\e[1m[3] Delete to:\e[0m delete the content of all lines until specified string is reached."
  235. echo ""
  236. echo -e "\e[0;36m\e[1m[4] Count lines:\e[0m hope you understand, bro."
  237. echo ""
  238. echo -e "\e[0;36m\e[1m[5] Split up:\e[0m split the file by size or by number of files."
  239. echo ""
  240. echo -e "\e[0;36m\e[1m[6] Remove duplicates:\e[0m really does need explanation?"
  241. echo ""
  242. echo -e "\e[0;36m\e[1m-------------------------------------------------------------------------------\e[0m"
  243.  
  244.  
  245. else
  246. echo ""
  247. echo -e "\e[0;36m\e[1mBye bro.\e[0m"
  248. echo ""
  249. fi
  250.  
  251.  
  252. done
  253. #ASSCLEANER By BISHA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement