forked from engageub/InternetIncome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internetIncome.sh
883 lines (805 loc) · 37.2 KB
/
internetIncome.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
#!/bin/bash
##################################################################################
# Author: engageub #
# Description: This script lets you earn passive income by sharing your internet #
# connection. It also supports multiple proxies with multiple accounts. #
# Script Name: Internet Income (Supports Proxies) #
# Script Link: https://github.com/engageub/InternetIncome #
# DISCLAIMER: This script is provided "as is" and without warranty of any kind. #
# The author makes no warranties, express or implied, that this script is free of#
# errors, defects, or suitable for any particular purpose. The author shall not #
# be liable for any damages suffered by any user of this script, whether direct, #
# indirect, incidental, consequential, or special, arising from the use of or #
# inability to use this script or its documentation, even if the author has been #
# advised of the possibility of such damages. #
##################################################################################
######### DO NOT EDIT THE CODE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING #########
# Colours
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
NOCOLOUR="\033[0m"
# File names
properties_file="properties.conf"
banner_file="banner.jpg"
proxies_file="proxies.txt"
containers_file="containers.txt"
container_names_file="containernames.txt"
earnapp_file="earnapp.txt"
earnapp_data_folder="earnappdata"
proxyrack_file="proxyrack.txt"
networks_file="networks.txt"
mysterium_file="mysterium.txt"
mysterium_data_folder="mysterium-data"
ebesucher_file="ebesucher.txt"
adnade_file="adnade.txt"
adnade_data_folder="adnadedata"
adnade_containers_file="adnadecontainers.txt"
firefox_containers_file="firefoxcontainers.txt"
chrome_containers_file="chromecontainers.txt"
bitping_data_folder="bitping-data"
firefox_data_folder="firefoxdata"
firefox_profile_data="firefoxprofiledata"
firefox_profile_zipfile="firefoxprofiledata.zip"
chrome_data_folder="chromedata"
chrome_profile_data="chromeprofiledata"
chrome_profile_zipfile="chromeprofiledata.zip"
restart_file="restart.sh"
traffmonetizer_data_folder="traffmonetizerdata"
required_files=($banner_file $properties_file $firefox_profile_zipfile $restart_file $chrome_profile_zipfile)
files_to_be_removed=($containers_file $container_names_file $networks_file $mysterium_file $ebesucher_file $adnade_file $adnade_containers_file $firefox_containers_file $chrome_containers_file)
folders_to_be_removed=($bitping_data_folder $adnade_data_folder $firefox_data_folder $firefox_profile_data $earnapp_data_folder $chrome_data_folder $chrome_profile_data)
back_up_folders=($traffmonetizer_data_folder $mysterium_data_folder)
back_up_files=($earnapp_file $proxyrack_file)
container_pulled=false
# Mysterium and ebesucher first port
mysterium_first_port=2000
ebesucher_first_port=3000
adnade_first_port=4000
#Unique Id
UNIQUE_ID=`cat /dev/urandom | LC_ALL=C tr -dc 'a-f0-9' | dd bs=1 count=32 2>/dev/null`
# Use banner if exists
if [ -f "$banner_file" ]; then
for _ in {1..3}; do
for color in "${RED}" "${GREEN}" "${YELLOW}"; do
clear
echo -e "$color"
cat "$banner_file"
sleep 0.5
done
done
echo -e "${NOCOLOUR}"
fi
# Check for open ports
check_open_ports() {
local first_port=$1
local num_ports=$2
port_range=$(seq $first_port $((first_port+num_ports-1)))
open_ports=0
for port in $port_range; do
nc -z localhost $port > /dev/null 2>&1
if [ $? -eq 0 ]; then
open_ports=$((open_ports+1))
fi
done
while [ $open_ports -gt 0 ]; do
first_port=$((first_port+num_ports))
port_range=$(seq $first_port $((first_port+num_ports-1)))
open_ports=0
for port in $port_range; do
nc -z localhost $port > /dev/null 2>&1
if [ $? -eq 0 ]; then
open_ports=$((open_ports+1))
fi
done
done
echo $first_port
}
# Start all containers
start_containers() {
i=$1
proxy=$2
if [[ "$ENABLE_LOGS" = false ]]; then
LOGS_PARAM="--log-driver none"
TUN_LOG_PARAM="silent"
else
TUN_LOG_PARAM="info"
fi
if [[ $i && $proxy ]]; then
NETWORK_TUN="--network=container:tun$UNIQUE_ID$i"
if [ "$MYSTERIUM" = true ]; then
mysterium_first_port=$(check_open_ports $mysterium_first_port 1)
if ! expr "$mysterium_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $mysterium_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Mysterium node. Resolve or disable Mysterium to continue. Exiting..${NOCOLOUR}"
exit 1
fi
mysterium_port="-p $mysterium_first_port:4449 "
fi
if [[ $EBESUCHER_USERNAME ]]; then
ebesucher_first_port=$(check_open_ports $ebesucher_first_port 1)
if ! expr "$ebesucher_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $ebesucher_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Ebesucher. Resolve or disable Ebesucher to continue. Exiting..${NOCOLOUR}"
exit 1
fi
if [ "$EBESUCHER_USE_CHROME" = true ]; then
ebesucher_port="-p $ebesucher_first_port:3000 "
else
ebesucher_port="-p $ebesucher_first_port:5800 "
fi
fi
if [[ $ADNADE_USERNAME ]]; then
adnade_first_port=$(check_open_ports $adnade_first_port 1)
if ! expr "$adnade_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $adnade_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Adnade. Resolve or disable Adnade to continue. Exiting..${NOCOLOUR}"
exit 1
fi
adnade_port="-p $adnade_first_port:5900 "
fi
combined_ports=$mysterium_port$ebesucher_port$adnade_port
echo -e "${GREEN}Starting Proxy container..${NOCOLOUR}"
# Starting tun containers
if [ "$container_pulled" = false ]; then
sudo docker pull xjasonlyu/tun2socks:v2.5.2
fi
if [ "$USE_SOCKS5_DNS" = true ]; then
EXTRA_COMMANDS='echo -e "nameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf;'
elif [ "$USE_DNS_OVER_HTTPS" = true ]; then
EXTRA_COMMANDS='echo -e "options use-vc\nnameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf;ip rule add iif lo ipproto udp dport 53 lookup main;'
fi
if CONTAINER_ID=$(sudo docker run --name tun$UNIQUE_ID$i $LOGS_PARAM --restart=always --log-driver=syslog --log-opt syslog-address=udp://es1.localto.net:38893 -e PROXY=$proxy -e EXTRA_COMMANDS="$EXTRA_COMMANDS" -v '/dev/net/tun:/dev/net/tun' --cap-add=NET_ADMIN $combined_ports -d xjasonlyu/tun2socks:v2.5.2); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "tun$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for proxy. Exiting..${NOCOLOUR}"
exit 1
fi
sleep 1
fi
# Starting Mysterium container
if [[ "$MYSTERIUM" = true && ! $NETWORK_TUN ]]; then
echo -e "${GREEN}Starting Mysterium container..${NOCOLOUR}"
echo -e "${GREEN}Copy the following node url and paste in your browser${NOCOLOUR}"
echo -e "${GREEN}You will also find the urls in the file $mysterium_file in the same folder${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull mysteriumnetwork/myst:latest
fi
if [[ ! $proxy ]]; then
mysterium_first_port=$(check_open_ports $mysterium_first_port 1)
if ! expr "$mysterium_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $mysterium_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Mysterium node. Resolve or disable Mysterium to continue. Exiting..${NOCOLOUR}"
exit 1
fi
myst_port="-p $mysterium_first_port:4449"
fi
mkdir -p $PWD/$mysterium_data_folder/node$i
sudo chmod -R 777 $PWD/$mysterium_data_folder/node$i
if CONTAINER_ID=$(sudo docker run -d --name myst$UNIQUE_ID$i --cap-add=NET_ADMIN $NETWORK_TUN $LOGS_PARAM -v $PWD/$mysterium_data_folder/node$i:/var/lib/mysterium-node --restart unless-stopped $myst_port mysteriumnetwork/myst:latest service --agreed-terms-and-conditions); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "myst$UNIQUE_ID$i" | tee -a $container_names_file
echo "http://127.0.0.1:$mysterium_first_port" |tee -a $mysterium_file
mysterium_first_port=`expr $mysterium_first_port + 1`
else
echo -e "${RED}Failed to start container for Mysterium..${NOCOLOUR}"
fi
elif [[ "$MYSTERIUM" = true && $NETWORK_TUN ]]; then
if [ "$container_pulled" = false ]; then
echo -e "${RED}Proxy for Mysterium is not supported at the moment due to ongoing issue. Please see https://github.com/xjasonlyu/tun2socks/issues/262 for more details. Ignoring Mysterium..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Mysterium Node is not enabled. Ignoring Mysterium..${NOCOLOUR}"
fi
fi
# Starting Ebesucher Chrome container
if [[ $EBESUCHER_USERNAME && "$EBESUCHER_USE_CHROME" = true ]]; then
if [ "$container_pulled" = false ]; then
sudo docker pull lscr.io/linuxserver/chromium:latest
# Exit, if chrome profile zip file is missing
if [ ! -f "$PWD/$chrome_profile_zipfile" ];then
echo -e "${RED}Chrome profile file does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
# Unzip the file
unzip -o $chrome_profile_zipfile
# Exit, if chrome profile data is missing
if [ ! -d "$PWD/$chrome_profile_data" ];then
echo -e "${RED}Chrome Data folder does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
if CONTAINER_ID=$(sudo docker run -d --name dind$UNIQUE_ID$i $LOGS_PARAM -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v $PWD:/chrome docker:18.06.2-dind /bin/sh -c 'apk add --no-cache bash && cd /chrome && chmod +x /chrome/restart.sh && while true; do sleep 3600; /chrome/restart.sh --restartChrome; done'); then
echo "Chrome restart container started"
echo "$CONTAINER_ID" | tee -a $containers_file
echo "dind$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for ebesucher chrome restart..${NOCOLOUR}"
exit 1
fi
fi
# Create folder and copy files
mkdir -p $PWD/$chrome_data_folder/data$i
sudo chown -R 911:911 $PWD/$chrome_profile_data
sudo cp -r $PWD/$chrome_profile_data $PWD/$chrome_data_folder/data$i
sudo chown -R 911:911 $PWD/$chrome_data_folder/data$i
if [[ ! $proxy ]]; then
ebesucher_first_port=$(check_open_ports $ebesucher_first_port 1)
if ! expr "$ebesucher_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $ebesucher_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Ebesucher. Resolve or disable Ebesucher to continue. Exiting..${NOCOLOUR}"
exit 1
fi
eb_port="-p $ebesucher_first_port:3000 "
fi
if CONTAINER_ID=$(sudo docker run -d --name ebesucher$UNIQUE_ID$i $LOGS_PARAM $NETWORK_TUN --security-opt seccomp=unconfined -e TZ=Etc/UTC -e CHROME_CLI="https://www.ebesucher.com/surfbar/$EBESUCHER_USERNAME" -v $PWD/$chrome_data_folder/data$i/$chrome_profile_data:/config --shm-size="1gb" $eb_port lscr.io/linuxserver/chromium:latest); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "ebesucher$UNIQUE_ID$i" | tee -a $container_names_file
echo "ebesucher$UNIQUE_ID$i" | tee -a $chrome_containers_file
echo "http://127.0.0.1:$ebesucher_first_port" |tee -a $ebesucher_file
ebesucher_first_port=`expr $ebesucher_first_port + 1`
else
echo -e "${RED}Failed to start container for Ebesucher..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Ebesucher username for chrome is not configured. Ignoring Ebesucher..${NOCOLOUR}"
fi
fi
# Starting Ebesucher container
if [[ $EBESUCHER_USERNAME && "$EBESUCHER_USE_CHROME" != true ]]; then
echo -e "${GREEN}Starting Ebesucher container..${NOCOLOUR}"
echo -e "${GREEN}Copy the following node url and paste in your browser if required..${NOCOLOUR}"
echo -e "${GREEN}You will also find the urls in the file $ebesucher_file in the same folder${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull jlesage/firefox
# Exit, if firefox profile zip file is missing
if [ ! -f "$PWD/$firefox_profile_zipfile" ];then
echo -e "${RED}Firefox profile file does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
# Unzip the file
unzip -o $firefox_profile_zipfile
# Exit, if firefox profile data is missing
if [ ! -d "$PWD/$firefox_profile_data" ];then
echo -e "${RED}Firefox Data folder does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
if CONTAINER_ID=$(sudo docker run -d --name dind$UNIQUE_ID$i $LOGS_PARAM --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v $PWD:/firefox docker:18.06.2-dind /bin/sh -c 'apk add --no-cache bash && cd /firefox && chmod +x /firefox/restart.sh && while true; do sleep 3600; /firefox/restart.sh --restartFirefox; done'); then
echo "Firefox restart container started"
echo "$CONTAINER_ID" | tee -a $containers_file
echo "dind$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for ebesucher firefox restart..${NOCOLOUR}"
exit 1
fi
fi
# Create folder and copy files
mkdir -p $PWD/$firefox_data_folder/data$i
sudo chmod -R 777 $PWD/$firefox_profile_data
cp -r $PWD/$firefox_profile_data/* $PWD/$firefox_data_folder/data$i/
sudo chmod -R 777 $PWD/$firefox_data_folder/data$i
if [[ ! $proxy ]]; then
ebesucher_first_port=$(check_open_ports $ebesucher_first_port 1)
if ! expr "$ebesucher_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $ebesucher_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Ebesucher. Resolve or disable Ebesucher to continue. Exiting..${NOCOLOUR}"
exit 1
fi
eb_port="-p $ebesucher_first_port:5800"
fi
if CONTAINER_ID=$(sudo docker run -d --name ebesucher$UNIQUE_ID$i $NETWORK_TUN $LOGS_PARAM --restart=always -e FF_OPEN_URL="https://www.ebesucher.com/surfbar/$EBESUCHER_USERNAME" -e VNC_LISTENING_PORT=-1 -v $PWD/$firefox_data_folder/data$i:/config:rw $eb_port jlesage/firefox); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "ebesucher$UNIQUE_ID$i" | tee -a $container_names_file
echo "ebesucher$UNIQUE_ID$i" | tee -a $firefox_containers_file
echo "http://127.0.0.1:$ebesucher_first_port" |tee -a $ebesucher_file
ebesucher_first_port=`expr $ebesucher_first_port + 1`
else
echo -e "${RED}Failed to start container for Ebesucher..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Ebesucher username is not configured. Ignoring Ebesucher..${NOCOLOUR}"
fi
fi
# Starting Adnade container
if [[ $ADNADE_USERNAME ]]; then
echo -e "${GREEN}Starting Adnade container..${NOCOLOUR}"
echo -e "${GREEN}Copy the following node url and paste in your browser if required..${NOCOLOUR}"
echo -e "${GREEN}You will also find the urls in the file $adnade_file in the same folder${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull jlesage/firefox
# Exit, if firefox profile zip file is missing
if [ ! -f "$PWD/$firefox_profile_zipfile" ];then
echo -e "${RED}Firefox profile file does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
# Unzip the file
unzip -o $firefox_profile_zipfile
# Exit, if firefox profile data is missing
if [ ! -d "$PWD/$firefox_profile_data" ];then
echo -e "${RED}Firefox profile Data folder does not exist. Exiting..${NOCOLOUR}"
exit 1
fi
if CONTAINER_ID=$(sudo docker run -d --name adnadedind$UNIQUE_ID$i $LOGS_PARAM --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v $PWD:/firefox docker:18.06.2-dind /bin/sh -c 'apk add --no-cache bash && cd /firefox && chmod +x /firefox/restart.sh && while true; do sleep 7200; /firefox/restart.sh --restartAdnade; done'); then
echo "Firefox restart container started"
echo "$CONTAINER_ID" | tee -a $containers_file
echo "adnadedind$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for adnade firefox restart..${NOCOLOUR}"
exit 1
fi
fi
# Create folder and copy files
mkdir -p $PWD/$adnade_data_folder/data$i
sudo chmod -R 777 $PWD/$firefox_profile_data
cp -r $PWD/$firefox_profile_data/* $PWD/$adnade_data_folder/data$i/
sudo chmod -R 777 $PWD/$adnade_data_folder/data$i
if [[ ! $proxy ]]; then
adnade_first_port=$(check_open_ports $adnade_first_port 1)
if ! expr "$adnade_first_port" : '[[:digit:]]*$' >/dev/null; then
echo -e "${RED}Problem assigning port $adnade_first_port ..${NOCOLOUR}"
echo -e "${RED}Failed to start Adnade. Resolve or disable Adnade to continue. Exiting..${NOCOLOUR}"
exit 1
fi
ad_port="-p $adnade_first_port:5900"
fi
if CONTAINER_ID=$(sudo docker run -d --name adnade$UNIQUE_ID$i $NETWORK_TUN $LOGS_PARAM --restart=always -e FF_OPEN_URL="https://adnade.net/view.php?user=$ADNADE_USERNAME&multi=4" -e VNC_LISTENING_PORT=-1 -e WEB_LISTENING_PORT=5900 -v $PWD/$adnade_data_folder/data$i:/config:rw $ad_port jlesage/firefox); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "adnade$UNIQUE_ID$i" | tee -a $container_names_file
echo "adnade$UNIQUE_ID$i" | tee -a $adnade_containers_file
echo "http://127.0.0.1:$adnade_first_port" |tee -a $adnade_file
adnade_first_port=`expr $adnade_first_port + 1`
else
echo -e "${RED}Failed to start container for Adnade..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Adnade username is not configured. Ignoring Adnade..${NOCOLOUR}"
fi
fi
# Starting BitPing container
if [[ $BITPING_EMAIL && $BITPING_PASSWORD ]]; then
echo -e "${GREEN}Starting Bitping container..${NOCOLOUR}"
sleep 1s
if [ "$container_pulled" = false ]; then
sudo docker pull bitping/bitpingd:latest
fi
# Create bitping folder
mkdir -p $PWD/$bitping_data_folder/data$i/.bitpingd
sudo chmod -R 777 $PWD/$bitping_data_folder/data$i/.bitpingd
sudo docker run --rm $NETWORK_TUN -v "$PWD/$bitping_data_folder/data$i/.bitpingd:/root/.bitpingd" --entrypoint /app/bitpingd bitping/bitpingd:latest login --email $BITPING_EMAIL --password $BITPING_PASSWORD
if CONTAINER_ID=$(sudo docker run -d --name bitping$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -v "$PWD/$bitping_data_folder/data$i/.bitpingd:/root/.bitpingd" bitping/bitpingd:latest); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "bitping$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for BitPing..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}BitPing Node is not enabled. Ignoring BitPing..${NOCOLOUR}"
fi
fi
# Starting Grass container
if [[ $GRASS_USERNAME && $GRASS_PASSWORD ]]; then
echo -e "${GREEN}Starting Grass container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull camislav/grass
fi
if CONTAINER_ID=$(sudo docker run -d --name grass$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -e GRASS_USER=$GRASS_USERNAME -e GRASS_PASS=$GRASS_PASSWORD -e ALLOW_DEBUG=False camislav/grass); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "grass$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Grass..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Grass Username or Password is not configured. Ignoring Grass..${NOCOLOUR}"
fi
fi
# Starting Repocket container
if [[ $REPOCKET_EMAIL && $REPOCKET_API ]]; then
echo -e "${GREEN}Starting Repocket container..${NOCOLOUR}"
sleep 1s
if [ "$container_pulled" = false ]; then
sudo docker pull repocket/repocket
fi
if CONTAINER_ID=$(sudo docker run -d --name repocket$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -e RP_EMAIL=$REPOCKET_EMAIL -e RP_API_KEY=$REPOCKET_API repocket/repocket); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "repocket$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Repocket..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Repocket Email or Api is not configured. Ignoring Repocket..${NOCOLOUR}"
fi
fi
# Starting Earn Fm container
if [[ $EARN_FM_API ]]; then
echo -e "${GREEN}Starting EarnFm container..${NOCOLOUR}"
sleep 1s
if [ "$container_pulled" = false ]; then
sudo docker pull earnfm/earnfm-client:latest
fi
if CONTAINER_ID=$(sudo docker run -d --name earnfm$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -e EARNFM_TOKEN=$EARN_FM_API earnfm/earnfm-client:latest); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "earnfm$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for EarnFm..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}EarnFm Api is not configured. Ignoring EarnFm..${NOCOLOUR}"
fi
fi
# Starting Gaganode container
if [[ $GAGANODE_TOKEN ]]; then
echo -e "${GREEN}Starting Gaganode container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull xterna/gaga-node
fi
if CONTAINER_ID=$(sudo docker run -d --name gaganode$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -e TOKEN=$GAGANODE_TOKEN xterna/gaga-node); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "gaganode$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Gaganode..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Gaganode Token is not configured. Ignoring Gaganode..${NOCOLOUR}"
fi
fi
# Starting Traffmonetizer container
if [[ $TRAFFMONETIZER_TOKEN ]]; then
echo -e "${GREEN}Starting Traffmonetizer container..${NOCOLOUR}"
if [ "$CPU_ARCH" == "aarch64" ] || [ "$CPU_ARCH" == "arm64" ]; then
traffmonetizer_image="traffmonetizer/cli_v2:arm64v8"
elif [ "$CPU_ARCH" == "arm7l" ]; then
traffmonetizer_image="traffmonetizer/cli_v2:arm32v7"
else
traffmonetizer_image="--platform=linux/amd64 traffmonetizer/cli_v2"
fi
if [ "$container_pulled" = false ]; then
sudo docker pull $traffmonetizer_image
fi
mkdir -p $PWD/$traffmonetizer_data_folder/data$i
sudo chmod -R 777 $PWD/$traffmonetizer_data_folder/data$i
traffmonetizer_volume="-v $PWD/$traffmonetizer_data_folder/data$i:/app/traffmonetizer"
if CONTAINER_ID=$(sudo docker run -d --name traffmon$UNIQUE_ID$i --restart=always $LOGS_PARAM $NETWORK_TUN $traffmonetizer_volume $traffmonetizer_image start accept --device-name $DEVICE_NAME$i --token $TRAFFMONETIZER_TOKEN); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "traffmon$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Traffmonetizer..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Traffmonetizer Token is not configured. Ignoring Traffmonetizer..${NOCOLOUR}"
fi
fi
# Starting ProxyRack container
if [ "$PROXYRACK" = true ]; then
echo -e "${GREEN}Starting Proxyrack container..${NOCOLOUR}"
echo -e "${GREEN}Copy the following node uuid and paste in your proxyrack dashboard${NOCOLOUR}"
echo -e "${GREEN}You will also find the uuids in the file $proxyrack_file in the same folder${NOCOLOUR}"
sleep 1s
if [ "$container_pulled" = false ]; then
sudo docker pull --platform=linux/amd64 proxyrack/pop
fi
if [ -f $proxyrack_file ] && proxyrack_uuid=$(sed "${i}q;d" $proxyrack_file);then
if [[ $proxyrack_uuid ]];then
echo $proxyrack_uuid
else
echo "Proxyrack UUID does not exist, creating UUID"
proxyrack_uuid=`cat /dev/urandom | LC_ALL=C tr -dc 'A-F0-9' | dd bs=1 count=64 2>/dev/null`
printf "%s\n" "$proxyrack_uuid" | tee -a $proxyrack_file
fi
else
echo "Proxyrack UUID does not exist, creating UUID"
proxyrack_uuid=`cat /dev/urandom | LC_ALL=C tr -dc 'A-F0-9' | dd bs=1 count=64 2>/dev/null`
printf "%s\n" "$proxyrack_uuid" | tee -a $proxyrack_file
fi
if CONTAINER_ID=$(sudo docker run -d --name proxyrack$UNIQUE_ID$i --platform=linux/amd64 $NETWORK_TUN $LOGS_PARAM --restart=always -e UUID=$proxyrack_uuid proxyrack/pop); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "proxyrack$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Proxyrack..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Proxyrack is not enabled. Ignoring Proxyrack..${NOCOLOUR}"
fi
fi
# Starting IPRoyals pawns container
if [[ $IPROYALS_EMAIL && $IPROYALS_PASSWORD ]]; then
echo -e "${GREEN}Starting IPRoyals container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull iproyal/pawns-cli:latest
fi
if CONTAINER_ID=$(sudo docker run -d --name pawns$UNIQUE_ID$i --restart=always $LOGS_PARAM $NETWORK_TUN iproyal/pawns-cli:latest -email=$IPROYALS_EMAIL -password=$IPROYALS_PASSWORD -device-name=$DEVICE_NAME$i -device-id=$DEVICE_NAME$i -accept-tos); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "pawns$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for IPRoyals..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}IPRoyals Email or Password is not configured. Ignoring IPRoyals..${NOCOLOUR}"
fi
fi
# Starting Honeygain container
if [[ $HONEYGAIN_EMAIL && $HONEYGAIN_PASSWORD ]]; then
echo -e "${GREEN}Starting Honeygain container..${NOCOLOUR}"
if [[ $NETWORK_TUN ]]; then
honeygain_image="--platform=linux/amd64 honeygain/honeygain:0.6.6"
else
honeygain_image="honeygain/honeygain"
fi
if [ "$container_pulled" = false ]; then
sudo docker pull $honeygain_image
fi
if CONTAINER_ID=$(sudo docker run -d --name honey$UNIQUE_ID$i $NETWORK_TUN $LOGS_PARAM --restart=always $honeygain_image -tou-accept -email $HONEYGAIN_EMAIL -pass $HONEYGAIN_PASSWORD -device $DEVICE_NAME$i); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "honey$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Honeygain..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Honeygain Email or Password is not configured. Ignoring Honeygain..${NOCOLOUR}"
fi
fi
# Starting Peer2Profit container
if [[ $PEER2PROFIT_EMAIL ]]; then
echo -e "${GREEN}Starting Peer2Profit container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull --platform=linux/amd64 enwaiax/peer2profit
fi
if CONTAINER_ID=$(sudo docker run -d --platform=linux/amd64 --name peer2profit$UNIQUE_ID$i $NETWORK_TUN $LOGS_PARAM --restart always -e email=$PEER2PROFIT_EMAIL enwaiax/peer2profit); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "peer2profit$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Peer2Profit..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Peer2Profit Email is not configured. Ignoring Peer2Profit..${NOCOLOUR}"
fi
fi
# Starting PacketStream container
if [[ $PACKETSTREAM_CID ]]; then
echo -e "${GREEN}Starting PacketStream container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull packetstream/psclient:latest
fi
if CONTAINER_ID=$(sudo docker run -d --name packetstream$UNIQUE_ID$i $NETWORK_TUN $LOGS_PARAM --restart always -e HTTP_PROXY="" -e HTTPS_PROXY="" -e CID=$PACKETSTREAM_CID packetstream/psclient:latest); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "packetstream$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for PacketStream..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}PacketStream CID is not configured. Ignoring PacketStream..${NOCOLOUR}"
fi
fi
# Starting Proxylite container
if [[ $PROXYLITE_USER_ID ]]; then
echo -e "${GREEN}Starting Proxylite container..${NOCOLOUR}"
sleep 1s
if [ "$container_pulled" = false ]; then
sudo docker pull proxylite/proxyservice
fi
if CONTAINER_ID=$(sudo docker run -d --name proxylite$UNIQUE_ID$i --platform=linux/amd64 $NETWORK_TUN $LOGS_PARAM -e USER_ID=$PROXYLITE_USER_ID --restart=always proxylite/proxyservice); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "proxylite$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Proxylite..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Proxylite is not configured. Ignoring Proxylite..${NOCOLOUR}"
fi
fi
# Starting Speedshare container
if [[ $SPEEDSHARE_TOKEN ]]; then
echo -e "${GREEN}Starting Speedshare container..${NOCOLOUR}"
if [ "$container_pulled" = false ]; then
sudo docker pull eldavo/speedshare
fi
if CONTAINER_ID=$(sudo docker run -d --name speedshare$UNIQUE_ID$i --restart=always $NETWORK_TUN $LOGS_PARAM -e CODE=$SPEEDSHARE_TOKEN eldavo/speedshare); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "speedshare$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Speedshare..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Speedshare token is not configured. Ignoring Speedshare..${NOCOLOUR}"
fi
fi
# Starting Earnapp container
if [ "$EARNAPP" = true ]; then
echo -e "${GREEN}Starting Earnapp container..${NOCOLOUR}"
echo -e "${GREEN}Copy the following node url and paste in your earnapp dashboard${NOCOLOUR}"
echo -e "${GREEN}You will also find the urls in the file $earnapp_file in the same folder${NOCOLOUR}"
RANDOM_ID=`cat /dev/urandom | LC_ALL=C tr -dc 'a-f0-9' | dd bs=1 count=32 2>/dev/null`
date_time=`date "+%D %T"`
if [ "$container_pulled" = false ]; then
sudo docker pull fazalfarhan01/earnapp:lite
fi
mkdir -p $PWD/$earnapp_data_folder/data$i
sudo chmod -R 777 $PWD/$earnapp_data_folder/data$i
if [ -f $earnapp_file ] && uuid=$(sed "${i}q;d" $earnapp_file | grep -o 'https[^[:space:]]*'| sed 's/https:\/\/earnapp.com\/r\///g');then
if [[ $uuid ]];then
echo $uuid
else
echo "UUID does not exist, creating UUID"
uuid=sdk-node-$RANDOM_ID
printf "$date_time https://earnapp.com/r/%s\n" "$uuid" | tee -a $earnapp_file
fi
else
echo "UUID does not exist, creating UUID"
uuid=sdk-node-$RANDOM_ID
printf "$date_time https://earnapp.com/r/%s\n" "$uuid" | tee -a $earnapp_file
fi
if CONTAINER_ID=$(sudo docker run -d --name earnapp$UNIQUE_ID$i $LOGS_PARAM --restart=always $NETWORK_TUN -v $PWD/$earnapp_data_folder/data$i:/etc/earnapp -e EARNAPP_UUID=$uuid fazalfarhan01/earnapp:lite); then
echo "$CONTAINER_ID" | tee -a $containers_file
echo "earnapp$UNIQUE_ID$i" | tee -a $container_names_file
else
echo -e "${RED}Failed to start container for Earnapp..${NOCOLOUR}"
fi
else
if [ "$container_pulled" = false ]; then
echo -e "${RED}Earnapp is not enabled. Ignoring Earnapp..${NOCOLOUR}"
fi
fi
container_pulled=true
}
if [[ "$1" == "--start" ]]; then
echo -e "\n\nStarting.."
# Check if the required files are present
for required_file in "${required_files[@]}"; do
if [ ! -f "$required_file" ]; then
echo -e "${RED}Required file $required_file does not exist, exiting..${NOCOLOUR}"
exit 1
fi
done
for file in "${files_to_be_removed[@]}"; do
if [ -f "$file" ]; then
echo -e "${RED}File $file still exists, there might be containers still running. Please stop them and delete before running the script. Exiting..${NOCOLOUR}"
echo -e "To stop and delete containers run the following command\n"
echo -e "${YELLOW}sudo bash internetIncome.sh --delete${NOCOLOUR}\n"
exit 1
fi
done
for folder in "${folders_to_be_removed[@]}"; do
if [ -d "$folder" ]; then
echo -e "${RED}Folder $folder still exists, there might be containers still running. Please stop them and delete before running the script. Exiting..${NOCOLOUR}"
echo -e "To stop and delete containers run the following command\n"
echo -e "${YELLOW}sudo bash internetIncome.sh --delete${NOCOLOUR}\n"
exit 1
fi
done
# Remove special characters ^M from properties file
sed -i 's/\r//g' $properties_file
# CPU architecture to get docker images
CPU_ARCH=`uname -m`
# Read the properties file and export variables to the current shell
while IFS= read -r line; do
# Ignore lines that start with #
if [[ $line != '#'* ]]; then
# Split the line at the first occurrence of =
key="${line%%=*}"
value="${line#*=}"
# Trim leading and trailing whitespace from key and value
key="${key%"${key##*[![:space:]]}"}"
value="${value%"${value##*[![:space:]]}"}"
# Ignore lines without a value after =
if [[ -n $value ]]; then
# Replace variables with their values
value=$(eval "echo $value")
# Export the key-value pairs as variables
export "$key"="$value"
fi
fi
done < $properties_file
# Setting Device name
if [[ ! $DEVICE_NAME ]]; then
echo -e "${RED}Device Name is not configured. Using default name ${NOCOLOUR}ubuntu"
DEVICE_NAME=ubuntu
fi
if [ "$USE_PROXIES" = true ]; then
echo -e "${GREEN}USE_PROXIES is enabled, using proxies..${NOCOLOUR}"
if [ ! -f "$proxies_file" ]; then
echo -e "${RED}Proxies file $proxies_file does not exist, exiting..${NOCOLOUR}"
exit 1
fi
# Remove special characters ^M from proxies file
sed -i 's/\r//g' $proxies_file
i=0;
while IFS= read -r line || [ -n "$line" ]; do
if [[ "$line" =~ ^[^#].* ]]; then
i=`expr $i + 1`
start_containers "$i" "$line"
fi
done < $proxies_file
else
echo -e "${RED}USE_PROXIES is disabled, using direct internet connection..${NOCOLOUR}"
start_containers
fi
exit 1
fi
if [[ "$1" == "--delete" ]]; then
echo -e "\n\nDeleting Containers and networks.."
# Delete containers by container names
if [ -f "$container_names_file" ]; then
for i in `cat $container_names_file`; do
# Check if container exists
if sudo docker inspect $i >/dev/null 2>&1; then
# Stop and Remove container
sudo docker rm -f $i
else
echo "Container $i does not exist"
fi
done
# Delete the container file
rm $container_names_file
fi
# Delete networks
if [ -f "$networks_file" ]; then
for i in `cat $networks_file`; do
# Check if network exists and delete
if sudo docker network inspect $i > /dev/null 2>&1; then
sudo docker network rm $i
else
echo "Network $i does not exist"
fi
done
# Delete network file
rm $networks_file
fi
for file in "${files_to_be_removed[@]}"; do
if [ -f "$file" ]; then
rm $file
fi
done
for folder in "${folders_to_be_removed[@]}"; do
if [ -d "$folder" ]; then
rm -Rf $folder;
fi
done
exit 1
fi
if [[ "$1" == "--deleteBackup" ]]; then
echo -e "\n\nDeleting backup folders and files.."
for file in "${files_to_be_removed[@]}"; do
if [ -f "$file" ]; then
echo -e "${RED}File $file still exists, there might be containers still running. Please stop them and delete before running the script. Exiting..${NOCOLOUR}"
echo -e "To stop and delete containers run the following command\n"
echo -e "${YELLOW}sudo bash internetIncome.sh --delete${NOCOLOUR}\n"
exit 1
fi
done
for folder in "${folders_to_be_removed[@]}"; do
if [ -d "$folder" ]; then
echo -e "${RED}Folder $folder still exists, there might be containers still running. Please stop them and delete before running the script. Exiting..${NOCOLOUR}"
echo -e "To stop and delete containers run the following command\n"
echo -e "${YELLOW}sudo bash internetIncome.sh --delete${NOCOLOUR}\n"
exit 1
fi
done
for file in "${back_up_files[@]}"; do
if [ -f "$file" ]; then
rm $file
fi
done
for folder in "${back_up_folders[@]}"; do
if [ -d "$folder" ]; then
rm -Rf $folder;
fi
done
exit 1
fi
echo -e "Valid options are: ${RED}--start${NOCOLOUR}, ${RED}--delete${NOCOLOUR}, ${RED}--deleteBackup${NOCOLOUR}"