#!/bin/bash # This script will just use transmision-show to detect the hash of each .torrent file # and then produce an index that we can use in opentracker hash_index="torrent-hashes.list" function f_log { echo "[+] $0 -> $*" } f_log "Verifying if tools are available ..." for binary in transmission-show ; do which ${binary} >/dev/null 2>&1 if [ "$?" -ne "0" ] ; then f_log "${binary} not found ..." exit 1 else f_log "${binary} found ..." fi done test -e ${hash_index} && /bin/rm ${hash_index} f_log "Generating ${hash_index} ..." for file in *.torrent do torrent_hash=$(transmission-show $file |grep Hash:|cut -f 2 -d ':'|tr -d '[:blank:]') torrent_name=${file/.torrent} echo "${torrent_hash} # ${torrent_name}" >> ${hash_index} done f_log "Computing sha256sum for ${hash_index}" sha256sum ${hash_index} > ${hash_index}.sha256sum