├── .gitignore ├── LICENSE ├── README.md ├── TODO └── blackman /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 1337 h4x0r license 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ! blackman is not maintained and needs a rewrite, so use at own risk 2 | 3 | 4 | blackman tool 5 | ------------- 6 | Small package manager which download, compile -if needed- and install packages from sources. 7 | 8 | This tool has several goals in mind: 9 | 1. It does not depend on repository. 10 | 2. Be always up to date, since packages builds from the very last PKGBUILD in master BlackArch branch. 11 | 3. Download from tool source. 12 | 4. Compile the package. 13 | 14 | Usage: blackman 15 | --------------- 16 | 17 | OPTIONS: 18 | 19 | PACKAGES: 20 | -s : search package 21 | -i : download and compile package 22 | -g : install all packages inside a blackarch group 23 | -a: install all packages from all groups 24 | 25 | REPOSITORY: 26 | -l: list blackarch groups 27 | -n: list native installed blackarch packages 28 | -p : list packages from group 29 | -u: update blackarch repository 30 | -m: upgrade installed packages (-f to reinstall all) 31 | 32 | SORT TOOLS: 33 | -h: sort tools into main directory [~/haxx default] 34 | -D : change default main directory 35 | 36 | FLAGS: 37 | -f: force 38 | 39 | SORT TOOLS EXAMPLE 40 | ----------------- 41 | 42 | [ blackarch blackman ]# ./blackman -h 43 | --==[ blackman by nullsecurity.net ]==-- 44 | [+] Creating /root/haxx dir for tools 45 | 46 | [+] bowcaster tool added to blackarch group 47 | [+] cms-explorer tool added to blackarch group 48 | [+] dirb tool added to blackarch group 49 | [+] flunym0us tool added to blackarch group 50 | [+] netcon tool added to blackarch group 51 | [+] nikto tool added to blackarch group 52 | [+] sploitctl tool added to blackarch group 53 | [+] wnmap tool added to blackarch group 54 | [+] wpscan tool added to blackarch group 55 | [+] xortool tool added to blackarch group 56 | [+] bowcaster tool added to exploitation group 57 | [+] sploitctl tool added to exploitation group 58 | [+] cms-explorer tool added to fingerprint group 59 | [+] cms-explorer tool added to webapp group 60 | [+] dirb tool added to webapp group 61 | [+] flunym0us tool added to webapp group 62 | [+] nikto tool added to webapp group 63 | [+] wpscan tool added to webapp group 64 | [+] dirb tool added to scanner group 65 | [+] flunym0us tool added to scanner group 66 | [+] nikto tool added to scanner group 67 | [+] wnmap tool added to scanner group 68 | [+] wpscan tool added to scanner group 69 | [+] netcon tool added to networking group 70 | [+] nikto tool added to fuzzer group 71 | [+] sploitctl tool added to automation group 72 | [+] wnmap tool added to automation group 73 | [+] xortool tool added to crypto group 74 | 75 | [..] 76 | 77 | [+] Done! 78 | 79 | [ blackarch blackman ]# ls ~/haxx/ 80 | blackarch forensic automation backdoor 81 | binary bluetooth audit cracker 82 | crypto database debugger decompiler 83 | defensive disassembler dos drone 84 | exploitation fingerprint firmware forensic 85 | fuzzer hardware honeypot keylogger 86 | malware misc mobile networking 87 | nfc packer proxy recon 88 | reversing scanner sniffer social 89 | spoof model tunnel unpacker 90 | voip webapp windows wireless 91 | 92 | [ blackarch blackman ]# blackman -n 93 | --==[ blackman - BlackArch ]==-- 94 | [+] beef 95 | The Browser Exploitation Framework that focuses on the web browser 96 | [+] bluesnarfer 97 | A bluetooth attacking tool 98 | [+] crunch 99 | A wordlist generator for all combinations/permutations of a given character set. 100 | [+] dirb 101 | A web content scanner, brute forceing for hidden files. 102 | [+] maclookup 103 | Lookup MAC addresses in the IEEE MA-L/OUI public listing. 104 | [+] make-pdf 105 | This tool will embed javascript inside a PDF document. 106 | [+] maskprocessor 107 | A High-Performance word generator with a per-position configurable charset. 108 | [+] netscan 109 | Tcp/Udp/Tor port scanner with: synpacket, connect TCP/UDP and socks5 (tor connection). 110 | [+] nipper 111 | Network Infrastructure Parser 112 | [+] pdf-parser 113 | Parses a PDF document to identify the fundamental elements used in the analyzed file. 114 | ... 115 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | [ DONE ] DEPENDENCIES 2 | 3 | 00:48 <@paraxor> does it build dependencies within our repo? 4 | 00:48 <@paraxor> say X depends on Y and you install X 5 | 00:48 <@paraxor> where Y is in our repo 6 | 7 | VERSION CHECK 8 | - pacman -Qi - parse version if package installed -> 9 | system update with world and 10 | [DONE] check if already installed that pkg version 11 | 12 | SEARCH 13 | - [DONE] Search by pkdesc 14 | - < v0.5.6 15 | $ blackman -s wordpress 16 | --==[ blackman by nullsecurity.net ]==-- 17 | [-] ERROR: Package 'wordpress' not found 18 | - > v0.5.6 19 | $ ./blackman -s wordpress 20 | --==[ blackman - BlackArch ]==-- 21 | [+] plecost 22 | Wordpress finger printer tool search and retrieve information about the plugins versions installed in Wordpress systems. 23 | [+] wordpot 24 | A Wordpress Honeypot. 25 | [+] flunym0us 26 | A Vulnerability Scanner for Wordpress and Moodle. 27 | [+] wpbf 28 | Multithreaded WordPress brute forcer. 29 | [+] wpscan 30 | A vulnerability scanner which checks the security of WordPress installations using a black box approach. 31 | [+] wordbrutepress 32 | Python script that performs brute forcing against WordPress installs using a wordlist. 33 | -------------------------------------------------------------------------------- /blackman: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # ____ _ __ # 4 | # ___ __ __/ / /__ ___ ______ ______(_) /___ __ # 5 | # / _ \/ // / / (_-> "${ERROR_LOG}" 110 | printf "%b[-] ERROR: ${fmt}%b\n" "${RED}" "${@}" "${NC}" 111 | 112 | return "${FAILURE}" 113 | } 114 | 115 | # print error and exit 116 | cri() 117 | { 118 | fmt=${1} 119 | shift 120 | printf "[-] CRITICAL: ${fmt}%b\n" "${@}" >> "${ERROR_LOG}" 121 | printf "%b[-] CRITICAL: ${fmt}%b\n" "${RED}" "${@}" "${NC}" 122 | 123 | exit "${FAILURE}" 124 | } 125 | 126 | # usage and help 127 | usage() 128 | { 129 | cat < 131 | 132 | OPTIONS: 133 | 134 | PACKAGES: 135 | -s : search package 136 | -i : download, compile and install package 137 | -g : install all packages inside a blackarch group 138 | -a: install all packages from all groups 139 | 140 | REPOSITORY: 141 | -l: list blackarch groups 142 | -n: list native installed blackarch packages 143 | -p : list packages from group 144 | -u: update blackarch repository 145 | -m: upgrade installed packages (-f to reinstall all) 146 | 147 | SORT TOOLS: 148 | -h: sort tools into main directory [${SORT_TOOLS_DIR} default] 149 | -D : change default main directory 150 | 151 | FLAGS: 152 | -f: force 153 | 154 | MISC: 155 | -v: verbose 156 | -V: blackman version 157 | -H: this 158 | 159 | EOF 160 | 161 | return "${SUCCESS}" 162 | } 163 | 164 | # leet banner, very important 165 | banner() 166 | { 167 | printf "%b--==[ blackman - BlackArch ]==--%b\n" "${YELLOW}" "${NC}" 168 | 169 | return "${SUCCESS}" 170 | } 171 | 172 | # # TODO 173 | # # check argument count 174 | # check_argc() 175 | # { 176 | # return "${SUCCESS}" 177 | # } 178 | # 179 | # # check if required arguments were selected 180 | # check_args() 181 | # { 182 | # return "${SUCCESS}" 183 | # } 184 | 185 | ask_pkg_install() 186 | { 187 | pkg=${1} 188 | 189 | printf "%b" "${WHITE}" 190 | 191 | printf "[?] About to install %b [Y/n]: " "${pkg}" 192 | read a 193 | if [ "${a}" == "n" ] || [ "${a}" == "N" ]; then 194 | ret=${FAILURE} 195 | else 196 | ret=${SUCCESS} 197 | fi 198 | 199 | printf "%b" "${NC}" 200 | 201 | return "${ret}" 202 | 203 | } 204 | 205 | # check if environment has everything it need. Run only once. 206 | check_env() 207 | { 208 | if [ -f /var/lib/pacman/db.lck ]; then 209 | cri "Pacman locked - rm /var/lib/pacman/db.lck" 210 | fi 211 | 212 | command -v strip >/dev/null 2>&1 || 213 | err "Blackman needs binutils to work" || 214 | if ask_pkg_install "binutils"; then 215 | if [ "$(id -u)" != "0" ]; then 216 | sudo pacman -S binutils --noconfirm 217 | else 218 | pacman -S binutils --noconfirm 219 | fi 220 | fi 221 | 222 | command -v make >/dev/null 2>&1 || 223 | err "Blackman needs base-devel to work" || 224 | if ask_pkg_install "base-devel"; then 225 | if [ "$(id -u)" != "0" ]; then 226 | sudo pacman -S base-devel --noconfirm 227 | else 228 | pacman -S base-devel --noconfirm 229 | fi 230 | fi 231 | 232 | command -v svn >/dev/null 2>&1 || 233 | err "Blackman needs Subversion to work" || 234 | if ask_pkg_install "subversion"; then 235 | if [ "$(id -u)" != "0" ]; then 236 | sudo pacman -S subversion --noconfirm 237 | else 238 | pacman -S subversion --noconfirm 239 | fi 240 | fi 241 | 242 | command -v git >/dev/null 2>&1 || 243 | err "Blackman needs git to work" || 244 | if ask_pkg_install "git"; then 245 | if [ "$(id -u)" != "0" ]; then 246 | sudo pacman -S git --noconfirm 247 | else 248 | pacman -S git --noconfirm 249 | fi 250 | fi 251 | 252 | return "${SUCCESS}" 253 | } 254 | 255 | # check if its first time for blackman and set everything up 256 | check_init() 257 | { 258 | # check blackarch repository 259 | if ! [ -d "${LOCAL_REPO}" ]; then 260 | printf "[+] First Blackman Init - Setting up... \n\n" 261 | check_env 262 | git clone "${REMOTE_REPO}" "${LOCAL_REPO}" 263 | fi 264 | 265 | if ! [ -d "${META}" ]; then 266 | mkdir -p "${META}" 267 | printf "[+] Creating meta directory...\n" 268 | fi 269 | 270 | ! [ -f "${WORLD}" ] && touch "${WORLD}" 271 | 272 | return "${SUCCESS}" 273 | } 274 | 275 | 276 | search() 277 | { 278 | pkg=${1} 279 | local found="${FAILURE}" 280 | 281 | find "${REPO_PKGS}/" -name PKGBUILD | ( while read -r; do 282 | package=$(local _var=${REPLY%/*}; echo "${_var##*/}") 283 | if [[ "${package}" =~ "${pkg}" ]]; then 284 | found="${SUCCESS}" 285 | wprintf "[+] %b" "${package}" 286 | gprintf "\t%b" "$(grep "pkgdesc" < "${REPLY}" | cut -d"=" -f2 | sed 's/^.\(.*\).$/\1/')" 287 | elif grep pkgdesc "${REPLY}"| grep -qi "${pkg}"; then 288 | found="${SUCCESS}" 289 | wprintf "[+] %b" "$(local _var=${REPLY%/*}; echo "${_var##*/}")" 290 | gprintf "\t%b" "$(grep "pkgdesc" < "${REPLY}" | cut -d"=" -f2 | sed 's/^.\(.*\).$/\1/')" 291 | fi 292 | done 293 | [ "${found}" == "${FAILURE}" ] && err "Package \'%b\' not found" "${pkg}" 294 | ) 295 | 296 | return "${found}" 297 | } 298 | 299 | compare_version() 300 | { 301 | test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; 302 | } 303 | 304 | # return SUCCESS if already installed and FAILURE otherwise 305 | check_pkg() 306 | { 307 | pkg=${1} 308 | 309 | if grep -q "${pkg}" "${WORLD}"; then 310 | wprintf "[+] Package %b already installed" "${pkg}" 311 | ver_PKGBUILD=$(grep "pkgver=" "${REPO_PKGS}/${pkg}/PKGBUILD" |sed "s/pkgver=//;s/'//g") 312 | ver_installed=$(pacman -Qi "${pkg}" 2>/dev/null|grep "Version"|cut -d":" -f2|sed 's/ //g;s/-.*//') 313 | [ "${ver_installed}" == "" ] && return "${FAILURE}" # not installed 314 | if [ "${ver_PKGBUILD}" == "${ver_installed}" ]; then 315 | wprintf "[+] Package %b up to date (v%b) \n %b" "${pkg}" "${ver_PKGBUILD}" "${FORCE- ** reinstall with -f arg}" 316 | return "${SUCCESS}" 317 | else 318 | wprintf "[+] Installing update version for package %b" "${pkg}" 319 | wprintf "[+] Version update from %b -> %b" "${ver_installed}" "${ver_PKGBUILD}" 320 | return "${FAILURE}" 321 | fi 322 | fi 323 | 324 | # pkg isnt inside world file - not installed 325 | return "${FAILURE}" 326 | } 327 | 328 | 329 | install_pkg() 330 | { 331 | pkg=${1} 332 | pacman_version=$(pacman -Qi "pacman" 2>/dev/null|grep "Version"|cut -d":" -f2|sed 's/ //g;s/-.*//') 333 | pacman_extra=${2-""} 334 | 335 | 336 | if [ -d "${REPO_PKGS}/${pkg}" ]; then 337 | # check if pkg already installed with same version from repository 338 | if check_pkg "${pkg}" && [ -z "${FORCE}" ]; then 339 | return "${SUCCESS}" 340 | fi 341 | 342 | cp -R "${REPO_PKGS}/${pkg}" "${TMP_DIR_INSTALL}" 343 | cd "${TMP_DIR_INSTALL}/${pkg}" 344 | 345 | # check and resolve dependencies with blackarch packages 346 | if grep -q "^depends=" PKGBUILD; then 347 | grep "^depends=" PKGBUILD | sed "s/depends=(//;s/)//;s/'//g;s/ /\n/g"| 348 | while read -r; do 349 | if [ -d "${REPO_PKGS}/${REPLY}" ]; then 350 | wprintf "[+] BlackArch dependencies detected - Installing..." 351 | install_pkg "${REPLY}" "--noconfirm --needed" 352 | fi 353 | done 354 | fi 355 | 356 | if compare_version ${pacman_version} "4.2"; then 357 | if [[ "$(id -u)" -eq 0 ]]; then 358 | cri "blackman must not be run as root" 359 | else 360 | makepkg -sf --noconfirm 361 | fi 362 | else 363 | if [[ "$(id -u)" -ne 0 ]]; then 364 | makepkg -sf --noconfirm 365 | else 366 | makepkg -sf --asroot --noconfirm 367 | fi 368 | fi 369 | 370 | [ "${?}" != "0" ] && warn "Something wrong with makepkg: %b" "${pkg}" 371 | sudo pacman -U *.zst ${pacman_extra} 372 | 373 | # cleaning up 374 | rm -rf "${TMP_DIR_INSTALL:?}/${pkg}" 375 | 376 | ! grep -q "${pkg}" "${WORLD}" && printf "%b\n" "${pkg}" >> "${WORLD}" 377 | else 378 | cri "Package not found in repository \'%b\'" "${pkg}" 379 | fi 380 | 381 | return "${SUCCESS}" 382 | } 383 | 384 | install_group() 385 | { 386 | # TODO: get count of packages - ask if install all 387 | group=$1 388 | 389 | # fix blackarch- prefix 390 | ! printf "%b" "${group}" | grep -q "blackarch" && group="blackarch-${group}" 391 | 392 | wprintf "[+] Installing %b group" "${group}" 393 | 394 | if grep -q "^$group$" "${GROUPS_FILE}"; then 395 | grep -lr "$group" "${REPO_PKGS}" | while read -r; do 396 | # TODO: nicer? 397 | rm_file=$(printf "%b" "${REPLY}"|sed 's/\/PKGBUILD//') 398 | wprintf "[+] Installing %b package" "${rm_file##*/}" 399 | install_pkg "${rm_file##*/}" "--noconfirm --needed" 400 | done 401 | else 402 | cri "Group \'%b\' does not exist" "${group}" 403 | fi 404 | 405 | return "${SUCCESS}" 406 | } 407 | 408 | install_all() 409 | { 410 | install_group "blackarch" 411 | 412 | return "${SUCCESS}" 413 | } 414 | 415 | list_groups() 416 | { 417 | while read -r; do 418 | wprintf "[+] %b" "${REPLY}" 419 | done < "${GROUPS_FILE}" 420 | 421 | return "${SUCCESS}" 422 | } 423 | 424 | list_native() 425 | { 426 | ls ${SORT_TOOLS_DIR}/blackarch | 427 | while read -r tool ; do 428 | wprintf "[+] %b" "${tool}" 429 | grep "${tool}" -rl "${REPO_PKGS}" |grep PKGBUILD | ( while read -r; do 430 | package=$(local _var=${REPLY%/*}; echo "${_var##*/}") 431 | [[ "$package" == "${tool}" ]] && gprintf "\t%b" "$(cat "${REPLY}" |grep "pkgdesc" |cut -d"=" -f2 |sed 's/^.\(.*\).$/\1/')" 432 | done 433 | ) 434 | done 435 | 436 | return "${SUCCESS}" 437 | } 438 | 439 | upgrade_packages() 440 | { 441 | for tool in $(ls ${SORT_TOOLS_DIR}/blackarch); do 442 | install_pkg ${tool}; 443 | done 444 | return "${SUCCESS}" 445 | } 446 | 447 | list_pkgs_from_group() 448 | { 449 | group=$1 450 | found="false" 451 | 452 | # fix blackarch- prefix 453 | if [ "${group}" != "blackarch" ]; then 454 | ! printf "%b" "${group}" | grep -q "blackarch-" && group="blackarch-${group}" 455 | fi 456 | 457 | if grep -q "${group}" "${GROUPS_FILE}"; then 458 | grep "${group}" -rl "${REPO_PKGS}"|grep PKGBUILD| ( while read -r; do 459 | found="true" 460 | path_no_pkgbuild=$(printf "%b" "${REPLY}"| sed 's/\/PKGBUILD//') 461 | wprintf "[+] %b" "${path_no_pkgbuild##*/}" 462 | gprintf "\t%b" "$(cat "${REPLY}"|grep "pkgdesc"|cut -d"=" -f2|sed 's/^.\(.*\).$/\1/')" 463 | done 464 | [ "${found}" == "false" ] && err "No packets found for group \'%b\'" "${group}" 465 | ) 466 | else 467 | cri "Group %b not found" "${group}" 468 | fi 469 | 470 | return "${SUCCESS}" 471 | } 472 | 473 | update_system() 474 | { 475 | #check date 476 | return "${SUCCESS}" 477 | } 478 | 479 | update_repo() 480 | { 481 | printf "%b" "${WHITE}" 482 | 483 | cd "${LOCAL_REPO}" 484 | git fetch --all 485 | git reset --hard origin/master 486 | 487 | printf "%b" "${NC}" 488 | 489 | return "${SUCCESS}" 490 | } 491 | 492 | sort_tools() 493 | { 494 | arg_dir=$1 495 | 496 | [ -n "${arg_dir}" ] && SORT_TOOLS_DIR=${arg_dir} 497 | 498 | ! [ -d "${SORT_TOOLS_DIR}" ] && 499 | wprintf "[+] Creating %b dir for tools\n" "${SORT_TOOLS_DIR}" && 500 | mkdir -p "${SORT_TOOLS_DIR}" 501 | 502 | 503 | pacman -Qgg | grep blackarch | 504 | while read -r group tool ; do 505 | mkdir -p "${SORT_TOOLS_DIR}/${group##*-}" 506 | if ! [ -h "${SORT_TOOLS_DIR}/${group##*-}/${tool}" ]; then 507 | ln -s "/usr/share/${tool}" "${SORT_TOOLS_DIR}/${group##*-}/" 508 | wprintf "[+] %b tool added to %b group" "${tool}" "${group##*-}" 509 | fi 510 | done 511 | # remove uninstalled tools 512 | wprintf "[+] Removing uninstalled tools" 513 | removed="false" 514 | for tool in $(pacman -Qqn `ls ${SORT_TOOLS_DIR}/blackarch/` 3>&1 1>/dev/null 2>&3- | cut -d' ' -f3 | tr -d \') ; do 515 | wprintf "[+] ${tool}:" && find -P "${SORT_TOOLS_DIR}" -name "${tool}" -execdir echo -en "\t" ';' -print -delete; 516 | # remove tool from world folder 517 | sed -i "/"${tool}"/d" ${WORLD}; 518 | done && removed="true" 519 | 520 | [[ !${removed} == "false" ]] && wprintf "[+] No uninstalled tools found" 521 | wprintf "\n[+] Done!" 522 | 523 | return "${SUCCESS}" 524 | } 525 | 526 | # parse command line options 527 | get_opts() 528 | { 529 | while getopts s:i:g:anlp:umhD:fvVH flags; do 530 | case ${flags} in 531 | s) 532 | opt_mode="search" 533 | opt_arg=${OPTARG} 534 | ;; 535 | i) 536 | opt_mode="install_pkg" 537 | opt_arg=${OPTARG} 538 | ;; 539 | g) 540 | opt_mode="install_group" 541 | opt_arg=${OPTARG} 542 | ;; 543 | a) 544 | opt_mode="install_all" 545 | ;; 546 | l) 547 | opt_mode="list_groups" 548 | ;; 549 | n) 550 | opt_mode="list_native" 551 | ;; 552 | p) 553 | opt_mode="list_pkgs_from_group" 554 | opt_arg=${OPTARG} 555 | ;; 556 | # TODO ? 557 | # u) 558 | # opt_mode="update_system" 559 | # opt_arg=${OPTARG} 560 | # ;; 561 | u) 562 | opt_mode="update_repo" 563 | ;; 564 | m) 565 | opt_mode="upgrade_packages" 566 | ;; 567 | h) 568 | opt_mode="sort_tools" 569 | ;; 570 | D) 571 | opt_arg=${OPTARG} 572 | ;; 573 | f) 574 | FORCE="true" 575 | ;; 576 | v) 577 | VERBOSE="/dev/stdout" 578 | ;; 579 | V) 580 | printf "%b\n" "${VERSION}" 581 | exit "${SUCCESS}" 582 | ;; 583 | H) 584 | opt_mode="usage" 585 | ;; 586 | *) 587 | cri "WTF?! mount /dev/brain" 588 | ;; 589 | esac 590 | done 591 | 592 | return "${SUCCESS}" 593 | } 594 | 595 | # controller and program flow 596 | main() 597 | { 598 | banner 599 | get_opts "${@}" 600 | check_init 601 | # check for environment should be done once? 602 | # check_env 603 | 604 | case "${opt_mode}" in 605 | "search") 606 | search "${opt_arg}" 607 | ;; 608 | "install_pkg") 609 | install_pkg "${opt_arg}" 610 | ;; 611 | "install_group") 612 | install_group "${opt_arg}" 613 | ;; 614 | "install_all") 615 | install_all 616 | ;; 617 | "update_repo") 618 | update_repo 619 | ;; 620 | "upgrade_packages") 621 | upgrade_packages 622 | ;; 623 | "list_groups") 624 | list_groups 625 | ;; 626 | "list_native") 627 | list_native 628 | ;; 629 | "list_pkgs_from_group") 630 | list_pkgs_from_group "${opt_arg}" 631 | ;; 632 | "sort_tools") 633 | sort_tools "${opt_arg}" 634 | ;; 635 | "usage") 636 | usage 637 | ;; 638 | *) 639 | usage 640 | ;; 641 | esac 642 | 643 | return "${SUCCESS}" 644 | } 645 | 646 | # program start 647 | main "${@}" 648 | 649 | --------------------------------------------------------------------------------