Privacy fix and Makefile standardization; code reuse
This commit is contained in:
parent
10335ae2df
commit
bef501886a
7
Makefile
7
Makefile
@ -6,9 +6,7 @@ compile: ./1337x.torrentengine.sample
|
||||
install: /usr/bin/wget /usr/bin/transmission-cli /usr/bin/googler wolfpack wolfpack-stoptorrent /usr/local/bin/whatismyip
|
||||
cp -p /usr/local/src/WolfPack/wolfpack /usr/local/bin/wolfpack
|
||||
cp -p /usr/local/src/WolfPack/wolfpack-stoptorrent /usr/local/bin/wolfpack-stoptorrent
|
||||
chmod 0700 /usr/local/bin/wolfpack-stoptorrent
|
||||
chmod 0755 /usr/local/bin/wolfpack
|
||||
chown root:root /usr/local/bin/wolfpack*
|
||||
make checkperm
|
||||
|
||||
clean:
|
||||
@echo Nothing to do
|
||||
@ -26,6 +24,9 @@ reverse:
|
||||
checkperm: /usr/local/etc/WolfPack/
|
||||
chmod -R ug+rw /usr/local/etc/WolfPack/
|
||||
chmod 0770 /usr/local/etc/WolfPack/
|
||||
chmod 0700 /usr/local/bin/wolfpack-stoptorrent
|
||||
chmod 0755 /usr/local/bin/wolfpack
|
||||
chown root:root /usr/local/bin/wolfpack*
|
||||
|
||||
offload: offload-wolfpack /root/.ssh/id_rsa /root/.ssh/id_rsa.pub
|
||||
cp offload-wolfpack /root/bin
|
||||
|
35
wolfpack
35
wolfpack
@ -43,15 +43,28 @@ search ~~ Uses the Google search
|
||||
'
|
||||
}
|
||||
|
||||
function privacycheck {
|
||||
if [ "$(whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ' | tail -n 1)" ]; then
|
||||
echo "Should not torrent directly from the AniNIX main IP for privacy reasons" 2>&1 | tee -a $logfile
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function transmissioncheck {
|
||||
if [ "$(pgrep -afc transmission-cli)" -ne 0 ]; then
|
||||
echo "Transmission is still running. Aborting." | tee -a $logfile
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function torrent {
|
||||
if [ "$1" == "" ] || [ $(wc -l "$1" | cut -f 1 -d ' ') -lt 3 ]; then
|
||||
echo "Need a valid argument."
|
||||
return;
|
||||
fi
|
||||
if [ "$(whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ')" ]; then
|
||||
echo "Should not torrent directly from the AniNIX main IP for privacy reasons" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
transmissioncheck;
|
||||
privacycheck;
|
||||
export downloaddir=$(head -n 2 "$1" | tail -n 1)
|
||||
if [ "$(pgrep -afc transmission-cli)" -ne 0 ]; then
|
||||
echo "Transmission is still running. Aborting." | tee -a $logfile
|
||||
@ -82,21 +95,15 @@ function shows {
|
||||
echo "Need a valid argument."
|
||||
return;
|
||||
fi
|
||||
if [ "$(pgrep -afc transmission-cli)" -ne 0 ]; then
|
||||
echo "Transmission is still running. Aborting." | tee -a $logfile
|
||||
return;
|
||||
fi
|
||||
if [ "$(whatismyip)" == "$(nslookup aninix.net | grep Address | cut -f 2 -d ' ')" ]; then
|
||||
echo "Should not torrent directly from the AniNIX main IP for privacy reasons" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
transmissioncheck;
|
||||
privacycheck;
|
||||
export downloaddir=$(head -n 2 "$1" | tail -n 1)
|
||||
echo "Would download to "$downloaddir
|
||||
for i in $(tail -n +3 "$1"); do
|
||||
export searchsegment="$(echo $i | tr '#' '+' | tr ' ' '+')"
|
||||
export searchlink="$(printf "$torrentengine" "$searchsegment")"
|
||||
export searchresult=$(wget -q -O - "$searchlink" | bash -c "$torrentterms")
|
||||
export magnetlink=$(wget -q -O - "$searchresult" | grep 'magnet:?' | cut -f $magnetposition -d \")
|
||||
export magnetlink=$(wget -q -O - "$searchresult" | grep 'magnet:?' | cut -f $magnetposition -d $magnetseparator)
|
||||
if [ $torrentdebugging == "true" ]; then
|
||||
echo $searchstring
|
||||
echo $searchlink
|
||||
@ -129,7 +136,7 @@ function shows {
|
||||
export newseason=$(printf "%02d\n" $((${season#0} + 1)))
|
||||
export newsearch="$(echo $searchlink | sed 's/S'$season'E'$episode'/S'$newseason'E01/')"
|
||||
export searchresult=$(wget -q -O - "$newsearch" | bash -c "$torrentterms")
|
||||
export magnetlink=$(wget -q -O - "$searchresult" | grep 'magnet:?' | cut -f $magnetposition -d \")
|
||||
export magnetlink=$(wget -q -O - "$searchresult" | grep 'magnet:?' | cut -f $magnetposition -d $magnetseparator)
|
||||
if [ $torrentdebugging == "true" ]; then
|
||||
echo $newseason
|
||||
echo $newsearch
|
||||
|
Loading…
Reference in New Issue
Block a user