-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsharefile.sh
208 lines (170 loc) · 6.84 KB
/
sharefile.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
#!/bin/bash
clear
echo -e "\e[92m _____ __ ______ _ "
echo -e " / __(_) /__ / __/ / ___ _____(_)__ ___ _"
echo -e " / _// / / -_) _\ \/ _ \/ _ '/ __/ / _ \/ _ '/"
echo -e " /_/_/_/_/\__/ /___/_//_/\_,_/_/ /_/_//_/\_, /"
echo -e " /_ __/__ ______ _ (_)__ ___ _/ / /___/"
echo -e " / / / -_) __/ ' \/ / _ \/ _ '/ / \e[0m\e[91mCREATED BY: \e[0m "
echo -e "\e[92m /_/ \__/_/ /_/_/_/_/_//_/\_,_/_/ \e[0m\e[91m zeCh \e[0m "
echo -e "\n"
echo -e "\e[34m\"If you are too lazy to type a single command,"
echo -e " Allow my program to do it for you.\"\e[0m"
echo -e " -\e[90m(https://github.com/ZechBron)\e[0m"
echo -e "\n"
chooseApi () {
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mPlease Choose:\e[0m\e[34m"
echo -e " 1. BashUpload"
echo -e " 2. FilePush"
echo -e " 3. Transfer.sh"
read api
}
upload () {
if [ $api = 1 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --data-binary @$finFile.zip https://bashupload.com/$finFile.zip)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 2 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $finFile.zip https://filepush.co/upload/$finFile.zip)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 3 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $finFile.zip https://transfer.sh/$finFile.zip)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
else
echo -e "\e[31mWrong Input. Try again.\e[0m"
fi
}
# __START__
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mPlease Choose: \e[0m\e[34m"
echo " 1. Upload One File"
echo " 2. Upload Multiple Files"
echo " 3. Upload Directory and Contents"
read zCh
# Upload One File
if [ $zCh = 1 ]; then
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter a file:\e[0m\e[34m"
read file
echo -e " \e[0m\e[96mChecking file.."
# While file not exist
while [ ! -e $file ]
do
echo -e "\e[31mFile Does Not Exist. Try again.\e[0m\n"
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter a file:\e[0m\e[34m"
read file
echo -e " \e[0m\e[96mChecking file.."
done
echo -e " $file exist\e[0m"
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDo you want to add encryption? \e[0m\e[34m(y/n): "
read encrypt
# Encryption is On
if [ "$encrypt" = "y" ]; then
prompt=$(echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter Password: \e[0m\e[34m")
ccencrypt -b $file --prompt "$prompt"
echo -e " \e[0m\e[96mEncrypting Successful\e[0m"
chooseApi
if [ $api = 1 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --data-binary @$file.cpt https://bashupload.com/$file.cpt)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 2 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $file.cpt https://filepush.co/upload/$file.cpt)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 3 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $file.cpt https://transfer.sh/$file.cpt)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
else
echo -e "\e[31mWrong Input. Try again.\e[0m"
fi
# Encryprion is Off
elif [ "$encrypt" = "n" ]; then
chooseApi
if [ $api = 1 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --data-binary @$file https://bashupload.com/$file)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 2 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $file https://filepush.co/upload/$file)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
elif [ $api = 3 ]; then
echo -e "\n\e[0m\e[96mUploading..."
link=$(curl --upload-file $file https://transfer.sh/$file)
echo -e "\n\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDownload Link: \e[0m \e[94m$link\e[0m \n"
else
echo -e "\e[31mWrong input. Try again.\e[0m"
fi
else
echo -e "\e[31mInvalid input. Just type small letter y or n.\e[0m"
fi
# Upload Multiple Files
elif [ $zCh = 2 ]; then
while [ x$check != x$finFile.zip ]
do
echo -e "\e[31mNote: It is recommended to zip the files when uploading multiple files\e[0m"
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter a files:\e[0m\e[34m"
read files
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter new filename:\e[0m\e[34m"
read finFile
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDo you want to add encryption? \e[0m\e[34m(y/n): "
read encryption
# Enable Encryption
# y
if [ "$encryption" = "y" ]; then
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter Password: \e[0m\e[34m"
read pass
echo -e "\e[0m\e[96m"
zip -P $pass $finFile.zip $files
echo -e "\e[0m"
# n
elif [ "$encryption" = "n" ]; then
echo -e "\e[96m"
zip $finFile.zip $files
echo -e "\e[0m"
else
echo -e "\e[31mInvalid input. Just type small letter y or n.\e[0m"
fi
check=$(find $finFile.zip)
done
chooseApi
upload
# Upload Directory and Contents
elif [ $zCh = 3 ]; then
while [ x$check != x$finFile.zip ]
do
echo -e "\e[31mNote: It is recommended to zip the files when uploading whole directory and it's contents\e[0m"
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter a directory:\e[0m\e[34m"
read files
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter new filename:\e[0m\e[34m"
read finFile
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mDo you want to add encryption? \e[0m\e[34m(y/n): "
read encryption
# Enable Encryption
# y
if [ "$encryption" = "y" ]; then
echo -e "\e[31m[\e[0m\e[32mZ\e[0m\e[31m]\e[0m \e[32mEnter Password: \e[0m\e[34m"
read pass
echo -e "\e[0m\e[96m"
zip -P $pass -r $finFile.zip $files
echo -e "\e[0m"
# n
elif [ "$encryption" = "n" ]; then
echo -e "\e[0m\e[96m"
zip -r $finFile.zip $files
echo -e "\e[0m"
else
echo -e "\e[31mInvalid input. Just type small letter y or n.\e[0m"
fi
check=$(find $finFile.zip)
done
chooseApi
upload
# End Of zCh
else
clear
echo -e "\e[31mInvalid input. Try again.\e[0m"
bash sharefile.sh
fi