Blame gen_hashlist

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