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