| 1 | #!/bin/bash |
| 2 | #download, update and query local exploit database from milw0rm.com |
| 3 | target_dir="/opt/milw0rm" |
| 4 | |
| 5 | case "$1" in |
| 6 | update) |
| 7 | if [ $UID != 0 ]; then |
| 8 | echo 'You must run Milw0rm update as root!'; |
| 9 | exit; |
| 10 | fi; |
| 11 | echo "Downloading exploit archive from Milw0rm..." |
| 12 | mkdir -p "$target_dir" |
| 13 | cd "$target_dir"; |
| 14 | wget "http://www.milw0rm.com/sploits/milw0rm.tar.bz2" |
| 15 | echo "Extracting archive..." |
| 16 | tar jxpf milw0rm.tar.bz2 |
| 17 | rm milw0rm.tar.bz2 |
| 18 | cd milw0rm |
| 19 | ;; |
| 20 | search) |
| 21 | cat "$target_dir/milw0rm/sploitlist.txt" | grep -i "$2" |
| 22 | ;; |
| 23 | usearch) |
| 24 | $0 update |
| 25 | $0 search "$2" |
| 26 | ;; |
| 27 | *) |
| 28 | echo "Local Milw0rm.com exploit database updater" |
| 29 | echo "Target directory: $target_dir" |
| 30 | echo "usage: $0 {update|search regexp|usearch regexp}" |
| 31 | esac |
| 32 | |