Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wuseman committed Jan 16, 2019
1 parent 7e82446 commit a7254fe
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions emagnet
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,33 @@ if [[ $EUID -gt "0" ]]; then printf "Root privileges is required for this tool.\
if [[ ! -f /etc/emagnet.conf ]]; then printf "Error: /etc/emagnet.conf is required, run emagnet-setup.sh for generate emagnet.conf\n"; exit 0;fi
source .scripts/emagnet-banner.sh
source /etc/emagnet.conf
if [[ ! -d $EMAGNETHOME ]]; then mkdir -p $EMAGNETHOME &> /dev/null; fi;if [[ ! -d $EMAGNETDB ]]; then mkdir -p $EMAGNETDB &> /dev/null; fi; if [[ ! -d $EMAGNETTEMP ]]; then mkdir -p $EMAGNETTEMP &> /dev/null; fi
if [[ ! -d $EMAGNETCRAP ]]; then mkdir -p $EMAGNETCRAP &> /dev/null; fi; if [[ ! -d $EMAGNETALL ]]; then mkdir -p $EMAGNETALL &> /dev/null; fi; if [[ ! -d $LOGS ]]; then mkdir -p $LOGS &> /dev/null; fi
if [[ ! -d $EMAGNETCLONE ]]; then mkdir -p $EMAGNETCLONE &> /dev/null; fi;if [[ ! -d $EMAGNETMIRROR ]]; then mkdir -p $EMAGNETMIRROR &> /dev/null; fi; if [[ ! -d $EMAGNETBACKUP ]]; then mkdir -p $EMAGNETBACKUP &> /dev/null; fi
if [[ ! -d $EMAGNETSPIDER ]]; then mkdir -p $EMAGNETSPIDER &> /dev/null; fi
if [[ -z $MYIP ]]; then banner;echo -e "Add your IP to settings to be safe since we do not want to use our own ip..\n";echo "\[$(date +%d/%m/%Y\ -\ %H:%M)\]: $(whoami) - Aborted for safety, don't use your own IP" >> $LOGS2/emagnet.log;exit 1; fi
if [[ "$(curl -s https://nr1.nu/ip/ | sed -n '27p')" = "$MYIP" ]];then banner; echo " Use TOR or a VPN for your own safety. Aborted."; echo ""; exit 1;fi
source .scripts/emagnet-requirements.sh;checkwget;checklynx;checkcurl

if [[ ! -d $EMAGNETHOME ]]; then mkdir -p $EMAGNETHOME &> /dev/null; fi
if [[ ! -d $EMAGNETDB ]]; then mkdir -p $EMAGNETDB &> /dev/null; fi
if [[ ! -d $EMAGNETTEMP ]]; then mkdir -p $EMAGNETTEMP &> /dev/null;fi
if [[ ! -d $EMAGNETCRAP ]]; then mkdir -p $EMAGNETCRAP &> /dev/null;fi
if [[ ! -d $EMAGNETALL ]]; then mkdir -p $EMAGNETALL &> /dev/null;fi
if [[ ! -d $EMAGNETCLONE ]]; then mkdir -p $EMAGNETCLONE &> /dev/null;fi
if [[ ! -d $EMAGNETMIRROR ]]; then mkdir -p $EMAGNETMIRROR &> /dev/null;fi
if [[ ! -d $EMAGNETBACKUP ]]; then mkdir -p $EMAGNETBACKUP &> /dev/null;fi
if [[ ! -d $EMAGNETSPIDER ]]; then mkdir -p $EMAGNETSPIDER &> /dev/null;fi
if [[ ! -d $EMAGNETLOGS ]]; then mkdir -p $EMAGNETLOGS &> /dev/null; fi

if [[ -z $MYIP ]]; then
echo -e "Add your IP to settings to be safe since we do not want to use our own ip..\n"
echo "\[$(date +%d/%m/%Y\ -\ %H:%M)\]: $(whoami) - Aborted for safety, don't use your own IP!!" >> $LOGS2/emagnet.log
exit
fi

if [[ "$(curl -s https://nr1.nu/ip/ | sed -n '27p')" = "$MYIP" ]]; then
echo "Use TOR or a VPN for your own safety. Aborted."; echo ""
exit 1
fi

source .scripts/emagnet-requirements.sh
checkwget
checklynx
checkcurl

help() {
banner;
Expand All @@ -47,7 +67,14 @@ help
}

countdown() {
wait_time=$TIME ;temp_cnt=${wait_time};while [[ ${temp_cnt} -gt 0 ]]; do printf "\r I'll will find you <-%2d -> It's a matter of time" ${temp_cnt};sleep 1;((temp_cnt--));done;echo ""
wait_time=$TIME
temp_cnt=${wait_time}
while [[ ${temp_cnt} -gt 0 ]]; do
printf "\r I'll will find you <-%2d -> It's a matter of time" ${temp_cnt}
sleep 1
((temp_cnt--))
done;
echo ""
}

emagnet() {
Expand All @@ -63,7 +90,12 @@ source .scripts/emagnet-mirror.sh;mirrorwww
}

stopwhenfound() {
for (( ; ; )); do clear;banner;countdown;clear;banner;echo " Gathering Data.";sleep 1;echo " Please Wait";clear;banner;emagnet;sleep 2;done;emagnet
for (( ; ; )); do
clear;banner;countdown;clear;banner
echo " Gathering Data.";
sleep 1
echo " Please Wait"
clear;banner;emagnet;sleep 2;done;emagnet
}

clonegit() {
Expand All @@ -74,15 +106,15 @@ if [[ -z $1 ]]; then help; exit 0; fi

while getopts ":bcfmnehHpsvu" getopt; do
case $getopt in
b) bash .scripts/emagnet-backup.sh ;;
b) bash $(pwd)/.scripts/emagnet-backup.sh ;;
c) clonegit ;;
e) stopwhenfound ;;
f) bash /var/git/emagnet/.scripts/emagnet-f.sh ;;
n) checknetcat; nc nr1.nu 81 ;;
H) bash /var/git/emagnet/.scripts/emagnet-h.sh & ;;
m) mirrorwww ;;
h) help ;;
p) banner; bash $(dirname -- "$0")/.scripts/emagnet-ping.sh ;;
u) bash $(dirname -- "$0")/.scripts/emagnet-upordown.sh ;;
s) spider ;;
v) banner; printf " Emagnet Version: $VERSION\n\n" ;;
\?) echo "No such option, try ./emagnet -h" ;;
Expand Down

0 comments on commit a7254fe

Please sign in to comment.