Advertisement
opexxx

wlm.sh / wordlistmanipulator

Jul 31st, 2013
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 80.21 KB | None | 0 0
  1. #!/bin/bash
  2. # Word List Manipulator (wlm)
  3. # Version 0.8 last edit 26-10-2012 23:05
  4. # Build: 0804
  5. # Credits to ;
  6. # ============
  7. # Gitsnik, because he's awesome :)
  8. # Pureh@te as used and learned a lot from his wordlist_tool script.
  9. # Members at unix.com, have always received expert help there.
  10. # http://cfajohnson.com/shell/ssr/08-The-Dating-Game.shtml for datelist updates.
  11. # Google ;)
  12. #
  13. #FIXED SETTINGS
  14. RED=$(tput setaf 1 && tput bold)
  15. GREEN=$(tput setaf 2 && tput bold)
  16. STAND=$(tput sgr0)
  17. BLUE=$(tput setaf 6 && tput bold)
  18. CURR_VERS=$(sed -n 3p $0 | cut -c 11-13)
  19. CURR_BUILD=$(sed -n 4p $0 | cut -c 10-13)
  20. #
  21. #
  22. #--------------
  23. # MENU ITEM 1
  24. #==============
  25. # CASE OPTIONS
  26. ###############
  27. function f_case {
  28. clear
  29. echo $STAND"Wordlist Manipulator"
  30. echo $BLUE"Case options"
  31. echo $STAND"--------------------"
  32. echo "1 Change case of first letter
  33. 2 Change case of last letter
  34. 3 Change all lower case to upper case
  35. 4 Change all upper case to lower case
  36. 5 Invert case (lower to upper, upper to lower)
  37.  
  38. Q Back to menu
  39. "
  40. echo -ne $STAND"Enter choice from above menu: "$GREEN
  41. read case_menu
  42. if [ "$case_menu" == "q" ] || [ "$case_menu" == "Q" ] ; then
  43. echo $STAND""
  44. f_menu
  45. elif [[ "$case_menu" != [1-5] ]]; then
  46. echo $RED"must be an entry from the above menu $STAND"
  47. sleep 1
  48. f_case
  49. fi
  50.  
  51. #
  52. # Option 1
  53. # Changing first letter to lower or upper case
  54. # --------------------------------------------
  55. if [ $case_menu = "1" ] ; then
  56. echo ""
  57. echo $BLUE"Change first letter to lower case or upper case"$STAND
  58. echo $STAND""
  59. f_inout
  60.     echo -ne $STAND"Change all first letters to upper case or lower case ? U / L "$GREEN
  61.     read first_letter
  62.     until [[ "$first_letter" == "u" ]] || [[ "$first_letter" == "l" ]] || [[ "$first_letter" == "U" ]] || [[ "$first_letter" == "L" ]] ; do
  63.     echo -ne $RED"Please enter either U or L for upper or lower case$STAND U / L "$GREEN
  64.     read first_letter
  65.     done
  66.     echo $STAND"Working .."
  67.     if [ "$first_letter" == "l" ] || [ "$first_letter" == "L" ] ; then
  68.     sudo -u root sed 's/^./\l&/' $wlm_infile > $wlm_outfile
  69.     elif [ "$first_letter" == "u" ] || [ "$first_letter" == "U" ] ; then
  70.     sudo -u root sed 's/^./\u&/' $wlm_infile > $wlm_outfile
  71.     fi
  72.     echo $STAND""
  73. f_complete
  74. #
  75. # Option 2
  76. # Changing last letter to lower or upper case
  77. # -------------------------------------------
  78. elif [ $case_menu = "2" ] ; then
  79. echo ""
  80. echo $BLUE"Change last letter to lower case or upper case"$STAND
  81. echo $STAND""
  82. f_inout
  83.     echo -ne $STAND"Change all last letters to upper case or lower case ? U / L "$GREEN
  84.     read last_letter
  85.     until [[ "$last_letter" == "u" ]] || [[ "$last_letter" == "l" ]] || [[ "$last_letter" == "U" ]] || [[ "$last_letter" == "L" ]] ; do
  86.     echo -ne $RED"Please enter either U or L for upper or lower case$STAND U / L "$GREEN
  87.     read last_letter
  88.     done
  89.     echo $STAND"Working .."
  90.     if [ "$last_letter" == "l" ] || [ "$last_letter" == "L" ] ; then
  91.     sudo -u root sed 's/.$/\l&/' $wlm_infile > $wlm_outfile
  92.     elif [ "$last_letter" == "u" ] || [ "$last_letter" == "U" ] ; then
  93.     sudo -u root sed 's/.$/\u&/' $wlm_infile > $wlm_outfile
  94.     fi
  95.     echo $STAND""
  96. f_complete
  97. #
  98. # Option 3
  99. # Change all lower case to upper case
  100. # -----------------------------------
  101. elif [ $case_menu = "3" ] ; then
  102. echo ""
  103. echo $BLUE"Change all lower case to Upper case"$STAND
  104. echo $STAND""
  105. f_inout
  106.     echo $STAND"Working .."
  107.     sudo -u root tr '[:lower:]' '[:upper:]' < $wlm_infile > $wlm_outfile
  108.     echo $STAND""
  109. f_complete
  110. #
  111. # Option 4
  112. # Change all upper case to lower case
  113. # -----------------------------------
  114. elif [ $case_menu = "4" ] ; then
  115. echo ""
  116. echo $BLUE"Change all Upper case to lower case"$STAND
  117. echo $STAND""
  118. f_inout
  119.     echo $STAND"Working .."
  120.     sudo -u root tr '[:upper:]' '[:lower:]' < $wlm_infile > $wlm_outfile
  121.     echo $STAND""
  122. f_complete
  123. #
  124. # Option 5
  125. # Invert case from original input
  126. # --------------------------------
  127. elif [ $case_menu = "5" ] ; then
  128. echo ""
  129. echo $BLUE"Invert case from original input"$STAND
  130. echo $STAND""
  131. f_inout
  132.     echo $STAND"Working .."
  133.     sudo -u root tr 'a-z A-Z' 'A-Z a-z' < $wlm_infile > $wlm_outfile
  134.     echo $STAND""
  135. f_complete
  136. fi
  137. }
  138. #
  139. #
  140. #--------------
  141. # MENU ITEM 2
  142. #==============
  143. # COMBINATION OPTIONS
  144. #####################
  145. f_combine () {
  146. clear
  147. echo $STAND"Wordlist Manipulator"
  148. echo $BLUE"Combination options"
  149. echo $STAND"--------------------"
  150. echo "1 Combine words from 1 list to each word in another list
  151. 2 Combine all wordlists in a directory to 1 wordlist
  152.  
  153. Q Return to menu
  154. "
  155. echo -ne $STAND"Enter choice from above menu: "$GREEN
  156. read comb_menu
  157. if [ "$comb_menu" == "q" ] || [ "$comb_menu" == "Q" ] ; then
  158. echo $STAND""
  159. f_menu
  160. elif [[ "$comb_menu" != [1-2] ]]; then
  161. echo $RED"must be an entry from the above menu $STAND"
  162. sleep 1
  163. f_combine
  164. fi
  165. #
  166. # Option 1
  167. # Combine words from 1 list to each word in another list
  168. # ------------------------------------------------------
  169. if [ "$comb_menu" == "1" ] ; then
  170.   echo ""
  171.   echo $BLUE"Combine words from one wordlist to all words in another wordlist"
  172.   echo $STAND""
  173.   echo -ne $STAND"Enter /path/to/wordlist to which you want words appended: "$GREEN
  174.   read comb_infile1
  175.   while [ ! -f $comb_infile1 ] ; do
  176.   echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  177.   read comb_infile1
  178.   done
  179.   echo -ne $STAND"Enter /path/to/wordlist to append to $BLUE$comb_infile1$STAND: "$GREEN
  180.   read comb_infile2
  181.   while [ ! -f $comb_infile2 ] ; do
  182.   echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  183.   read comb_infile2
  184.   done
  185.   echo -ne $STAND"Enter desired output file name: "$GREEN
  186.   read wlm_outfile
  187.   if [ -f $wlm_outfile ] ; then
  188.   echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  189.   read over
  190.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  191.     echo $RED"Existing file $GREEN$wlm_outfile$RED will be overwritten"
  192.     sleep 1
  193.     else
  194.     echo $STAND"Process cancelled, returning to menu"
  195.     f_menu
  196.     fi
  197.   fi
  198. echo $STAND"Working .."
  199. sudo -u root awk > $wlm_outfile 'NR == FNR {
  200.  l2[FNR] = $0
  201.  fnr = FNR; next
  202.  }
  203. {
  204.  for (i = 0; ++i <= fnr;)
  205.    print $0 l2[i]
  206.  }' $comb_infile2 $comb_infile1
  207. echo $STAND""
  208. f_complete
  209. #
  210. # Option 2
  211. # Combine all wordlists in a directory
  212. # ------------------------------------
  213. elif [ "$comb_menu" == "2" ] ; then
  214. echo ""
  215. echo $BLUE"Combine all wordlists in a directory to 1 wordlist."
  216. echo $STAND""
  217.     echo -ne $STAND"Enter directory where the wordlists are stored \n(ie. /root/wordlists) : "$GREEN
  218.     read directory
  219.     while [ ! -d "$directory" ] || [ "$directory" == "" ] ; do
  220.     echo $RED"Directory does not exist or cannot be found"$STAND
  221.     echo -ne $STAND"Enter existing directory: "
  222.     read directory
  223.     done
  224.     ls $directory > files_temp
  225.     echo $STAND"! Note that ALL files in directory $GREEN$directory$STAND will be combined;"$BLUE
  226.     cat files_temp
  227.     echo $STAND""
  228.     echo -ne $STAND"Continue or Quit ? C / Q "$GREEN
  229.     read go_for_it
  230.     if [ "$go_for_it" == "c" ] || [ "$go_for_it" == "C" ] ; then
  231.     rm files_temp
  232.     echo $STAND ""
  233.     else
  234.     echo $STAND""
  235.     echo "Quitting .."
  236.     rm files_temp
  237.     sleep 0.5
  238.     exit
  239.     fi
  240.    echo -ne $STAND"Enter desired output file name: "$GREEN
  241.     read wlm_outfile
  242.     if [ -f $wlm_outfile ] ; then
  243.     echo -ne $RED"File already exists, add data to existing file ? y/n "$GREEN
  244.     read over
  245.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  246.     echo $STAND"Working.."
  247.     sleep 1
  248.     else
  249.     echo $STAND"Process cancelled, returning to menu"
  250.     sleep 1
  251.     f_menu
  252.     fi
  253.     fi
  254.         sudo -u root cat $directory/* >> "$wlm_outfile"
  255.     echo $STAND""
  256. f_complete
  257. fi
  258. }
  259. #
  260. #
  261. #--------------
  262. # MENU ITEM 3
  263. #============
  264. # PREPENDING / PREFIXING OPTIONS
  265. ################################
  266. f_prefix () {
  267. clear
  268. echo $STAND"Wordlist Manipulator"
  269. echo $BLUE"Prefix options"
  270. echo $STAND"--------------------"
  271. echo "1 Prefix numeric values in sequence to a wordlist (ie. 0 - 99999)
  272. 2 Prefix fixed number of numeric values in sequence to a wordlist (ie. 00000 - 99999)
  273. 3 Prefix word / characters to a wordlist
  274.  
  275. Q Back to menu"
  276. echo -ne $STAND"Enter choice from above menu: "$GREEN
  277. read pref_menu
  278. if [ "$pref_menu" == "q" ] || [ "$pref_menu" == "Q" ] ; then
  279. echo $STAND""
  280. f_menu
  281. elif [[ "$pref_menu" != [1-3] ]]; then
  282. echo $RED"must be an entry from the above menu $STAND"
  283. sleep 1
  284. f_prefix
  285. fi
  286. #
  287. # Option 1
  288. # Prefix numbers in sequence to a list
  289. # ------------------------------------
  290. if [ "$pref_menu" == "1" ] ; then
  291. echo $STAND""
  292. echo $BLUE"Prefix numeric values in sequence to a wordlist (ie. 0 - 99999)"
  293. echo $STAND""
  294. echo -ne $STAND"Enter /path/to/wordlist to prefix numbers to: "$GREEN
  295. read pref_nums
  296.     while [ ! -f "$pref_nums" ] ; do
  297.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  298.     read pref_nums
  299.     done
  300. #Check if any '%' characters in the file which could cause errors
  301. grep "%" $pref_nums > prefnums_errors
  302. exist=$(sed -n '$=' prefnums_errors)
  303. if [ "$exist" == "" ] ; then
  304. rm prefnums_errors
  305. elif [ "$exist" != "" ] ; then
  306. echo $RED"Lines with '%' character exist in file which will not be processed"
  307. echo -ne $STAND"View these lines ? y/n "$GREEN
  308. read view
  309.   if [ "$view" == "y" ] || [ "$view" == "Y" ] ; then
  310.   cat prefnums_errors
  311.   else
  312.   echo $STAND""
  313.   fi
  314. rm prefnums_errors
  315. fi
  316. #
  317. #Enter output file to write the changes to
  318. echo -ne $STAND"Enter desired output file name: "$GREEN
  319. read pref_nums_out
  320. if [ -f "$pref_nums_out" ] ; then
  321.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  322.     read over
  323.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  324.     echo $RED"Existing file $GREEN$pref_nums_out$RED will be overwritten"$STAND
  325.     else
  326.     echo $STAND"Process cancelled, returning to menu"
  327.     sleep 1
  328.     f_menu
  329.     fi
  330. fi
  331. echo -ne $STAND"Enter how many numeric values you want to Prefix (max 5): "$GREEN
  332. read numbs
  333. echo $STAND"Working .."
  334.     if [ "$numbs" == 1 ] ; then
  335.     for i in $(cat $pref_nums); do seq -f "%01.0f$i" 0 9; done > "$pref_nums_out"
  336.     elif [ "$numbs" == 2 ] ; then
  337.     for i in $(cat $pref_nums); do seq -f "%01.0f$i" 0 99; done > "$pref_nums_out"
  338.     elif [ "$numbs" == 3 ] ; then
  339.     for i in $(cat $pref_nums); do seq -f "%01.0f$i" 0 999; done > "$pref_nums_out"
  340.     elif [ "$numbs" == 4 ] ; then
  341.     for i in $(cat $pref_nums); do seq -f "%01.0f$i" 0 9999; done > "$pref_nums_out"
  342.     elif [ "$numbs" == 5 ] ; then
  343.     for i in $(cat $pref_nums); do seq -f "%01.0f$i" 0 99999; done > "$pref_nums_out"
  344.     fi
  345. echo $STAND""
  346. echo "$GREEN$pref_nums_out$STAND has been created; "
  347. head -n 3 $pref_nums_out
  348. echo ".."
  349. tail -n 3 $pref_nums_out
  350. echo $STAND""
  351.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  352.     read return
  353.     if [ "$return" == "" ] ; then
  354.         echo $STAND""
  355.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  356.         echo $STAND""
  357.         exit
  358.     fi
  359. #
  360. # Option 2
  361. # Prefix fixed number of numberic values to a list
  362. # ------------------------------------------------
  363. elif [ "$pref_menu" == "2" ] ; then
  364. echo $STAND""
  365. echo $BLUE"Prefix fixed number of numeric values in sequence to a wordlist (ie. 00000 - 99999)"
  366. echo $STAND""
  367. echo -ne $STAND"Enter /path/to/wordlist to prefix numbers to: "$GREEN
  368. read pref_numf
  369.     while [ ! -f $pref_numf ] ; do
  370.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  371.     read $pref_numf
  372.     done
  373. #Check if any '%' characters in the file which could cause errors
  374. grep "%" $pref_numf > prefnumf_errors
  375. exist=$(sed -n '$=' prefnumf_errors)
  376. if [ "$exist" == "" ] ; then
  377. rm prefnumf_errors
  378. elif [ "$exist" != "" ] ; then
  379. echo $RED"Lines with '%' character exist in file which will not be processed"
  380. echo -ne $STAND"View these lines ? y/n "$GREEN
  381. read view
  382.   if [ "$view" == "y" ] || [ "$view" == "Y" ] ; then
  383.   cat prefnumf_errors
  384.   else
  385.   echo $STAND""
  386.   fi
  387. rm prefnumf_errors
  388. fi
  389. #
  390. #Enter output file to write the changes to
  391. echo -ne $STAND"Enter desired output file name: "$GREEN
  392. read pref_numf_out
  393. if [ -f $pref_numf_out ] ; then
  394.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  395.     read over
  396.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  397.     echo $RED"Existing file $GREEN$pref_numf_out$RED will be overwritten"$STAND
  398.     else
  399.     echo $STAND"Process cancelled, returning to menu "
  400.     sleep 1
  401.     f_menu
  402.     fi
  403. fi
  404. echo -ne $STAND"Enter how many numeric values you want to Prefix (max 5): "$GREEN
  405. read numbf
  406. echo $STAND"Working .."
  407.     if [ "$numbf" == 1 ] ; then
  408.     for i in $(cat $pref_numf); do seq -f "%0$numbf.0f$i" 0 9; done > "$pref_numf_out"
  409.     elif [ "$numbf" == 2 ] ; then
  410.     for i in $(cat $pref_numf); do seq -f "%0$numbf.0f$i" 0 99; done > "$pref_numf_out"
  411.     elif [ "$numbf" == 3 ] ; then
  412.     for i in $(cat $pref_numf); do seq -f "%0$numbf.0f$i" 0 999; done > "$pref_numf_out"
  413.     elif [ "$numbf" == 4 ] ; then
  414.     for i in $(cat $pref_numf); do seq -f "%0$numbf.0f$i" 0 9999; done > "$pref_numf_out"
  415.     elif [ "$numbf" == 5 ] ; then
  416.     for i in $(cat $pref_numf); do seq -f "%0$numbf.0f$i" 0 99999; done > "$pref_numf_out"
  417.     fi
  418. echo $STAND""
  419. echo "$GREEN$pref_numf_out$STAND has been created; "
  420. head -n 3 $pref_numf_out
  421. echo ".."
  422. tail -n 3 $pref_numf_out
  423. echo $STAND""
  424.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  425.     read return
  426.     if [ "$return" == "" ] ; then
  427.         echo $STAND""
  428.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  429.         echo $STAND""
  430.         exit
  431.     fi
  432. #
  433. # Option 3
  434. # Prefix word / characters to a list
  435. # ----------------------------------
  436. elif [ "$pref_menu" == "3" ] ; then
  437. echo $STAND""
  438. echo $BLUE"Prefix word / characters to a wordlist"
  439. echo $STAND""
  440. f_inout
  441. echo -ne $STAND"Enter word/characters you want prefixed: "$GREEN
  442. read pref_char
  443. echo $STAND"Working .."
  444. sudo -u root sed "s/^./"$pref_char"&/" "$wlm_infile" > "$wlm_outfile"
  445. echo $STAND""
  446. f_complete
  447. fi
  448. }
  449. #
  450. #
  451. #------------
  452. # MENU ITEM 4
  453. #============
  454. # APPENDING / SUFFIXING OPTIONS
  455. ###############################
  456. f_suffix () {
  457. clear
  458. echo $STAND"Wordlist Manipulator"
  459. echo $BLUE"Suffix options"
  460. echo $STAND"--------------------"
  461. echo "1 Suffix numeric values in sequence to a wordlist (ie. 0 - 99999)
  462. 2 Suffix fixed number of numeric values in sequence to a wordlist (ie. 00000 - 99999)
  463. 3 Suffix word / characters to a wordlist
  464.  
  465. Q Back to menu
  466. "
  467. echo -ne $STAND"Enter choice from above menu: "$GREEN
  468. read suf_menu
  469. if [ "$suf_menu" == "q" ] || [ "$suf_menu" == "Q" ] ; then
  470. echo $STAND""
  471. f_menu
  472. elif [[ "$suf_menu" != [1-3] ]]; then
  473. echo $RED"must be an entry from the above menu $STAND"
  474. sleep 1
  475. f_suffix
  476. fi
  477. #
  478. # Option 1
  479. # Suffix numbers in sequence to a list
  480. # ------------------------------------
  481. if [ "$suf_menu" == "1" ] ; then
  482. echo $STAND""
  483. echo $BLUE"Suffix numeric values in sequence to a wordlist (ie. 0 - 99999)"
  484. echo $STAND""
  485. echo -ne $STAND"Enter /path/to/wordlist to suffix numbers to: "$GREEN
  486. read suf_nums
  487.     while [ ! -f $suf_nums ] ; do
  488.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  489.     read suf_nums
  490.     done
  491. #Check if any '%' characters in the file which could cause errors
  492. grep "%" $suf_nums > sufnums_errors
  493. exist=$(sed -n '$=' sufnums_errors)
  494. if [[ "$exist" == "" ]] ; then
  495. rm sufnums_errors
  496.     elif [ "$exist" != "" ] ; then
  497.     echo $RED"Lines with '%' character exist in file which will not be processed"
  498.     echo -ne $STAND"View these lines ? y/n "$GREEN
  499.     read view
  500.     if [ "$view" == "y" ] || [ "$view" == "Y" ] ; then
  501.     cat sufnums_errors
  502.     else
  503.     echo $STAND""
  504.     fi
  505. rm sufnums_errors
  506. fi
  507. #Enter output file to write the changes to
  508. echo -ne $STAND"Enter desired output file name: "$GREEN
  509. read suf_nums_out
  510. if [ -f $suf_nums_out ] ; then
  511.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  512.     read over
  513.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  514.     echo $RED"Existing file $GREEN$suf_nums_out$RED will be overwritten"$STAND
  515.     else
  516.     echo $STAND"Process cancelled, returning to menu"
  517.     sleep 1
  518.     f_menu
  519.     fi
  520. fi
  521. echo -ne $STAND"Enter how many numeric values you want to suffix (max 5): "$GREEN
  522. read numbs
  523. echo $STAND"Working .."
  524.     if [ "$numbs" == 1 ] ; then
  525.     for i in $(cat $suf_nums); do seq -f "$i%01.0f" 0 9; done > "$suf_nums_out"
  526.     elif [ "$numbs" == 2 ] ; then
  527.     for i in $(cat $suf_nums); do seq -f "$i%01.0f" 0 99; done > "$suf_nums_out"
  528.     elif [ "$numbs" == 3 ] ; then
  529.     for i in $(cat $suf_nums); do seq -f "$i%01.0f" 0 999; done > "$suf_nums_out"
  530.     elif [ "$numbs" == 4 ] ; then
  531.     for i in $(cat $suf_nums); do seq -f "$i%01.0f" 0 9999; done > "$suf_nums_out"
  532.     elif [ "$numbs" == 5 ] ; then
  533.     for i in $(cat $suf_nums); do seq -f "$i%01.0f" 0 99999; done > "$suf_nums_out"
  534.     fi
  535. echo $STAND""
  536. echo "$GREEN$suf_nums_out$STAND has been created; "
  537. head -n 3 $suf_nums_out
  538. echo ".."
  539. tail -n 3 $suf_nums_out
  540. echo $STAND""
  541.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  542.     read return
  543.     if [ "$return" == "" ] ; then
  544.         echo $STAND""
  545.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  546.         echo $STAND""
  547.         exit
  548.     fi
  549. #
  550. # Option 2
  551. # Suffix fixed number of numberic values to a list
  552. # ------------------------------------------------
  553. elif [ "$suf_menu" == "2" ] ; then
  554. echo $STAND""
  555. echo $BLUE"Suffix fixed number of numeric values in sequence to a wordlist (ie. 00000 - 99999)"
  556. echo $STAND""
  557. echo -ne $STAND"Enter /path/to/wordlist to suffix numbers to: "$GREEN
  558. read suf_numf
  559.     while [ ! -f $suf_numf ] ; do
  560.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  561.     read suf_numf
  562.     done
  563. #Check if any '%' characters in the file which could cause errors
  564. grep "%" $suf_numf > sufnumf_errors
  565. exist=$(sed -n '$=' sufnumf_errors)
  566. if [ "$exist" == "" ] ; then
  567. rm sufnumf_errors
  568. elif [ "$exist" != "" ] ; then
  569. echo $RED"Lines with '%' character exist in file which will not be processed"
  570. echo -ne $STAND"View these lines ? y/n "$GREEN
  571. read view
  572.   if [ "$view" == "y" ] || [ "$view" == "Y" ] ; then
  573.   cat sufnumf_errors
  574.   else
  575.   echo $STAND""
  576.   fi
  577. rm sufnumf_errors
  578. fi
  579. #Enter output file to write the changes to
  580. echo -ne $STAND"Enter desired output file name: "$GREEN
  581. read suf_numf_out
  582. if [ -f $suf_numf_out ] ; then
  583.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  584.     read over
  585.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  586.     echo $RED"Existing file $GREEN$suf_numf_out$RED will be overwritten"$STAND
  587.     else
  588.     echo $STAND"Process cancelled, returning to menu"
  589.     sleep 1
  590.     f_menu
  591.     fi
  592. fi
  593. echo -ne $STAND"Enter how many numeric values you want to Suffix (max 5): "$GREEN
  594. read numbf
  595. echo $STAND"Working .."
  596.     if [ "$numbf" == 1 ] ; then
  597.     for i in $(cat $suf_numf); do seq -f "$i%0$numbf.0f" 0 9; done > "$suf_numf_out"
  598.     elif [ "$numbf" == 2 ] ; then
  599.     for i in $(cat $suf_numf); do seq -f "$i%0$numbf.0f" 0 99; done > "$suf_numf_out"
  600.     elif [ "$numbf" == 3 ] ; then
  601.     for i in $(cat $suf_numf); do seq -f "$i%0$numbf.0f" 0 999; done > "$suf_numf_out"
  602.     elif [ "$numbf" == 4 ] ; then
  603.     for i in $(cat $suf_numf); do seq -f "$i%0$numbf.0f" 0 9999; done > "$suf_numf_out"
  604.     elif [ "$numbf" == 5 ] ; then
  605.     for i in $(cat $suf_numf); do seq -f "$i%0$numbf.0f" 0 99999; done > "$suf_numf_out"
  606.     fi
  607. echo $STAND""
  608. echo "$GREEN$suf_numf_out$STAND has been created; "
  609. head -n 3 $suf_numf_out
  610. echo ".."
  611. tail -n 3 $suf_numf_out
  612. echo $STAND""
  613.    
  614.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  615.     read return
  616.     if [ "$return" == "" ] ; then
  617.         echo $STAND""
  618.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  619.         echo $STAND""
  620.         exit
  621.     fi
  622. #
  623. # Option 3
  624. # Suffix word / characters to a list
  625. # ----------------------------------
  626. elif [ "$suf_menu" == "3" ] ; then
  627. echo $STAND""
  628. echo $BLUE"Suffix word / characters to a wordlist"
  629. echo $STAND""
  630. f_inout
  631. echo -ne $STAND"Enter word/characters you want suffixed: "$GREEN
  632. read suf_char
  633. echo $STAND"Working .."
  634. sudo -u root sed "s/.$/&"$suf_char"/" "$wlm_infile" > "$wlm_outfile"
  635. echo $STAND""
  636. f_complete
  637. fi
  638. }
  639. #
  640. #
  641. #------------
  642. # MENU ITEM 5
  643. #============
  644. # INCLUDING CHARACTERS /WORD
  645. ############################
  646. f_inclu () {
  647. clear
  648. echo $STAND"Wordlist Manipulator"
  649. echo $BLUE"Inclusion options"
  650. echo $STAND"--------------------"
  651. echo "1 Include characters/word as from a certain position from START of word.
  652. 2 Include characters as from a certain position from END of word.
  653.  
  654. Q Back to menu
  655. "
  656. echo -ne $STAND"Enter choice from above menu: "$GREEN
  657. read incl_menu
  658. if [ "$incl_menu" == "q" ] || [ "$incl_menu" == "Q" ] ; then
  659. echo $STAND""
  660. f_menu
  661. elif [[ "$incl_menu" != [1-2] ]]; then
  662. echo $RED"must be an entry from the above menu $STAND"
  663. sleep 1
  664. f_inclu
  665. fi
  666. #
  667. # Option 1
  668. # Include characters from start of word
  669. # -------------------------------------
  670. if [ "$incl_menu" == "1" ] ; then
  671. echo $STAND""
  672. echo $BLUE"Include characters/word as from a certain position from START of word"
  673. echo $STAND""
  674. f_inout
  675. echo -ne $STAND"Enter the word/characters you want included in each word: "$GREEN
  676. read inclu_char
  677. echo -ne $STAND"Enter from what position (after how many characters)
  678. the word/characters should be included: "$GREEN
  679. read inclus_pos
  680. echo $STAND"Working .."
  681. sudo -u root sed "s/^.\{$inclus_pos\}/&$inclu_char/" "$wlm_infile" > "$wlm_outfile"
  682. echo $STAND""
  683. f_complete
  684. #
  685. # Option 2
  686. # Include Characters
  687. # ------------------
  688. elif [ "$incl_menu" == "2" ] ; then
  689. echo $STAND""
  690. echo $BLUE"Include characters as from a certain position from END of word"
  691. echo $STAND
  692. f_inout
  693. echo -ne $STAND"Enter the word/characters you want included in each word: "$GREEN
  694. read inclu_char
  695. echo -ne $STAND"Enter before what position (before how many characters before end of word)
  696. the word/characters should be included: "$GREEN
  697. read inclus_pos
  698. echo $STAND"Working .."
  699. sudo -u root sed "s/.\{$inclus_pos\}$/$inclu_char&/" "$wlm_infile" > "$wlm_outfile"
  700. echo $STAND""
  701. f_complete
  702. fi
  703. }
  704. #
  705. #
  706. #------------
  707. # MENU ITEM 6
  708. #============
  709. # SUBSTITION OPTIONS
  710. ####################
  711. f_subs () {
  712. clear
  713. echo $STAND"Wordlist Manipulator"
  714. echo $BLUE"Substitution options"
  715. echo $STAND"--------------------"
  716. echo "1 Substitute/Replace characters from START of word.
  717. 2 Substitute/Replace characters from END of word.
  718. 3 Substitute/Replace characters at a certain position.
  719.  
  720. Q Back to menu
  721. "
  722. echo -ne $STAND"Enter choice from above menu: "$GREEN
  723. read subs_menu
  724. if [ "$subs_menu" == "q" ] || [ "$subs_menu" == "Q" ] ; then
  725. echo $STAND""
  726. f_menu
  727. elif [[ "$subs_menu" != [1-3] ]]; then
  728. echo $RED"must be an entry from the above menu $STAND"
  729. sleep 1
  730. f_subs
  731. fi
  732. #
  733. # Option 1
  734. # Substitute characters from start of word
  735. # ----------------------------------------
  736. if [ "$subs_menu" == "1" ] ; then
  737. echo $STAND""
  738. echo $BLUE"Substitute/Replace characters from START of word"
  739. echo $STAND""
  740. f_inout
  741. echo -ne $STAND"Enter the word/characters you want to replace substituted characters with: "$GREEN
  742. read subs_char
  743. echo -ne $STAND"Enter the number of characters from start of word to replace: "$GREEN
  744. read subs_num
  745. echo $STAND"Working .."
  746. sudo -u root sed "s/^.\{$subs_num\}/$subs_char/" "$wlm_infile" > "$wlm_outfile"
  747. echo $STAND""
  748. f_complete
  749. #
  750. # Option 2
  751. # Substitute characters before end of word
  752. # ----------------------------------------
  753. elif [ "$subs_menu" == "2" ] ; then
  754. echo $STAND""
  755. echo $BLUE"Substitute/Replace characters from END of word"
  756. echo $STAND""
  757. f_inout
  758. echo -ne $STAND"Enter the word/characters you want to replace the sustituted characters with: "$GREEN
  759. read subs_char
  760. echo -ne $STAND"Enter the number of characters at the end of word you want to replace: "$GREEN
  761. read subs_num
  762. echo $STAND"Working .."
  763. sudo -u root sed "s/.\{$subs_num\}$/$subs_char/" "$wlm_infile" > "$wlm_outfile"
  764. echo $STAND""
  765. f_complete
  766. #
  767. # Option 3
  768. # Substitute / replace characters in a certain position
  769. # -----------------------------------------------------
  770. elif [ "$subs_menu" == "3" ] ; then
  771. echo $STAND""
  772. echo $BLUE"Substitute/Replace characters at a certain position"
  773. echo $STAND""
  774. f_inout
  775. echo -ne $STAND"Enter the word/characters you want to replace the sustituted characters with: "$GREEN
  776. read subs_char
  777. echo -ne $STAND"Enter the start position of characters you want to replace (ie. 2)
  778. (position 1 will start from 2nd character, position 4 will start from 5th character, etc): "$GREEN
  779. read subs_poss
  780. echo -ne $STAND"Enter how many characters after start position you want to replace (ie.2); "$GREEN
  781. read subs_pose
  782. echo $STAND"Working .."
  783. sudo -u root sed -r "s/^(.{$subs_poss})(.{$subs_pose})/\1$subs_char/" "$wlm_infile" > "$wlm_outfile"
  784. echo $STAND""
  785. f_complete
  786. fi
  787. }
  788. #
  789. #
  790. #------------
  791. # MENU ITEM 7
  792. #============
  793. # OPTIMIZATION OPTIONS
  794. ######################
  795. f_tidy () {
  796. clear
  797. echo $STAND"Wordlist Manipulator"
  798. echo $BLUE"Optimization options"
  799. echo $STAND"--------------------"
  800. echo "1 Full optimization of wordlist.
  801. 2 Optimize wordlist for WPA.
  802. 3 Sort wordlist on length of words.
  803.  
  804. Q Back to menu
  805. "
  806. echo -ne $STAND"Enter choice from above menu: "$GREEN
  807. read tidy_menu
  808. if [ "$tidy_menu" == "q" ] || [ "$tidy_menu" == "Q" ] ; then
  809. echo $STAND""
  810. f_menu
  811. elif [[ "$tidy_menu" != [1-3] ]]; then
  812. echo $RED"must be an entry from the above menu $STAND"
  813. sleep 1
  814. f_tidy
  815. fi
  816. #
  817. # Option 1
  818. # Full optimization of wordlist
  819. # -----------------------------
  820. if [ "$tidy_menu" == "1" ] ; then
  821. echo $STAND""
  822. echo $BLUE"Full optimization of wordlist"
  823. echo $STAND""
  824. f_inout
  825. ##full optimize##
  826. echo -en $STAND"Enter a minimum password length: "$GREEN
  827. read min
  828. echo -en $STAND"Enter a maximum password length: "$GREEN
  829. read max
  830. echo $STAND""
  831. echo -en $STAND"Hit return to start processing the file "$STAND
  832. read return
  833. if [ "$return" == "" ]; then
  834. echo $GREEN">$STAND Removing duplicates from the file.."
  835. cat $wlm_infile | uniq > working.txt
  836. echo $GREEN">$STAND Sorting the list.."
  837. cat working.txt | sort > working2.txt
  838. echo $GREEN">$STAND Deleting words which do not meet length requirement.."
  839. pw-inspector -i working2.txt -o working3.txt -m $min -M $max
  840. echo $GREEN">$STAND Removing all non ascii chars if they exist.."
  841. tr -cd '\11\12\40-\176' < working3.txt > working4.txt
  842. echo $GREEN">$STAND Removing all comments.."
  843. sed '1p; /^[[:blank:]]*#/d; s/[[:blank:]][[:blank:]]*#.*//' working4.txt > working5.txt
  844. echo $GREEN">$STAND Removing any leading white spaces and tabs from the file.."
  845. sed -e 's/^[ \t]*//' working5.txt > working6.txt
  846. echo $GREEN">$STAND One more pass to sort and remove any duplicates.."
  847. cat working6.txt | sort | uniq > working7.txt
  848. sudo -u root mv working7.txt $wlm_outfile
  849. echo $GREEN">$STAND Cleaning up temporary files.."
  850. rm -rf working*.txt
  851. fi
  852. cat $wlm_outfile | while read line
  853. do
  854.         count=$[ $count + 1 ]
  855. done
  856. echo $STAND""
  857. f_complete
  858. #
  859. # Option 2
  860. # Optimization of wordlist for WPA
  861. # --------------------------------
  862. elif [ "$tidy_menu" == "2" ] ; then
  863. echo $STAND""
  864. echo $BLUE"Optimization of wordlist for WPA/WPA2"
  865. echo $STAND""
  866. f_inout
  867. echo "Working .."
  868. pw-inspector -i $wlm_infile -o /root/temp_outfile -m 8 -M 63
  869. sudo -u root cat /root/temp_outfile | sort | uniq > $wlm_outfile
  870. rm -rf /root/temp_outfile
  871. echo $STAND""
  872. f_complete
  873. #
  874. # Option 3
  875. # --------
  876. elif [ "$tidy_menu" == "3" ] ; then
  877. echo $STAND""
  878. echo $BLUE"Sort wordlist based on wordsize/length"$STAND
  879. echo "(can speed up cracking process with some programmes)"
  880. echo $STAND""
  881. f_inout
  882. echo "Working .."
  883. sudo -u root awk '{ print length(), $0 | "sort -n" }' $wlm_infile | sed 's/[^ ]* //' > $wlm_outfile
  884. f_complete
  885. fi
  886. }
  887. #
  888. #
  889. #------------
  890. # MENU ITEM 8
  891. #============
  892. # SPLIT FUNCTIONS
  893. ##################
  894. f_split () {
  895. clear
  896. echo $STAND"Wordlist Manipulator"
  897. echo $BLUE"Split wordlists"
  898. echo $STAND"--------------------"
  899.  
  900. echo "1 Split wordlists into user defined max linecount per split file.
  901. 2 Split wordlists into user defined max sizes per split file.
  902.  
  903. Q Back to menu
  904. "
  905. echo -ne $STAND"Enter choice from above menu: "$GREEN
  906.     read split_menu
  907.     if [ "$split_menu" == "q" ] || [ "$split_menu" == "Q" ] ; then
  908.     echo $STAND""
  909.     f_menu
  910.     elif [[ "$split_menu" != [1-3] ]]; then
  911.     echo $RED"must be an entry from the above menu $STAND"
  912.     sleep 1
  913.     f_split
  914.     fi
  915. #
  916. # Option 1
  917. # Split files by linecount
  918. #-------------------------
  919. if [ "$split_menu" == "1" ] ; then
  920. echo $STAND""
  921. echo $BLUE"Split wordlists into user defined max linecount per split file"
  922. echo $STAND""
  923. echo -ne $STAND"Enter /path/to/wordlist to split : "$GREEN
  924. read split_in
  925.     while [ ! -f "$split_in" ] ; do
  926.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  927.     read split_in
  928.     done
  929. #Enter output file to write the changes to
  930. echo -ne $STAND"Enter output files' prefix: "$GREEN
  931. read split_out
  932. echo $STAND""
  933. #
  934. # Test for existence of prefixed files in working directory
  935. echo "Checking for existing files in working directory with same pre-fix.."
  936. sleep 0.5
  937. find $split_out* > exist_temp
  938. exist=$(sed -n '$=' exist_temp)
  939. if [ "$exist" == "" ] ; then
  940. echo $GREEN"No files with same prefix found in working directory, proceding.."
  941. rm exist_temp
  942. echo $STAND""
  943. elif [ "$exist" != "" ] ; then
  944. echo $RED"Files with same prefix found in working directory; "$STAND
  945. cat exist_temp
  946. echo $STAND""
  947. # Delete existing files with same prefix before starting so as  
  948. echo -ne $STAND"Delete above files before proceding ? y/n "$GREEN
  949. read delete
  950.     if [ "$delete" == "y" ] || [ "$delete" == "Y" ] ; then
  951.         echo $STAND"deleting existing files.."     
  952.         sleep 0.5
  953.         echo $STAND""  
  954.         for line in $(cat exist_temp) ; do  
  955.         rm $line
  956.         done
  957.     else
  958.         echo ""
  959.         echo $STAND"Returning to menu.."
  960.         rm exist_temp
  961.         sleep 1
  962.         f_split
  963.     fi
  964. rm exist_temp
  965. fi
  966. #
  967. #
  968. B=$( stat -c %s $split_in )
  969. KB=$( echo "scale=2;$B / 1024" | bc )
  970. MB=$( echo "scale=2;($B/1024)/1024" | bc )
  971. GB=$( echo "scale=2;(($B/1024)/1024)/1024" | bc )
  972. echo -e $STAND"Wordlist $GREEN$split_in$STAND size: $KB KB$STAND  $GREEN$MB MB$STAND  $GB GB$STAND"
  973. linecount=$(wc -l $split_in | cut -d " " -f 1)
  974. echo "Wordlist $GREEN$split_in$STAND Linecount: $GREEN$linecount$STAND"
  975. echo ""
  976. echo -ne $STAND"Enter number of lines you want per each split file: "$GREEN
  977. read lines_in
  978. #Calculate the number of files resulting from user input
  979. est_count=$(echo "scale=3;$linecount / $lines_in" | bc)
  980.     if [ "$est_count" != *.000 ] ; then
  981.     size=$(echo "$linecount/$lines_in+1" | bc)
  982.     elif [ "$est_count" == *.000 ] ; then
  983.     size=$(echo "$linecount/$lines_in" | bc)
  984.     fi
  985. #
  986. echo -ne $STAND"This will result in an estimated $GREEN$size$STAND files, continue ? y/n "$GREEN
  987. read go_for_it
  988.     if [ "$go_for_it" == "y" ] || [ "$go_for_it" == "Y" ] ; then
  989.     echo ""
  990.     echo $STAND"Working .."
  991.     else echo $STAND"Quitting to menu"
  992.     sleep 0.5
  993.     f_split
  994.     fi
  995. SFX=$(echo $size | wc -c)
  996. SFX=$(echo $[$SFX -1])
  997. split -a$SFX -d -l $lines_in $split_in $split_out
  998. echo ""
  999. ls $split_out* > split_out_temp
  1000. echo $STAND ""
  1001. echo $STAND"The following files have been created"
  1002. echo $STAND"-------------------------------------"$STAND
  1003. for line in $(cat split_out_temp) ; do
  1004. B=$( stat -c %s $line )
  1005. KB=$( echo "scale=2;$B / 1024" | bc )
  1006. MB=$( echo "scale=2;($B/1024)/1024" | bc )
  1007. GB=$( echo "scale=2;(($B/1024)/1024)/1024" | bc )
  1008. echo -e "$GREEN$line$STAND   $KB KB \t $GREEN$MB MB$STAND \t $GB GB$STAND"
  1009. done
  1010. echo $STAND""
  1011. rm split_out_temp
  1012. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1013. read return
  1014.     if [ "$return" == "" ] ; then
  1015.     echo $STAND""
  1016.     f_menu
  1017.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1018.     echo $STAND""
  1019.     exit
  1020.     fi
  1021. echo $STAND""
  1022. #
  1023. # Option 2
  1024. # Split files by size
  1025. #--------------------
  1026. elif [ "$split_menu" == "2" ] ; then
  1027. echo $STAND""
  1028. echo $BLUE"Split wordlists into user defined max size (in MB) per split file"
  1029. echo $STAND""
  1030. echo -ne $STAND"Enter /path/to/wordlist to split : "$GREEN
  1031. read split_in
  1032.     while [ ! -f "$split_in" ] ; do
  1033.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  1034.     read split_in
  1035.     done
  1036. #Enter output file to write the changes to
  1037. echo -ne $STAND"Enter output files' prefix: "$GREEN
  1038. read split_out
  1039. echo $STAND""
  1040. #
  1041. # Test for existence of same prefix in working directory
  1042. echo "Checking for existing files in working directory with same pre-fix.."
  1043. sleep 0.5
  1044. find $split_out* > exist_temp
  1045. exist=$(sed -n '$=' exist_temp)
  1046. if [ "$exist" == "" ] ; then
  1047. echo $GREEN"No files with same prefix found in working directory, proceding.."
  1048. rm exist_temp
  1049. echo $STAND""
  1050. elif [ "$exist" != "" ] ; then
  1051. echo $RED"Files with same prefix found in working directory; "$STAND
  1052. cat exist_temp
  1053. echo $STAND""
  1054. echo -ne $STAND"Delete above files before proceding ? y/n "$GREEN
  1055. read delete
  1056.     if [ "$delete" == "y" ] || [ "$delete" == "Y" ] ; then
  1057.         echo $STAND"deleting existing files.."     
  1058.         sleep 0.5
  1059.         echo $STAND""  
  1060.         for line in $(cat exist_temp) ; do  
  1061.         rm $line
  1062.         done
  1063.     else
  1064.         echo ""
  1065.         echo $STAND"Returning to menu.."
  1066.         rm exist_temp
  1067.         sleep 1
  1068.         f_misc
  1069.     fi
  1070. rm exist_temp
  1071. fi
  1072. #Wordlist size
  1073. B=$( stat -c %s $split_in )
  1074. KB=$( echo "scale=2;$B / 1024" | bc )
  1075. MB=$( echo "scale=2;($B/1024)/1024" | bc )
  1076. GB=$( echo "scale=2;(($B/1024)/1024)/1024" | bc )
  1077. echo $STAND"File size of $GREEN$split_in$STAND ;"
  1078. echo $STAND"Bytes     = $RED$B"
  1079. echo $STAND"Kilobytes = $RED$KB"
  1080. echo $STAND"Megabytes = $RED$MB"
  1081. echo $STAND"Gigabytes = $RED$GB"
  1082. echo $STAND""
  1083. echo -ne "Enter max size of each split file in Megabytes (whole numbers only!): "$GREEN
  1084. read split_size
  1085. est_size=$(echo "scale=3;$MB / $split_size" | bc)
  1086.     if [ "$est_size" != *.000 ] ; then
  1087.     size=$(echo "$MB/$split_size+1" | bc)
  1088.     elif [ "$est_size" == *.000 ] ; then
  1089.     size=$(echo "$MB/$split_size" | bc)
  1090.     fi
  1091. #est_size=$(printf "%.0f" $(echo "scale=2;$MB/$split_size" | bc))
  1092. echo -ne $STAND"This will result in an estimated $GREEN$size$STAND files, continue ? y/n "$GREEN
  1093. read go_for_it
  1094.     if [ "$go_for_it" == "y" ] || [ "$go_for_it" == "Y" ] ; then
  1095.     echo ""
  1096.     echo $STAND"Working .."
  1097.     else echo $STAND"Quitting to menu"
  1098.     sleep 1
  1099.     f_split
  1100.     fi
  1101. #split_size_b=$( echo "(($split_size * 1024) * 1024)" | bc )
  1102. split -d -C "$split_size"M $split_in $split_out
  1103. ls $split_out* > split_out_temp
  1104. echo $STAND ""
  1105. echo $STAND"The following files have been created"
  1106. echo $STAND"-------------------------------------"$STAND
  1107. for line in $(cat split_out_temp) ; do
  1108. B=$( stat -c %s $line )
  1109. KB=$( echo "scale=2;$B / 1024" | bc )
  1110. MB=$( echo "scale=2;($B/1024)/1024" | bc )
  1111. GB=$( echo "scale=2;(($B/1024)/1024)/1024" | bc )
  1112. echo -e "$GREEN$line$STAND   $KB KB \t $GREEN$MB MB$STAND \t $GB GB$STAND"
  1113. done
  1114. echo $STAND""
  1115. rm split_out_temp
  1116. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1117. read return
  1118.     if [ "$return" == "" ] ; then
  1119.     echo $STAND""
  1120.     f_menu
  1121.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1122.     echo $STAND""
  1123.     exit
  1124.     fi
  1125. echo $STAND""
  1126. fi
  1127. }
  1128. #
  1129. #
  1130. #------------
  1131. # MENU ITEM 9
  1132. #============
  1133. # REMOVAL / DELETION OPTIONS
  1134. ############################
  1135. f_delete () {
  1136. clear
  1137. echo $STAND"Wordlist Manipulator"
  1138. echo $BLUE"Removal/Character removal options"
  1139. echo $STAND"---------------------------------"
  1140.  
  1141. echo "1 Remove X number of characters from start of word.
  1142. 2 Remove X number of characters from end of word.
  1143. 3 Remove specific characters globally from words.
  1144. 4 Remove words containing specific characters.
  1145. 5 Remove lines with X number of identical adjacent characters.
  1146. 6 Remove lines existing in 1 list from another list.
  1147.  (dont use on large lists, work in progress)
  1148. 7 Remove words which do NOT have X number of numeric values.
  1149. 8 Removing words which have X number of repeated characters.
  1150. 9 Remove words of a certain length.
  1151.    
  1152. Q Back to menu
  1153. "
  1154. #Check to ensure correct menu entry
  1155. echo -ne $STAND"Enter choice from above menu: "$GREEN
  1156.     read del_menu
  1157.     if [ "$del_menu" == "q" ] || [ "$del_menu" == "Q" ] ; then
  1158.     echo $STAND""
  1159.     f_menu
  1160.     elif [[ "$del_menu" != [1-9] ]]; then
  1161.     echo $RED"must be an entry from the above menu $STAND"
  1162.     sleep 1
  1163.     f_delete
  1164.     fi
  1165.  
  1166. # Option 1
  1167. # Removing X number of characters from start of word
  1168. # --------------------------------------------------
  1169. if [ "$del_menu" == "1" ] ; then
  1170. echo $STAND""
  1171. echo $BLUE"Remove X number of characters from start of word"$STAND
  1172. echo $STAND""
  1173. f_inout
  1174. echo -ne $STAND"Enter how many characters you want to remove from start of word: "$GREEN
  1175. read dels_char
  1176. echo $STAND"Working .."
  1177. sudo -u root sed "s/^.\{$dels_char\}//" $wlm_infile > $wlm_outfile
  1178. echo $STAND""
  1179. f_complete
  1180. #
  1181. # Option 2
  1182. # Removing X number of characters from end of word
  1183. # ------------------------------------------------
  1184. elif [ "$del_menu" == "2" ] ; then
  1185. echo $STAND""
  1186. echo $BLUE"Remove X number of characters from end of word"$STAND
  1187. echo $STAND""
  1188. f_inout
  1189. echo -ne "Enter how many characters you want to remove from end of word: "
  1190. read pos_char
  1191. echo $STAND"Working .."
  1192. sudo -u root sed "s/.\{$pos_char\}$//" $wlm_infile > $wlm_outfile
  1193. echo $STAND""
  1194. f_complete
  1195. #
  1196. # Option 3
  1197. # Removing specific characters globally from wordlist
  1198. # ---------------------------------------------------
  1199. elif [ "$del_menu" == "3" ] ; then
  1200. echo $STAND""
  1201. echo $BLUE"Remove specific character globally from words in wordlist"
  1202. echo $STAND""
  1203. f_inout
  1204. echo -ne "Enter the character you want removed globally from wordlist: "$GREEN
  1205. read char_remove
  1206. grep $char_remove $wlm_infile > rem_temp
  1207. rem_count=$(wc -l rem_temp | cut -d " " -f 1)
  1208.   if [ "$rem_count" == "0" ] ; then
  1209.     echo $STAND"Character $GREEN$char_remove$STAND was not found in $GREEN$wlm_infile$STAND."
  1210.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1211.     read return
  1212.     if [ "$return" == "" ] ; then
  1213.     echo $STAND""
  1214.     f_delete
  1215.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1216.     echo $STAND""
  1217.     exit
  1218.     fi
  1219.   fi
  1220. echo $STAND"Working .."
  1221. rm rem_temp
  1222. sudo -u root sed "s/$char_remove//g" $wlm_infile > $wlm_outfile
  1223. echo $STAND""
  1224. f_complete
  1225. #
  1226. # Option 4
  1227. # Removing words containing specific characters from wordlist
  1228. # -----------------------------------------------------------
  1229. elif [ "$del_menu" == "4" ] ; then
  1230. echo $STAND""
  1231. echo $BLUE"Remove words containing specific character from wordlist"
  1232. echo $STAND""
  1233. f_inout
  1234. echo -ne $STAND"Enter the character to check for: "$GREEN
  1235. read char_remove
  1236. grep $char_remove $wlm_infile > rem_temp
  1237. rem_count=$(wc -l rem_temp | cut -d " " -f 1)
  1238. if [ "$rem_count" == "0" ] ; then
  1239.   echo $STAND"Character $GREEN$char_remove$STAND was not found in $GREEN$wlm_infile$STAND"
  1240.   echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1241.   read return
  1242.     if [ "$return" == "" ] ; then
  1243.     echo $STAND""
  1244.     f_delete
  1245.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1246.     echo $STAND""
  1247.     exit
  1248.     fi
  1249. fi
  1250. echo "$GREEN$rem_count$STAND words will be removed."
  1251. echo $STAND"Working .."
  1252. sudo -u root sed "/$char_remove/d" $wlm_infile > $wlm_outfile
  1253. rm rem_temp
  1254. echo $STAND""
  1255. f_complete
  1256. #
  1257. # Option 5
  1258. # Remove words with more than X number of identical adjacent characters from wordlist
  1259. # -----------------------------------------------------------------------------------
  1260. elif [ "$del_menu" == "5" ] ; then
  1261. echo $STAND""
  1262. echo $BLUE"Remove words with more than X number of identical adjacent charaters from wordlist"
  1263. echo $STAND""
  1264. f_inout
  1265. echo -ne $STAND"Enter how many identical adjacent characters should be allowed: "$GREEN
  1266. read ident_numb
  1267. echo $STAND"Working .."
  1268. sudo -u root sed "/\([^A-Za-z0-9_]\|[A-Za-z0-9]\)\1\{$ident_numb,\}/d" $wlm_infile > $wlm_outfile
  1269. echo $STAND""
  1270. f_complete
  1271. #
  1272. # Option 6
  1273. # Remove words existing in one list from another list
  1274. # ---------------------------------------------------
  1275. elif [ "$del_menu" == "6" ] ; then
  1276. echo $STAND""
  1277. echo $BLUE"Remove words existing in 1 list from another list"
  1278. echo "Very simple/bad coding on this..use on SMALL files only"
  1279. echo $STAND""
  1280. #Enter wordlist file to process
  1281. echo -ne $STAND"Enter /path/to/wordlist to process: "$GREEN
  1282. read wlm_infile
  1283.     while [ ! -f $wlm_infile ] || [ "$wlm_infile" == "" ] ; do
  1284.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  1285.     read wlm_infile
  1286.     done
  1287. echo $STAND"Enter /path/to/wordlist which contains the words to check for"
  1288. echo -ne $STAND"(Words in this list will be removed from wordlist to process): "$GREEN
  1289. read read_in
  1290. #Enter output file to write the changes to
  1291. echo -ne $STAND"Enter desired output file name: "$GREEN
  1292. read wlm_outfile
  1293. if [ -f $wlm_outfile ] ; then
  1294.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  1295.     read over
  1296.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  1297.     echo $RED"Existing file $GREEN$wlm_outfile$RED will be overwritten"$STAND
  1298.     else
  1299.     echo $STAND"Process cancelled, returning to menu"
  1300.     sleep 1
  1301.     f_menu
  1302.     fi
  1303. fi
  1304. echo "Working .."
  1305. sudo -u root grep -v -x -f $read_in $wlm_infile > $wlm_outfile
  1306. echo $STAND""
  1307. f_complete
  1308. #
  1309. # Option 7
  1310. # Removing words which do not have X number of numeric values
  1311. # -----------------------------------------------------------
  1312. elif [ "$del_menu" == "7" ] ; then
  1313. echo $STAND""
  1314. echo $BLUE"Remove words which do not have X number of numeric values"
  1315. echo $STAND""
  1316. f_inout
  1317. echo -ne $STAND"Enter how many numeric values should be allowed: "$GREEN
  1318. read ident_numb
  1319. echo $STAND"Working .."
  1320. sudo -u root nawk 'gsub("[0-9]","&",$0)=='$ident_numb'' $wlm_infile > $wlm_outfile
  1321. echo $STAND""
  1322. f_complete
  1323. #
  1324. # Option 8
  1325. # Removing words which have N number of repeated characters
  1326. # ----------------------------------------------------------
  1327. elif [ "$del_menu" == "8" ] ; then
  1328. echo $STAND""
  1329. echo $BLUE"Remove words which have X number of repeated characters"
  1330. echo $STAND""
  1331. f_inout
  1332. #Enter characters to check for
  1333. echo $STAND"Enter the character you don't want repeated more than N times"
  1334. echo -ne "(Hit enter for any character): " $GREEN
  1335. read rep_char
  1336. if [ "$rep_char" == "" ] ; then
  1337. #Enter how many times it may occur in the words
  1338. echo -ne $STAND"How many times may characters be repeated in a word: "$GREEN
  1339. read rep_time
  1340. echo ""
  1341. echo "Working.."
  1342. sudo -u root sed "/\(.\)\(.*\1\)\{$rep_time,\}/d" $wlm_infile > $wlm_outfile
  1343. fi
  1344. if [ "$rep_char" != "" ] ; then
  1345. echo -ne $STAND"How many times may $GREEN$rep_char$STAND be repeated in a word: "$GREEN
  1346. read rep_time
  1347. echo ""
  1348. echo $STAND"Working.."
  1349. sudo -u root sed "/\($rep_char\)\(.*\1\)\{$rep_time,\}/d" $wlm_infile > $wlm_outfile
  1350. fi
  1351. echo $STAND""
  1352. f_complete
  1353. #
  1354. # Option 9
  1355. # Removing words which have a certain length
  1356. # ------------------------------------------
  1357. elif [ "$del_menu" == "9" ] ; then
  1358. echo $STAND""
  1359. echo $BLUE"Remove all words with X length from the list"
  1360. echo $STAND""
  1361. f_inout
  1362. #Enter the length of words you want removed
  1363. echo -ne $STAND"Enter the length of words you want removed from wordlist: "$GREEN
  1364. read LEN_REM
  1365. echo $STAND"Working.."
  1366. sudo -u root awk "length != $LEN_REM" $wlm_infile > $wlm_outfile
  1367. echo ""
  1368. f_complete
  1369. fi
  1370. }
  1371. #
  1372. #
  1373. #-------------
  1374. # MENU ITEM 10
  1375. #=============
  1376. # MISCELLANEOUS OPTIONS
  1377. #######################
  1378. f_misc () {
  1379. clear
  1380. echo $STAND"Wordlist Manipulator"
  1381. echo $BLUE"Miscellaneous Fun"
  1382. echo $STAND"--------------------"
  1383. echo "1 Check what size a crunch created wordlist would be.
  1384. 2 Create a date wordlist
  1385. 3 Strip SSIDs from a kismet generated .nettxt file.
  1386. 4 Basic leetify options for wordlists.
  1387. 5 Create all possible (leetify) permutations of a wordlist (Gitsnik's permute.pl).
  1388.  
  1389. Q Back to menu
  1390. "
  1391. echo -ne $STAND"Enter choice from above menu: "$GREEN
  1392.     read misc_menu
  1393.     if [ "$misc_menu" == "q" ] || [ "$misc_menu" == "Q" ] ; then
  1394.     echo $STAND""
  1395.     f_menu
  1396.     elif [[ "$misc_menu" != [1-5] ]]; then
  1397.     echo $RED"must be an entry from the above menu $STAND"
  1398.     sleep 1
  1399.     f_misc
  1400.     fi
  1401. ##
  1402. ## Option 1
  1403. ## CRUNCH_SIZE
  1404. ##============
  1405. if [ "$misc_menu" == "1" ] ; then
  1406. clear
  1407. echo $BLUE"Crunch_Size ;)"$STAND
  1408. echo $STAND"Check what size a newly created wordlist would be"
  1409. echo "when creating a wordlist with for instance 'crunch'."
  1410. echo "This only calculates based on the same min max word length"
  1411. echo $STAND""
  1412. echo $STAND"Choose the number of characters that will be used making the wordlist"
  1413. echo $STAND"====================================================================="
  1414. echo "Example ;"
  1415. echo $RED"10 $STAND = Numeric only"
  1416. echo $RED"16 $STAND = Hexadecimal"
  1417. echo $RED"26 $STAND = Alpha only"
  1418. echo $RED"33 $STAND = Special characters including space"
  1419. echo $RED"36 $STAND = Alpha + Numeric"
  1420. echo $RED"52 $STAND = Lowercase+Uppercase alpha"
  1421. echo $RED"62 $STAND = Lower+Uppercase alpha + Numeric"
  1422. echo $RED"95 $STAND = Lower+Uppercase alpha +Numeric+SpecialCharacters including space"
  1423. echo
  1424. echo -ne $STAND"Enter number of characters to be used: "$RED
  1425. read X
  1426. echo -ne $STAND"Enter length of words/passphrases: "$RED
  1427. read Y
  1428. echo $STAND"How many passwords/second can your system handle ?"$STAND
  1429. echo -ne $STAND"(or hit Enter to simply ignore this query)  "$RED
  1430. read passec
  1431.  
  1432. # Calculations based on binary sizes ;
  1433. # For comma seperated values for groups of 3 digits pipe the below calculation out through sed ;
  1434. # sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1,\2=g;t L'
  1435. B=$( echo "scale=3;($X^$Y)*($Y+1)" | bc )
  1436. KB=$( echo "scale=3;($X^$Y)*($Y+1) / 1024" | bc )
  1437. MB=$( echo "scale=3;(($X^$Y)*($Y+1)/1024)/1024" | bc )
  1438. GB=$( echo "scale=3;((($X^$Y)*($Y+1)/1024)/1024)/1024" | bc )
  1439. TB=$( echo "scale=3;(((($X^$Y)*($Y+1)/1024)/1024)/1024)/1024" | bc )
  1440. PB=$( echo "scale=3;((((($X^$Y)*($Y+1)/1024)/1024)/1024)/1024)/1024" | bc )
  1441. #
  1442. # Calculation for number of results ;
  1443. # For comma seperated values for groups of 3 digits pipe the below calculation out through sed ;
  1444. # sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1,\2=g;t L'
  1445. NMBR=$( echo "($X^$Y)" | bc )
  1446. echo $STAND""
  1447. #
  1448. # Outcome of calculations ;
  1449. if [ "$passec" == "" ] ; then
  1450. echo $STAND"Estimated number of words/passphrases in wordlist: $GREEN$NMBR$STAND"
  1451. echo $STAND""
  1452. elif [ "$passec" != "" ] ; then
  1453. hours=$( echo "scale=2;((($NMBR/$passec)/60)/60)" | bc )
  1454. days=$( echo "scale=2;(((($NMBR/$passec)/60)/60)/24)" | bc )
  1455. echo $STAND"Estimated number of words/passphrases in wordlist: $GREEN$NMBR$STAND"
  1456. echo $STAND"Estimated duration to go through full list: $GREEN$hours$STAND hours ($GREEN$days$STAND days)"
  1457. echo $STAND""
  1458. fi
  1459. #
  1460. echo $STAND"Estimated wordlist size ; "
  1461. echo $GREEN"B  $STAND(Bytes)     = $GREEN$B"
  1462. echo $GREEN"KB $STAND(Kilobytes) = $GREEN$KB"
  1463. echo $GREEN"MB $STAND(Megabytes) = $GREEN$MB"
  1464. echo $GREEN"GB $STAND(Gigabytes) = $GREEN$GB"
  1465. echo $GREEN"TB $STAND(Terabytes) = $GREEN$TB"
  1466. echo $GREEN"PB $STAND(Petabytes) = $GREEN$PB"
  1467. echo $STAND""
  1468. #
  1469. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1470. read return
  1471.     if [ "$return" == "" ] ; then
  1472.     echo $STAND""
  1473.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1474.     echo $STAND""
  1475.     exit
  1476.     fi
  1477. ##
  1478. ## Option 2
  1479. ## Datelist
  1480. ## ========
  1481. elif [ "$misc_menu" == "2" ] ; then
  1482. clear
  1483. echo $BLUE"TAPE's
  1484.     | |     | |      | (_)   | |  
  1485.   __| | __ _| |_  ___| |_ ___| |_
  1486.  / _  |/ _  | __|/ _ \ | / __| __|
  1487. | (_| | (_| | |_ | __/ | \__ \ |_
  1488.  \____|\____|\__|\___|_|_|___/\__|
  1489. v0.7a$STAND"
  1490. echo $BLUE"30 days hath September, April, June and November.."
  1491. echo $STAND""
  1492. echo $BLUE"Create a wordlist from a range of dates"
  1493. echo $STAND"======================================="
  1494.  
  1495. #Enter startdate
  1496. echo -ne $STAND"Enter startdate in format yyyy-mm-dd: "$GREEN
  1497. read startdate
  1498. startyear=$(echo $startdate | cut -d - -f 1)
  1499. startmonth=$(echo $startdate | cut -d - -f 2)
  1500. startday=$(echo $startdate | cut -d - -f 3)
  1501. #Check for incorrect start date entry
  1502. syear_len=$(echo "$startyear" | wc -L)
  1503. if [[ "$syear_len" -ne 4 ]] ; then
  1504. echo $RED"Begin year error: $startyear$STAND, year entries must have 4 digits"
  1505. sleep 2
  1506. f_misc
  1507. fi
  1508. if [[ "$startmonth" -lt "01" || "$startmonth" -gt "12" ]] ; then
  1509. echo $RED"Begin month error: $startmonth$STAND, months can only be between 01 - 12"
  1510. sleep 2
  1511. f_misc
  1512. fi
  1513. if [[ "$startday" -lt "01" || "$startday" -gt "31" ]] ; then
  1514. echo $RED"Begin day error: $startday$STAND, days can only be between 01 - 31"
  1515. sleep 2
  1516. f_misc
  1517. fi
  1518. #
  1519. #Enter enddate
  1520. echo -ne $STAND"Enter enddate in formate yyyy-mm-dd: "$GREEN
  1521. read enddate
  1522. endyear=$(echo $enddate | cut -d - -f 1)
  1523. endmonth=$(echo $enddate | cut -d - -f 2)
  1524. endday=$(echo $enddate | cut -d - -f 3)
  1525. #Check for incorrect end date entry
  1526. eyear_len=$(echo "$endyear" | wc -L)
  1527. if [[ "$eyear_len" -ne 4 ]] ; then
  1528. echo $RED"End year error: $endyear$STAND, year entries must have 4 digits"
  1529. sleep 2
  1530. f_misc
  1531. fi
  1532. if [[ "$endmonth" -lt "01" || "$endmonth" -gt "12" ]] ; then
  1533. echo $RED"End month error: $endmonth$STAND, months can only be between 01 - 12"
  1534. sleep 2
  1535. f_misc
  1536. fi
  1537. if [[ "$endday" -lt "01" || "$endday" -gt "31" ]] ; then
  1538. echo $RED"End day error: $endday$STAND, days can only be between 01 - 31"
  1539. sleep 2
  1540. f_misc
  1541. fi
  1542. #
  1543. #
  1544. #
  1545. # Output file to save the date wordlist to
  1546. echo -ne $STAND"Enter desired output file name: "$GREEN
  1547. read date_outfile
  1548. while [ "$date_outfile" == "" ] ; do
  1549. echo -ne $RED"Enter desired output file name: "$GREEN
  1550. read date_outfile
  1551. done
  1552. if [ -f $date_outfile ] ; then
  1553. echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  1554. read over
  1555.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  1556.     echo $RED"Existing file $GREEN$date_outfile$RED will be overwritten$STAND"
  1557.     else
  1558.     echo $STAND"Process cancelled, quitting"
  1559.     sleep 1
  1560.     exit
  1561.     fi
  1562. fi
  1563. #
  1564. #
  1565. #
  1566. # Desired output format
  1567. echo $STAND""
  1568. echo $STAND"Enter desired output format as below;"
  1569. echo -ne $STAND"ddmmyy / ddmmyyyy / mmddyy / mmddyyyy / yymmdd / yyyymmdd: "$GREEN
  1570. read format
  1571.  
  1572. until [ "$format" == "ddmmyy" ] || [ "$format" == "ddmmyyyy" ] || [ "$format" == "yymmdd" ] || [ "$format" == "yyyymmdd" ] || [ "$format" == "mmddyyyy" ] || [ "$format" == "mmddyy" ]; do
  1573.     echo $RED"Please enter a correct output format;"
  1574.     echo -ne $STAND"ddmmyy / ddmmyyyy / mmddyy / mmddyyyy / yymmdd / yyyymmdd: "$GREEN
  1575.     read format
  1576.     done
  1577. #
  1578. #
  1579. #
  1580. # Desired Spacing character, if any
  1581. echo $STAND""
  1582. echo -ne $STAND"Enter spacing character or hit enter for no spacing character: "$GREEN
  1583. read space
  1584. echo $STAND"Working .."
  1585. #
  1586. #
  1587. #
  1588. #List the years
  1589. echo $startyear > dates_years
  1590. while [ "$startyear" != "$endyear" ] ; do
  1591. startyear=$(expr $startyear + 1)
  1592. echo $startyear >> dates_years
  1593. done
  1594. #
  1595. #
  1596. #
  1597. echo "$GREEN>$STAND Listing range of years and months .."
  1598. #Add a '-' spacer to simplify later manipulations
  1599. sed 's/^.\{4\}/&-/' -i dates_years
  1600. #Add months to list of years
  1601. for i in $(cat dates_years) ; do seq -f $i%02.0f 01 12 ; done > dates_months
  1602. sed 's/.$/&-/' -i dates_months
  1603. #
  1604. #
  1605. #
  1606. #Add days to list of years & months
  1607. echo "$GREEN>$STAND Checking for leapyears and listing correct days per month .."
  1608. for i in $(cat dates_months)
  1609.     do
  1610.     mnth=$(echo $i | cut -d - -f 2)
  1611.     year=$(echo $i | cut -d - -f 1)
  1612.     if [[ "$mnth" == "02" ]] ; then
  1613.         if [[ `expr "$year" % 4` == 0 && `expr "$year" % 100` != 0 ]] ; then
  1614.         seq -f $i%02.0f 01 29
  1615.         elif [[ `expr "$year" % 4` == 0 && `expr "$year" % 100` != 0 && `expr "$year" % 400` == 0 ]] ; then
  1616.         seq -f $i%02.0f 01 29
  1617.         else
  1618.         seq -f $i%02.0f 01 28
  1619.         fi
  1620.     elif [[ "$mnth" == "04" || "$mnth" == "06" || "$mnth" == "09" || "$mnth" == "11" ]] ; then
  1621.     seq -f $i%02.0f 01 30
  1622.     elif [[ "$mnth" == "01" || "$mnth" == "03" || "$mnth" == "05" || "$mnth" == "07" || "$mnth" == "08"  || "$mnth" == "10"|| "$mnth" == "12" ]] ; then
  1623.     seq -f $i%02.0f 01 31
  1624.     fi
  1625.     done > datelist_temp
  1626. #
  1627. #
  1628. #
  1629. #Remove dates before/after start/end date.
  1630. sed -n "/$startdate/,/$enddate/p" datelist_temp > date_list1_temp
  1631. #
  1632. #
  1633. # Ensure correct format and spacing character in output
  1634. echo "$GREEN>$STAND Creating desired format with spacing character (if any) .. "
  1635. # format ddmmyy
  1636. if [ "$format" == "ddmmyy" ] ; then
  1637.     if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1638.     sed 's/^..//' -i date_list1_temp
  1639.     awk -F- '{print $3 $2 $1}' date_list1_temp > dates_sort.txt
  1640.     sudo -u root sed 's/\(.\{2\}\)/&\//;s/\(.\{5\}\)/&\//' dates_sort.txt > "$date_outfile"
  1641.     rm date_list1_temp && rm dates_sort.txt
  1642.     elif [ -n "$space" ] ; then
  1643.     sed 's/^..//' -i date_list1_temp
  1644.     awk -F- '{print $3 $2 $1}' date_list1_temp > dates_sort.txt
  1645.     sudo -u root sed "s/\(.\{2\}\)/&"$space"/;s/\(.\{5\}\)/&$space/" dates_sort.txt > "$date_outfile"
  1646.     rm date_list1_temp && rm dates_sort.txt
  1647.     elif [ -z "$space" ] ; then
  1648.     sed 's/^..//' -i date_list1_temp
  1649.     sudo -u root awk -F- '{print $3 $2 $1}' date_list1_temp > "$date_outfile"
  1650.     rm date_list1_temp
  1651.     fi
  1652. # format ddmmyyyy
  1653. elif [ "$format" == "ddmmyyyy" ] ; then
  1654.     if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1655.     awk -F- '{print $3 $2 $1}' date_list1_temp > dates_sort.txt
  1656.     sudo -u root sed 's/\(.\{2\}\)/&\//;s/\(.\{5\}\)/&\//' dates_sort.txt > "$date_outfile"
  1657.     rm date_list1_temp && rm dates_sort.txt
  1658.     elif [ -n "$space" ] ; then
  1659.     awk -F- '{print $3 $2 $1}' date_list1_temp > dates_sort.txt
  1660.     sudo -u root sed "s/\(.\{2\}\)/&"$space"/;s/\(.\{5\}\)/&$space/" dates_sort.txt > "$date_outfile"
  1661.     rm date_list1_temp && rm dates_sort.txt
  1662.     elif [ -z "$space" ] ; then
  1663.     sudo -u root awk -F- '{print $3 $2 $1}' date_list1_temp > "$date_outfile"
  1664.     rm date_list1_temp
  1665.     fi
  1666. # format yymmdd
  1667. elif [ "$format" == "yymmdd" ] ; then
  1668.     if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1669.     sed 's/^..//' -i date_list1_temp
  1670.     sudo -u root sed 's/-/\//g' date_list1_temp > "$date_outfile"
  1671.     rm date_list1_temp
  1672.     elif [ -n "$space" ] ; then
  1673.     sed 's/^..//' -i date_list1_temp
  1674.     sudo -u root sed "s/-/$space/g" date_list1_temp > "$date_outfile"
  1675.     rm date_list1_temp
  1676.     elif [ -z "$space" ] ; then
  1677.     sed 's/^..//' -i date_list1_temp
  1678.     sudo -u root awk -F- '{print $1 $2 $3}' date_list1_temp > "$date_outfile"
  1679.     rm date_list1_temp
  1680.     fi
  1681. # format yyyymmdd
  1682. elif [ "$format" == "yyyymmdd" ] ; then
  1683.     if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1684.     sudo -u root sed 's/-/\//g' date_list1_temp > "$date_outfile"
  1685.     rm date_list1_temp
  1686.     elif [ -n "$space" ] ; then
  1687.     sudo -u root sed "s/-/$space/g" date_list1_temp > "$date_outfile"
  1688.     rm date_list1_temp
  1689.     elif [ -z "$space" ] ; then
  1690.     sudo -u root awk -F- '{print $1 $2 $3}' date_list1_temp > "$date_outfile"
  1691.     rm date_list1_temp
  1692.     fi
  1693. #format mmddyyyy
  1694. elif [ "$format" == "mmddyyyy" ] ; then
  1695. if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1696.     awk -F- '{print $2 $3 $1}' date_list1_temp > dates_sort.txt
  1697.     sudo -u root sed 's/\(.\{2\}\)/&\//;s/\(.\{5\}\)/&\//' dates_sort.txt > "$date_outfile"
  1698.     rm date_list1_temp && rm dates_sort.txt
  1699.     elif [ -n "$space" ] ; then
  1700.     awk -F- '{print $2 $3 $1}' date_list1_temp > dates_sort.txt
  1701.     sudo -u root sed "s/\(.\{2\}\)/&"$space"/;s/\(.\{5\}\)/&$space/" dates_sort.txt > "$date_outfile"
  1702.     rm date_list1_temp && rm dates_sort.txt
  1703.     elif [ -z "$space" ] ; then
  1704.     sudo -u root awk -F- '{print $2 $3 $1}' date_list1_temp > "$date_outfile"
  1705.     rm date_list1_temp
  1706.     fi
  1707. #format mmddyy
  1708. elif [ "$format" == "mmddyy" ] ; then
  1709. if [ -n "$space" ] && [ "$space" == "/" ] ; then
  1710.     sed 's/^..//' -i date_list1_temp
  1711.     awk -F- '{print $2 $3 $1}' date_list1_temp > dates_sort.txt
  1712.     sudo -u root sed 's/\(.\{2\}\)/&\//;s/\(.\{5\}\)/&\//' dates_sort.txt > "$date_outfile"
  1713.     rm date_list1_temp && rm dates_sort.txt
  1714.     elif [ -n "$space" ] ; then
  1715.     sed 's/^..//' -i date_list1_temp
  1716.     awk -F- '{print $2 $3 $1}' date_list1_temp > dates_sort.txt
  1717.     sudo -u root sed "s/\(.\{2\}\)/&"$space"/;s/\(.\{5\}\)/&$space/" dates_sort.txt > "$date_outfile"
  1718.     rm date_list1_temp && rm dates_sort.txt
  1719.     elif [ -z "$space" ] ; then
  1720.     sed 's/^..//' -i date_list1_temp
  1721.     sudo -u root awk -F- '{print $2 $3 $1}' date_list1_temp > "$date_outfile"
  1722.     rm date_list1_temp
  1723.     fi
  1724. fi
  1725. # Remove created temp files
  1726. echo "$GREEN>$STAND Tidying up .."
  1727. rm dates_years
  1728. rm dates_months
  1729. rm datelist_temp
  1730. #
  1731. echo $STAND""
  1732. echo "Datelist $GREEN$date_outfile$STAND has been created ;"
  1733. head -n 3 $date_outfile
  1734. echo ".."
  1735. tail -n 3 $date_outfile
  1736. echo $STAND ""
  1737. #
  1738. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1739. read return
  1740.     if [ "$return" == "" ] ; then
  1741.     echo $STAND""
  1742.     f_menu
  1743.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1744.     echo $STAND""
  1745.     exit
  1746.     fi
  1747. ##
  1748. ## Option 3
  1749. ## ========
  1750. elif [ "$misc_menu" == "3" ] ; then
  1751. clear
  1752. echo $BLUE"   _____  _____ _____ _____      _        _
  1753.  / ____|/ ____|_   _|  __ \    | |      (_)
  1754. | (___ | (___   | | | |  | |___| |_ _ __ _ _ __
  1755.  \___ \ \___ \  | | | |  | / __| __| '__| | '_ \\
  1756.  ____) |____) |_| |_| |__| \__ \ |_| |  | | |_) |
  1757. |_____/|_____/|_____|_____/|___/\__|_|  |_| .__/
  1758. v0.2.1             by TAPE                | |
  1759.                                           |_|$STAND
  1760. Strip SSIDs from kismet generated .nettxt files"
  1761. echo $STAND""
  1762. echo -ne $STAND"Enter /path/to/file.nettxt to process: "$GREEN
  1763. read ssid_infile
  1764.     while [ ! -f $ssid_infile ] || [ "$ssid_infile" == "" ] ; do
  1765.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  1766.     read ssid_infile
  1767.     done
  1768. echo -ne $STAND"Enter desired output file name: "$GREEN
  1769. read ssid_outfile
  1770. if [ -f $ssid_outfile ] ; then
  1771.     echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  1772.     read over
  1773.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  1774.     echo $RED"Existing file $GREEN$ssid_outfile$RED will be overwritten"$STAND
  1775.     else
  1776.     echo $STAND"Process cancelled, returning to menu"
  1777.     sleep 1
  1778.     f_menu
  1779.     fi
  1780. fi
  1781. echo "Working .."
  1782. #stripping the SSIDs from nettxt file
  1783. sudo -u root grep SSID $ssid_infile | egrep -v 'BSSID|SSID [0-9]' | cut -c 18- | sed 's/"//g' | sed 's/ *$//g' | sort -fu > $ssid_outfile
  1784. WC=$(cat $ssid_outfile | wc -l)
  1785. echo $STAND""
  1786. echo "$GREEN$ssid_outfile$STAND has been created with $GREEN$WC$STAND entries;"
  1787. head -n 3 $ssid_outfile
  1788. echo ".."
  1789. tail -n 3 $ssid_outfile
  1790. echo ""
  1791. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  1792. read return
  1793.     if [ "$return" == "" ] ; then
  1794.     echo $STAND""
  1795.     f_menu
  1796.     elif [ "$return" == "q" ] || [ "$return" == "Q" ] ; then
  1797.     echo $STAND""
  1798.     exit
  1799.     fi
  1800. echo $STAND""
  1801. ##
  1802. ##
  1803. ## Option 4
  1804. ## ========
  1805. elif [ "$misc_menu" == "4" ] ; then
  1806. clear
  1807. echo $BLUE"Basic leetifying options of wordlist"$STAND
  1808. echo "-----------------------------------"
  1809. echo
  1810. f_inout
  1811. #
  1812. echo $STAND""
  1813. echo "Enter alteration set to use to leetify wordlist"
  1814. echo "(For more simultaneous alterations, see Option 5)"
  1815. echo "------------------------------------------------------------------------------
  1816.   aA  bB  cC  dD  eE  fF  gG  hH  iI  jJ  kK  lL  mM  nN  oO  pP  qQ  rR  sS  tT  uU  vV  wW  xX  yY  zZ
  1817. 1) @4  bB  cC  dD  33  fF  9G  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  5\$  77  uU  vV  wW  xX  yY  zZ
  1818. 2) 44  68  cC  dD  33  fF  9G  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  55  77  uU  vV  wW  xX  yY  22
  1819. 3) @4  b8  cC  dD  33  fF  9G  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  5\$  77  uU  vV  wW  xX  yY  22
  1820. 4) @@  bB  cC  dD  33  fF  gG  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  \$\$  77  uU  vV  wW  xX  yY  zZ
  1821. 5) 44  bB  cC  dD  33  fF  gG  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  \$\$  77  uU  vV  wW  xX  yY  zZ
  1822. 6) 44  bB  cC  dD  33  fF  gG  hH  iI  jJ  kK  11  mM  nN  00  pP  qQ  rR  55  77  uU  vV  wW  xX  yY  zZ
  1823. "
  1824. echo -ne $STAND"Enter choice from above menu (1-6): "$GREEN
  1825. read char_menu
  1826. if [ "$char_menu" == "q" ] || [ "$char_menu" == "Q" ] ; then
  1827. echo $STAND""
  1828. f_menu
  1829. elif [[ "$char_menu" != [1-6] ]]; then
  1830. echo $RED"must be an entry from the above charset menu $STAND"
  1831. sleep 1
  1832. f_misc
  1833. fi
  1834. echo "Working .."
  1835. if [ "$char_menu" == "1" ] ; then
  1836. echo "Leetified wordlist using charset;
  1837. @4 bB cC dD 33 fF 9G hH iI jJ kK 11 mM nN 00 pP qQ rR 5\$ 77 uU vV wW xX yY zZ
  1838. -----------------------------------------------------------------------------" > $wlm_outfile
  1839. for i in $(cat $wlm_infile) ; do
  1840. echo $i | sed -e 's/a/@/g' -e 's/A/4/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/5/g' -e 's/S/\$/g' -e 's/t/7/g' -e 's/T/7/g' >> "$wlm_outfile"
  1841. done
  1842.  
  1843. elif [ "$char_menu" == "2" ] ; then
  1844. echo "Leetified wordlist using charset;
  1845. 44 68 cC dD 33 fF 9G hH iI jJ kK 11 mM nN 00 pP qQ rR 55 77 uU vV wW xX yY 22
  1846. -----------------------------------------------------------------------------" > $wlm_outfile
  1847. for i in $(cat $wlm_infile) ; do
  1848. echo $i | sed -e 's/a/4/g' -e 's/A/4/g' -e 's/b/6/g' -e 's/B/8/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/g/9/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/5/g' -e 's/S/5/g' -e 's/t/7/g' -e 's/T/7/g' -e 's/z/2/g' -e 's/Z/2/g' >> "$wlm_outfile"
  1849. done
  1850.  
  1851. elif [ "$char_menu" == "3" ] ; then
  1852. echo "Leetified wordlist using charset;
  1853. @4 b8 cC dD 33 fF 9G hH iI jJ kK 11 mM nN 00 pP qQ rR 5\$ 77 uU vV wW xX yY 22
  1854. -----------------------------------------------------------------------------" > $wlm_outfile
  1855. for i in $(cat $wlm_infile) ; do
  1856. echo $i | sed -e 's/a/@/g' -e 's/A/4/g' -e 's/B/8/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/g/9/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/5/g' -e 's/S/\$/g' -e 's/t/7/g' -e 's/T/7/g' -e 's/z/2/g' -e 's/Z/2/g' >> "$wlm_outfile"
  1857. done
  1858.  
  1859. elif [ "$char_menu" == "4" ] ; then
  1860. echo "Leetified wordlist using charset;
  1861. @@ bB cC dD 33 fF gG hH iI jJ kK 11 mM nN 00 pP qQ rR \$\$ 77 uU vV wW xX yY zZ
  1862. -----------------------------------------------------------------------------" > $wlm_outfile
  1863. for i in $(cat $wlm_infile) ; do
  1864. echo $i | sed -e 's/a/@/g' -e 's/A/@/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/\$/g' -e 's/S/\$/g' -e 's/t/7/g' -e 's/T/7/g' >> "$wlm_outfile"
  1865. done
  1866.  
  1867. elif [ "$char_menu" == "5" ] ; then
  1868. echo "Leetified wordlist using charset;
  1869. 44 bB cC dD 33 fF gG hH iI jJ kK 11 mM nN 00 pP qQ rR \$\$ 77 uU vV wW xX yY zZ
  1870. -------------------------------------------------------------------------------" > $wlm_outfile
  1871. for i in $(cat $wlm_infile) ; do
  1872. echo $i | sed -e 's/a/4/g' -e 's/A/4/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/\$/g' -e 's/S/\$/g' -e 's/t/7/g' -e 's/T/7/g' >> "$wlm_outfile"
  1873. done
  1874.  
  1875. elif [ "$char_menu" == "6" ] ; then
  1876. echo "Leetified wordlist using charset;
  1877. 44 bB cC dD 33 fF gG hH iI jJ kK 11 mM nN 00 pP qQ rR 55 77 uU vV wW xX yY zZ
  1878. -----------------------------------------------------------------------------" > $wlm_outfile
  1879. for i in $(cat $wlm_infile) ; do
  1880. echo $i | sed -e 's/a/4/g' -e 's/A/4/g' -e 's/e/3/g' -e 's/E/3/g' -e 's/l/1/g' -e 's/L/1/g' -e 's/o/0/g' -e 's/O/0/g' -e 's/s/5/g' -e 's/S/5/g' -e 's/t/7/g' -e 's/T/7/g' >> "$wlm_outfile"
  1881. done
  1882.  
  1883. fi
  1884.  
  1885. echo $STAND""
  1886. f_complete
  1887. ##
  1888. ##
  1889. ## Option 5
  1890. ## ========
  1891. elif [ "$misc_menu" == "5" ] ; then
  1892. echo $STAND""
  1893. echo $BLUE"Gitsnik's permute.pl script"$STAND
  1894. echo $BLUE"Create all possible Leetify permutations of words in file"$STAND
  1895. echo $RED"WARNING! Will massively increase wordlist size!"$STAND
  1896. echo $STAND""
  1897. f_inout
  1898. echo "Working .."
  1899. echo '
  1900. #!/usr/bin/perl
  1901. use strict;
  1902. use warnings;
  1903.  
  1904. my %permution = (
  1905.     "a" => [ "a", "4", "@", "&", "A" ],
  1906.     "b" => "bB",
  1907.     "c" => "cC",
  1908.     "d" => "dD",
  1909.     "e" => "3Ee",
  1910.     "f" => "fF",
  1911.     "g" => "gG9",
  1912.     "h" => "hH",
  1913.     "i" => "iI!|1",
  1914.     "j" => "jJ",
  1915.     "k" => "kK",
  1916.     "l" => "lL!71|",
  1917.     "m" => "mM",
  1918.     "n" => "nN",
  1919.     "o" => "oO0",
  1920.     "p" => "pP",
  1921.     "q" => "qQ",
  1922.     "r" => "rR",
  1923.     "s" => "sS5\$",
  1924.     "t" => "tT71+",
  1925.     "u" => "uU",
  1926.     "v" => "vV",
  1927.     "w" => ["w", "W", "\\/\\/"],
  1928.     "x" => "xX",
  1929.     "y" => "yY",
  1930.     "z" => "zZ2",
  1931. );
  1932.  
  1933. # End config
  1934.  
  1935. while(my $word = <>) {
  1936.     chomp $word;
  1937.     my @string = split //, lc($word);
  1938.     &permute(0, @string);
  1939. }
  1940.  
  1941. sub permute {
  1942.     my $num = shift;
  1943.     my @str = @_;
  1944.     my $len = @str;
  1945.  
  1946.     if($num >= $len) {
  1947.         foreach my $char (@str) {
  1948.             print $char;
  1949.         }
  1950.         print "\n";
  1951.         return;
  1952.     }
  1953.  
  1954.     my $per = $permution{$str[$num]};
  1955.  
  1956.     if($per) {
  1957.         my @letters = ();
  1958.         if(ref($per) eq "ARRAY") {
  1959.             @letters = @$per;
  1960.         } else {
  1961.             @letters = split //, $per;
  1962.         }
  1963.         $per = "";
  1964.  
  1965.         foreach $per (@letters) {
  1966.             my $s = "";
  1967.             for(my $i = 0; $i < $len; $i++) {
  1968.                 if($i eq 0) {
  1969.                     if($i eq $num) {
  1970.                         $s = $per;
  1971.                     } else {
  1972.                         $s = $str[0];
  1973.                     }
  1974.                 } else {
  1975.                     if($i eq $num) {
  1976.                         $s .= $per;
  1977.                     } else {
  1978.                         $s .= $str[$i];
  1979.                     }
  1980.                 }
  1981.             }
  1982.             my @st = split //, $s;
  1983.             &permute(($num + 1), @st);
  1984.         }
  1985.     } else {
  1986.         &permute(($num + 1), @str);
  1987.     }
  1988. }
  1989. ' > wlm_permute.pl
  1990. sudo -u root perl wlm_permute.pl $wlm_infile > $wlm_outfile
  1991. rm wlm_permute.pl
  1992. echo $STAND""
  1993. f_complete
  1994. fi
  1995. }
  1996. #------------
  1997. # MENU ITEM F
  1998. #============
  1999. # INFORMATION ON FILE
  2000. #####################
  2001. f_info () {
  2002. clear
  2003. echo $BLUE"__    __ _     __  __
  2004. \ \/\/ /| |__ |  \/  |
  2005. \_/\_/ |____||_|\/|_|$STAND
  2006. by TAPE"
  2007. echo ""
  2008. echo $STAND"WordList Manipulator"
  2009. echo $BLUE"File information"
  2010. echo $STAND"--------------------"
  2011. echo -ne "Enter /path/to/wordlist: "$GREEN
  2012. read info
  2013.     while [ ! -f $info ] || [ "$info" == "" ] ; do
  2014.     echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  2015.     read info
  2016.     done
  2017. echo $STAND""
  2018. echo "Gathering information on file, please be patient.."
  2019. echo ""
  2020. #Number of lines
  2021. count=$(wc -l $info | cut -d " " -f 1)
  2022. #Longest line;
  2023. length=$(wc -L $info | cut -d " " -f 1)
  2024. # General file info
  2025. file_info=$( file $info | cut -d ":" -f 2 )
  2026. #
  2027. echo $STAND"File type:$GREEN$file_info$STAND"
  2028. echo $STAND""
  2029. echo $STAND"Wordcount/number of lines: "$GREEN$count$STAND
  2030. echo $STAND""
  2031. echo $STAND"Maximum word/line length: $GREEN$length$STAND"
  2032. echo $STAND""
  2033. echo $STAND"File size"
  2034. echo $STAND"---------"
  2035. B=$( stat -c %s $info )
  2036. KB=$( echo "scale=2;$B / 1024" | bc )
  2037. MB=$( echo "scale=2;($B/1024)/1024" | bc )
  2038. GB=$( echo "scale=2;(($B/1024)/1024)/1024" | bc )
  2039. TB=$( echo "scale=2;((($B/1024)/1024)/1024)/1024" | bc )
  2040. echo $GREEN" B $STAND(Bytes)     = $GREEN$B"
  2041. echo $GREEN"KB $STAND(Kilobytes) = $GREEN$KB"
  2042. echo $GREEN"MB $STAND(Megabytes) = $GREEN$MB"
  2043. echo $GREEN"GB $STAND(Gigabytes) = $GREEN$GB"
  2044. echo $STAND""
  2045. echo $STAND"Example of file entries"
  2046. echo $STAND"-----------------------"$GREEN
  2047. head -n 3 $info
  2048. echo ".."
  2049. tail -n 3 $info
  2050. echo $STAND""
  2051. echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  2052. read return
  2053.     if [ "$return" == "" ] ; then
  2054.         echo $STAND""
  2055.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  2056.         echo $STAND""
  2057.         exit
  2058.     fi
  2059. }
  2060. #
  2061. #
  2062. #------------
  2063. # MENU ITEM H
  2064. #============
  2065. # HELP INFORMATION
  2066. ##################
  2067. f_help () {
  2068. clear
  2069. echo $BLUE"__    __ _     __  __
  2070. \ \/\/ /| |__ |  \/  |
  2071. \_/\_/ |____||_|\/|_|$STAND
  2072. by TAPE"
  2073. echo ""
  2074. echo $BLUE"WordList Manipulator$RED v$CURR_VERS$STAND build $RED$CURR_BUILD$STAND"
  2075. echo $STAND""
  2076. echo  -ne "Hit enter to continue "
  2077. read continue
  2078. if [ "$continue" == "" ] ; then
  2079. echo "
  2080. q/Q to quit;
  2081.  
  2082. Introduction
  2083. ============
  2084. Why did I spend hours doing this ?
  2085. Well, I just suck at remembering code for the simple things..
  2086.  
  2087. Normally you would use a tool like crunch or maskprocessor to create
  2088. any wordlist you want, however on occasion, you will need to alter what
  2089. is already available.
  2090.  
  2091. WLM provides an easy menu interface listing the most frequently used
  2092. manipulation options.
  2093.  
  2094.  
  2095. So in short;
  2096.  
  2097. RUNNING SCRIPT
  2098. --------------
  2099. The file needs to be made executable, so if script is not running;
  2100. > chmod 755 'filename'
  2101. or
  2102. > chmod +x 'filename'
  2103.  
  2104. BASIC USAGE
  2105. -----------
  2106. Choose an option from the main menu and then an option from the
  2107. sub menu.
  2108.  
  2109. Depending on the choice made, you will be prompted for an input file
  2110. to work on.
  2111. WLM will verify whether the input file exists, if not you will be
  2112. prompted to enter the correct filename (or correct /path/to/file)
  2113.  
  2114. You will (depending on the option chosen) be prompted to give a
  2115. desired output file name.
  2116. If this exists, you will be prompted to confirm whether to overwrite
  2117. the existing file or else to quit to main menu.
  2118.  
  2119.  
  2120. BUGS / LIMITATIONS
  2121. ==================
  2122.  
  2123. This script was written for use on Backtrack and has been tested on Backtrack as from v5.
  2124. The script has also been tested on BackBox Linux with good results.
  2125. No other platforms have been tested.
  2126.  
  2127.  
  2128. When prefixing or suffixing numbers to a wordlist, an error message
  2129. will be given if there are '%' characters in the wordlist and that
  2130. line will be skipped.
  2131.  
  2132. Including a 'space' does not work for;
  2133. Prefixing, Suffixing, Inclusion and Substitution options.
  2134.  
  2135. Splitting files based on size only accepts whole numbers
  2136. (so 2 / 25 / 100 not  2.5 / 10.6 etc)
  2137.  
  2138. Probably many more, please let me know what you find !
  2139. tape dot rulez at gmail dot com
  2140.  
  2141.  
  2142. ALL OPTIONS
  2143. -----------
  2144.  
  2145. Running the script followed by a word will create all possible permutations of that
  2146. word (Gitsnik's permute.pl script).
  2147. Running the script without any input will offer a menu with the below items ;
  2148.  
  2149.  
  2150. 1. Case Options;
  2151.     1.1 Change case of first letter of each word in the wordlist.
  2152.     1.2 Change case of last letter of each word in the wordlist.
  2153.     1.3 Change all lower case to upper case.
  2154.     1.4 Change all upper case to lower case.
  2155.     1.5 Invert case of each letter in each word.
  2156.  
  2157.  
  2158. 2. Combination options;
  2159.     2.1 Combine words from 1 list to all words in another list.
  2160.     2.2 Combine all wordlists in a directory into 1 wordlist.
  2161.  
  2162.  
  2163. 3. Prefix characters to wordlist;
  2164.     3.1 Prefix numeric values in sequence (ie. 0-999)
  2165.     3.2 Prefix fixed number of numeric values in sequence (ie. 000-999)
  2166.     3.3 Prefix a word or characters to wordlist.
  2167. Some characters will require you to escape them using backslash (\)
  2168. also space does not work, so this function has some limitations.
  2169.  
  2170.  
  2171. 4. Append / Suffix characters to wordlist;
  2172.     4.1 Suffix numeric values in sequence (ie. 0-999)
  2173.     4.2 Suffix fixed number of numeric values in sequence (ie. 000-999)
  2174.     4.3 Suffix a word or characters to wordlist.
  2175. Some characters will require you to escape them using backslash (\)
  2176. also space does not work, so this function has some limitations.
  2177.  
  2178.  
  2179. 5. Include characters
  2180.     5.1 Include characters from a certain postion from start of word.
  2181.     5.2 Include characters from a certain postion from end of word.
  2182. Some characters will require you to escape them using backslash (\)
  2183. also space does not work, so this function has some limitations.
  2184.  
  2185.  
  2186. 6. Substitute/Replace characters
  2187.     6.1 Substitute/Replace characters from start of word.
  2188.     6.2 Substitute/Replace characters from end of word.
  2189.     6.3 Substitute/Replace characters at specified positions in list.
  2190. Some characters will require you to escape them using backslash (\)
  2191. also space does not work, so this function has some limitations.
  2192.  
  2193.  
  2194. 7. Optimize / tidy up wordlist.
  2195.     7.1 Full optimization of wordlist.
  2196.     7.2 Optimize for WPA (min 8 chars max 63 chars).
  2197.     7.3 Sort words based on wordlength
  2198.         (can help process speed with some programmes [cRARk])
  2199.  
  2200.  
  2201. 8. Split options
  2202.     8.1 Split wordlists based on a user defined max linecount in each slit file.
  2203.     8.2 Split wordlists based on a user defined max size of each split file.
  2204.  
  2205.  
  2206. 9. Removal / Deletion options
  2207.     9.1 Remove characters at a certain position from start of word.
  2208.     9.2 Remove characters at a certain position before end of word.
  2209.     9.3 Remove specific characters globally from words.
  2210.     9.4     Remove words containing specific characters from wordlist.
  2211.     9.5 Remove words with more than X number of identical adjacent characters from wordlist.
  2212.     9.6 Remove words existing in 1 list from another list (test version only for small lists).
  2213.     9.7 Remove words that do not have X number of numeric values.
  2214.     9.8 Remove words that have X number of repeated characters.
  2215.     9.9 Remove words of a certain length.
  2216.  
  2217.  
  2218. 10. Miscellaneous fun
  2219.     10.1    Check possible wordlist sizes (with same min-max length only).
  2220.     10.2    Create a wordlist from a range of dates (datelist).
  2221.     10.3    Strip SSIDs from a kismet generated .nettxt file.
  2222.     10.4    Basic leetify options for wordlist.
  2223.     10.5    Leetify/Permute wordlist (Gitsnik's permute.pl script).
  2224.  
  2225.  
  2226. f. File information
  2227.     Gives information on aspects of selected file ;
  2228.     - Filetype
  2229.     - Wordcount of file
  2230.     - Longest line
  2231.     - File Size
  2232.     - first 3 and last 3 lines of file
  2233.  
  2234.  
  2235. h. This information.
  2236.  
  2237.  
  2238. u. Check for updates to the script.
  2239.  
  2240.  
  2241. q/Q to quit
  2242. " | less
  2243. fi
  2244. }
  2245. #
  2246. ##
  2247. ### Update function
  2248. ####################
  2249. f_update () {
  2250. clear
  2251. echo $STAND"Wordlist Manipulator"
  2252. echo $BLUE"Check for updates"
  2253. echo $STAND"--------------------"
  2254. echo
  2255. echo -ne $STAND"Check the latest version available ? y/n "$GREEN
  2256. read UPD
  2257. echo $STAND""
  2258. LOC=$(pwd)
  2259. if [[ $UPD == "y" || $UPD == "Y" ]] ; then
  2260. echo $GREEN">$STAND Checking Internet connection.."
  2261. wget -q --tries=10 --timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null
  2262.     if [ ! -s /tmp/index.google ];then
  2263.     echo $RED"No internet connection found..$STAND"
  2264.     sleep 2
  2265.     f_menu
  2266.     fi
  2267. echo $GREEN">$STAND Downloading latest version for checking.."
  2268. wget -q http://wordlist-manipulator.googlecode.com/svn/wlm -O $LOC/wlm.tmp
  2269. echo $GREEN">$STAND Checking if latest version in use.."
  2270. NEW_VERS=$(sed -n 3p $LOC/wlm.tmp | cut -c 11-13)
  2271. NEW_BUILD=$(sed -n 4p $LOC/wlm.tmp | cut -c 10-13)
  2272.  
  2273. if [ $CURR_VERS != $NEW_VERS ] || [ $CURR_BUILD -lt $NEW_BUILD ] ; then
  2274. echo -ne $STAND"Version in use is $GREEN$CURR_VERS$STAND build $GREEN$CURR_BUILD$STAND
  2275. Latest available is $GREEN$NEW_VERS$STAND build $GREEN$NEW_BUILD$STAND, update ? y/n "$GREEN
  2276. read UPD1
  2277.         if [[ $UPD1 == "y" || $UPD1 == "Y" ]] ; then
  2278.             if [ -d /opt/backbox ] ; then
  2279.             sudo -u root cp $LOC/wlm.tmp /opt/wlm/wlm
  2280.             sudo -u root cp $LOC/wlm.tmp /usr/bin/wlm
  2281.             sudo -u root cp $LOC/wlm.tmp /menu/auditing/miscellaneous/wlm
  2282.             echo $STAND""
  2283.             tail -n 30 /usr/bin/wlm | sed -n "/$CURR_VERS/,\$p"
  2284.             echo $STAND""
  2285.             echo "Please restart$GREEN wlm$STAND script"
  2286.             echo $STAND""
  2287.             rm $LOC/wlm.tmp
  2288.             exit   
  2289.             fi
  2290.  
  2291.         chmod +x $LOC/wlm.tmp
  2292.         mv $LOC/wlm.tmp $LOC/wlm
  2293.         echo $STAND""
  2294.         echo $STAND"Latest WLM version has been saved to $GREEN$LOC/wlm$STAND"
  2295.         echo $STAND""
  2296.         tail -n 30 $LOC/wlm | sed -n "/$CURR_VERS/,\$p"
  2297.         echo $STAND""
  2298.         echo $STAND""
  2299.         echo "Please restart$GREEN wlm$STAND script"
  2300.         echo $STAND""
  2301.         exit
  2302.         else
  2303.         echo $STAND""
  2304.         rm $LOC/wlm.tmp
  2305.         f_menu
  2306.         fi
  2307.     elif [ $CURR_VERS == $NEW_VERS ] && [ $CURR_BUILD == $NEW_BUILD ] ; then
  2308.     echo $RED"Current version in use is the latest version available;$GREEN v$NEW_VERS$STAND build $GREEN$NEW_BUILD$STAND"
  2309.     sleep 3
  2310.     rm $LOC/wlm.tmp
  2311.     f_menu
  2312.     fi
  2313. else       
  2314. echo $STAND""
  2315. f_menu
  2316. fi
  2317. }
  2318. #
  2319. ##
  2320. ### Read infile and outfile
  2321. ###########################
  2322. f_inout ()  {
  2323. # Input file to alter
  2324. echo -ne $STAND"Enter /path/to/wordlist you want to edit: "$GREEN
  2325. read wlm_infile
  2326. while [ ! -f $wlm_infile ] || [ "$wlm_infile" == "" ] ; do
  2327. echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN
  2328. read wlm_infile
  2329. done
  2330. # Output file to save the editted wordlist to
  2331. echo -ne $STAND"Enter desired output file name: "$GREEN
  2332. read wlm_outfile
  2333. while [ "$wlm_outfile" == "" ] ; do
  2334. echo -ne $STAND"Enter desired output file name: "$GREEN
  2335. read wlm_outfile
  2336. done
  2337. if [ -f $wlm_outfile ] ; then
  2338. echo -ne $RED"File already exists, overwrite ? y/n "$GREEN
  2339. read over
  2340.     if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then
  2341.     echo $RED"Existing file $GREEN$wlm_outfile$RED will be overwritten$STAND"
  2342.     else
  2343.     echo $STAND"Process cancelled, returning to menu"
  2344.     sleep 1
  2345.     f_menu
  2346.     fi
  2347. fi
  2348. }
  2349. #
  2350. ##
  2351. ### Creation completion and return or quit option
  2352. #################################################
  2353. f_complete ()   {
  2354.     echo "$GREEN$wlm_outfile$STAND has been created;"
  2355.     head -n 3 $wlm_outfile
  2356.     echo ".."
  2357.     tail -n 3 $wlm_outfile
  2358.     echo ""
  2359.  
  2360.     echo -ne $STAND"hit Enter to return to menu or q/Q to quit "$GREEN
  2361.     read return
  2362.     if [ "$return" == "" ] ; then
  2363.         echo $STAND""
  2364.     elif [ "$return" == "q" ] || [ "$return" == "Q" ]; then
  2365.         echo $STAND""
  2366.         exit
  2367.     fi
  2368. }
  2369. #
  2370. ##
  2371. ### MENU
  2372. ########
  2373. f_menu () {
  2374. while :
  2375. do
  2376. clear
  2377. echo $BLUE"__    __ _     __  __
  2378. \ \/\/ /| |__ |  \/  |
  2379. \_/\_/ |____||_|\/|_|$STAND
  2380. by TAPE"
  2381. echo $BLUE"WordList Manipulator"
  2382. echo $STAND"===================="
  2383. cat << !
  2384. 1  Case options
  2385. 2  Combinations
  2386. 3  Prepend / Prefix
  2387. 4  Append / Suffix
  2388. 5  Inclusion Options
  2389. 6  Substitution Options
  2390. 7  Tidy up / optimize wordlist
  2391. 8  Split files
  2392. 9  Removal / Deletion options
  2393. 10 Miscellaneous Fun
  2394. f  File information
  2395. h  Version and listing of all functions
  2396. u  Update
  2397.  
  2398. Q  Exit
  2399. !
  2400. echo ""
  2401. echo -ne $STAND"Choose from the above menu: "$GREEN
  2402. read menu
  2403. case $menu in
  2404. 1) f_case ;;
  2405. 2) f_combine ;;
  2406. 3) f_prefix ;;
  2407. 4) f_suffix ;;
  2408. 5) f_inclu ;;
  2409. 6) f_subs ;;
  2410. 7) f_tidy ;;
  2411. 8) f_split ;;
  2412. 9) f_delete ;;
  2413. 10) f_misc ;;
  2414. f) f_info ;;
  2415. h) f_help ;;
  2416. u) f_update ;;
  2417. q) echo $STAND"" && exit ;;
  2418. Q) echo $STAND"" && exit ;;
  2419. *) echo $RED"\"$menu\" is not a valid menu item "$STAND; sleep 0.5 ;;
  2420. esac
  2421. done
  2422. }
  2423. #
  2424. ##
  2425. ### TEST FOR DIRECT WORD INPUT
  2426. ##############################
  2427. if [ $# -ne 0 ]; then
  2428. INPUT=$(echo "$@")
  2429. echo '
  2430. #!/usr/bin/perl
  2431. use strict;
  2432. use warnings;
  2433.  
  2434. my %permution = (
  2435.     "a" => [ "a", "4", "@", "&", "A" ],
  2436.     "b" => "bB",
  2437.     "c" => "cC",
  2438.     "d" => "dD",
  2439.     "e" => "3Ee",
  2440.     "f" => "fF",
  2441.     "g" => "gG9",
  2442.     "h" => "hH",
  2443.     "i" => "iI!|1",
  2444.     "j" => "jJ",
  2445.     "k" => "kK",
  2446.     "l" => "lL!71|",
  2447.     "m" => "mM",
  2448.     "n" => "nN",
  2449.     "o" => "oO0",
  2450.     "p" => "pP",
  2451.     "q" => "qQ",
  2452.     "r" => "rR",
  2453.     "s" => "sS5\$",
  2454.     "t" => "tT71+",
  2455.     "u" => "uU",
  2456.     "v" => "vV",
  2457.     "w" => ["w", "W", "\\/\\/"],
  2458.     "x" => "xX",
  2459.     "y" => "yY",
  2460.     "z" => "zZ2",
  2461. );
  2462.  
  2463. # End config
  2464.  
  2465. while(my $word = <>) {
  2466.     chomp $word;
  2467.     my @string = split //, lc($word);
  2468.     &permute(0, @string);
  2469. }
  2470.  
  2471. sub permute {
  2472.     my $num = shift;
  2473.     my @str = @_;
  2474.     my $len = @str;
  2475.  
  2476.     if($num >= $len) {
  2477.         foreach my $char (@str) {
  2478.             print $char;
  2479.         }
  2480.         print "\n";
  2481.         return;
  2482.     }
  2483.  
  2484.     my $per = $permution{$str[$num]};
  2485.  
  2486.     if($per) {
  2487.         my @letters = ();
  2488.         if(ref($per) eq "ARRAY") {
  2489.             @letters = @$per;
  2490.         } else {
  2491.             @letters = split //, $per;
  2492.         }
  2493.         $per = "";
  2494.  
  2495.         foreach $per (@letters) {
  2496.             my $s = "";
  2497.             for(my $i = 0; $i < $len; $i++) {
  2498.                 if($i eq 0) {
  2499.                     if($i eq $num) {
  2500.                         $s = $per;
  2501.                     } else {
  2502.                         $s = $str[0];
  2503.                     }
  2504.                 } else {
  2505.                     if($i eq $num) {
  2506.                         $s .= $per;
  2507.                     } else {
  2508.                         $s .= $str[$i];
  2509.                     }
  2510.                 }
  2511.             }
  2512.             my @st = split //, $s;
  2513.             &permute(($num + 1), @st);
  2514.         }
  2515.     } else {
  2516.         &permute(($num + 1), @str);
  2517.     }
  2518. }
  2519. ' > wlm_permute.pl
  2520. echo $INPUT | perl wlm_permute.pl
  2521. echo $STAND"
  2522. Thanks to Gitsnik's permute.pl script
  2523. -------------------------------------
  2524. "
  2525. rm wlm_permute.pl
  2526. else
  2527. f_menu
  2528. fi
  2529. # Version History
  2530. #0.1 Released 11-10-2011
  2531. #
  2532. #0.2 Released 18-10-2011
  2533. # > Fixed bugs with suffixing numeric values to lists
  2534. # > Increased speed of checking file information by using wc
  2535. # > Included wordlist size checker (crunch_size)
  2536. # > Included a split option
  2537. # > Tidied up code and updated help
  2538. #
  2539. #0.3 Released 18-12-2011
  2540. # > Updated crunch_size to include estimated time based on user input on expected pwds/sec on their system.
  2541. # > Updated Split options to include splitting by filesize.
  2542. # > Tidied up how estimated number of files is calculated for split function.
  2543. # > Tidied up various bits of code and made the code more 'uniform' in approach.
  2544. # > Included msg to advise of lines which wont be processed for the prefixing/suffixing of numbers (due to % char)
  2545. # > Included removal/deletion options.
  2546. # > Included date wordlist creation option with an updated datelist script.
  2547. # > Included SSIDstrip to create SSID wordlists from kismet generated .nettxt files.
  2548. #
  2549. #0.4 Released 09-06-2012
  2550. # > Included possibility to invert the case in words (lower->upper & upper->lower).
  2551. # > Included basic error checks to the datelist script to avoid erroneous input.
  2552. # > Included possibility to remove words that do not have X number of numeric values.
  2553. # > Included possibility to remove words with N number of repeated characters.
  2554. # > Included basic leetifying options, not terribly happy with how that is done, but suppose better than nothing.
  2555. # > Temporary (? ;) ) inclusion of Gitsnik's great permute.pl script also able to run on direct input
  2556. #   pending my pitiful bash endeavours to reproduce the same thing..
  2557. #
  2558. #0.5 Released 20-08-2012
  2559. # > Fixed bug in datelist script that ignored July month -- Thanks to Stepking2
  2560. # > Fixed bug in datelist leapyear script that caused whole century years to ignore Feburary -- Thanks to Stepking2
  2561. # > Fixed bug in removal of last characters in word in menu option 9
  2562. # > Replaced repetetive code with functions
  2563. #
  2564. #0.6
  2565. # > Made all menus and queries, which weren't already, uniformly presented where possible.
  2566. # > Included 7.3 Wordlist optimization option (sort on word/string length)
  2567. # > Deleted the unused 8.3 menu option.
  2568. # > Inlcuded option to delete words of a certain length from file.
  2569. #
  2570. #0.7 Released 21-10-2012
  2571. # > Updated split options by including the -a switch variable to allow for sufficient suffix numbers
  2572. #   depending on for files which will be created when splitting files on linecount based on user input.
  2573. # > Included rudimentary update function. To be improved..
  2574. #
  2575. #0.8 Released 24-10-2012
  2576. #   Build 0801
  2577. # - Improved update function by introducing builds for easier future update checks.
  2578. #   Build 0802   25-10-2012
  2579. # - Included mention of this list of changes when updating from current version.
  2580. #   Build 0803   26-10-2012
  2581. # - Included an 'echo' when quitting from main menu to prevent colour from being altered
  2582. #   in terminal upon quitting in BBox.
  2583. # - Corrected few typoes
  2584. # - Included build number when calling for version info.
  2585. #   Build 0804  27-10-2012
  2586. # - Included more 'sudos' to allow for better funcionality when using in BBox.
  2587. # - Updated update function for BBox
  2588. #
  2589. #
  2590. # To Do List
  2591. # ----------
  2592. #  * Better include sudo requirements.
  2593. #  * Verify OS/Distro -  presence of required tools (pw-inspector) ?
  2594. #  * Include reverse option ?
  2595. #  * ? Continue to make it better ? ;)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement