-
Notifications
You must be signed in to change notification settings - Fork 1
/
4fileuploader.py
231 lines (202 loc) · 8.93 KB
/
4fileuploader.py
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
import requests,json,os
path = os.getcwd()
extend = os.sep
merge = path + extend
filename = "info.json"
# Servis kontrolleri
bcvc = True
trlink = True
urlturk = True
# banner
def banner():
ban = """
█████▒▒█████ █ ██ ██▀███ ██░ ██ ▄▄▄ ▄████▄ ██ ▄█▀▓█████ ██▀███ ▒███████▒
▓██ ▒▒██▒ ██▒ ██ ▓██▒▓██ ▒ ██▒ ▓██░ ██▒▒████▄ ▒██▀ ▀█ ██▄█▒ ▓█ ▀ ▓██ ▒ ██▒▒ ▒ ▒ ▄▀░
▒████ ░▒██░ ██▒▓██ ▒██░▓██ ░▄█ ▒ ▒██▀▀██░▒██ ▀█▄ ▒▓█ ▄ ▓███▄░ ▒███ ▓██ ░▄█ ▒░ ▒ ▄▀▒░
░▓█▒ ░▒██ ██░▓▓█ ░██░▒██▀▀█▄ ░▓█ ░██ ░██▄▄▄▄██ ▒▓▓▄ ▄██▒▓██ █▄ ▒▓█ ▄ ▒██▀▀█▄ ▄▀▒ ░
░▒█░ ░ ████▓▒░▒▒█████▓ ░██▓ ▒██▒ ░▓█▒░██▓ ▓█ ▓██▒▒ ▓███▀ ░▒██▒ █▄░▒████▒░██▓ ▒██▒▒███████▒
▒ ░ ░ ▒░▒░▒░ ░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ▒ ░░▒░▒ ▒▒ ▓▒█░░ ░▒ ▒ ░▒ ▒▒ ▓▒░░ ▒░ ░░ ▒▓ ░▒▓░░▒▒ ▓░▒░▒
░ ░ ▒ ▒░ ░░▒░ ░ ░ ░▒ ░ ▒░ ▒ ░▒░ ░ ▒ ▒▒ ░ ░ ▒ ░ ░▒ ▒░ ░ ░ ░ ░▒ ░ ▒░░░▒ ▒ ░ ▒
░ ░ ░ ░ ░ ▒ ░░░ ░ ░ ░░ ░ ░ ░░ ░ ░ ▒ ░ ░ ░░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░
@@@ @@@ @@@@@@@ @@@@@@ @@@@@@@
@@@@ @@@ @@@@@@@@ @@@@@@@ @@@@@@@@
@@!@! @@! @@! @@@ @@@ @@! @@@
!@!!@! !@! !@! @!@ @!@ !@! @!@
@!! @!! @!! @!@@!@! @!@!!@ @!@!!@!
!!! !@! !!! !!@!!! !!@!@! !!@!@!
:!!:!:!!: !!: !!: !!: !!: :!!
!:::!!::: :!: :!: :!: :!: !:!
::: :: :::: :: :: :::: :: :::
::: : :: : : : : : : : : :
"""
return ban
# info.json kontrolü
print(banner())
try:
with open(filename, "r", encoding="utf-8") as bilgiler:
info = bilgiler.read()
except:
pass
def writeInfo(username, password, token, group_guid):
newu = '"'+username+'"'
newp = '"'+password+'"'
newt = '"'+token+'"'
newg = '"'+group_guid+'"'
icerik = """
{
"username": """+newu+""",
"password": """+newp+""",
"token": """+newt+""",
"group_guid": """+newg+"""
}
"""
with open(filename, "w", encoding="utf-8") as file1:
file1.write(icerik)
def getToken(username, password):
response_token = requests.post("https://api-ssl.bitly.com/oauth/access_token", auth=(username, password))
if(response_token.status_code == 200):
ttoken = response_token.content.decode()
print("[+] Token: "+ttoken)
else:
print(f"[!] Token alınamadı ! Detaylar:\nStatus Code: {response_token.status_code}\nResponse: {response_token.text}")
try:
return ttoken
except:
return False
def getGuid(token):
headers = {"Authorization": f"Bearer {token}"}
groups_res = requests.get("https://api-ssl.bitly.com/v4/groups", headers=headers)
if groups_res.status_code == 200:
groups_data = groups_res.json()['groups'][0]
guid = groups_data['guid']
print("[+] Group Guid: "+guid)
else:
print(f"[!] Group Guid alınamadı ! Detaylar:\nStatus Code: {groups_res.status_code}\nResponse: {groups_res.text}")
try:
return guid
except:
return False
def checkInfoFile(file):
global bitlytoken,bitlyguid
if os.path.exists(merge+file):
print(f"[+] {file} bulundu !")
bitly = json.loads(info)
bitlytoken = bitly["token"]
bitlyguid = bitly["group_guid"]
else:
print(f"[!] {file} bulunamadı !")
user = input("Bit.ly kullanıcı adı: ")
pwd = input("Bit.ly parola: ")
token = getToken(username=user,password=pwd)
guid = getGuid(token=token)
writeInfo(username=user,password=pwd,token=token,group_guid=guid)
with open(filename, "r", encoding="utf-8") as bilgiler:
info1 = bilgiler.read()
bitlyverileri = json.loads(info1)
bitlytoken = bitlyverileri["token"]
bitlyguid = bitlyverileri["group_guid"]
checkInfoFile(file=filename)
dosya = input("Dosya: ")
files = {
'file': (str(dosya), open(str(dosya), 'r',encoding="utf-8")),
}
headers = {"Authorization": f"Bearer {bitlytoken}"}
print(f"{dosya} dosyası upload ediliyor...")
# Dosyayı uplaod etme
response = requests.post('https://api.anonfiles.com/upload', files=files)
# Gelen değeri JSON a dönüştürüp ayıklama işlemi
veriler = json.loads(response.text)
status = veriler["status"]
filename = veriler["data"]["file"]["metadata"]["name"]
full = veriler["data"]["file"]["url"]["full"]
short = veriler["data"]["file"]["url"]["short"]
size = veriler["data"]["file"]["metadata"]["size"]["bytes"]
# other.json daki verileri işleme
try:
with open("other.json", "r", encoding="utf-8") as other:
icerik = other.read()
otherjson = json.loads(icerik)
except FileNotFoundError:
print("[!] other.json bulunamadı !")
try:
bcvcapi = otherjson["bcvc"]
bcvcuid = otherjson["bcvcuid"]
except:
print("[!] Bc.vc API bulunamadı !")
bcvc = False
try:
trlinkapi = otherjson["trlink"]
except:
print("[!] Tr.link API bulunamadı !")
trlink = False
try:
urlturkapi = otherjson["urlturk"]
except:
print("[!] Urlturk API bulunamadı !")
urlturk = False
# Kısaltılabilir linkler
if bcvc == True:
bcvcshortablelink = f"https://bc.vc/api.php?key={bcvcapi}&uid={bcvcuid}&url=" + short
else:
pass
if trlink == True:
trlinkshortablelink = f"https://ay.link/api/?api={trlinkapi}&url={short}&ct=1"
else:
pass
if urlturk == True:
urlturkshortablelink = f" https://urlturk.com/api?api={urlturkapi}&url={short}"
pass
# bc.vc kısaltma isteği
if bcvc == True:
r = requests.get(url=bcvcshortablelink)
else:
pass
# tr.link kısaltma isteği ve verileri ayıklama
if trlink == True:
trlinkresponse = requests.get(url=trlinkshortablelink)
trlink1 = json.loads(trlinkresponse.text)
else:
pass
# bitly
bitlyshortablelink = requests.post("https://api-ssl.bitly.com/v4/shorten", json={"group_guid": bitlyguid, "long_url": short}, headers=headers)
bitlylink = bitlyshortablelink.json().get("link")
# urlturk
if urlturk == True:
urlturk_res = requests.get(url=urlturkshortablelink)
else:
pass
# Sonucu ekrana bastırma
if str(status).lower() != "true":
print("Upload başarısız!")
print(f"Detaylar:\n{veriler}")
else:
print("Upload başarılı!")
print(f"{status}")
print(f"Dosya adı: {filename}")
print(f"Full link: {full}")
print(f"Kısaltılmış link: {short}")
print(f"Dosya boyutu {size} bytes")
print("*******************************************")
if bcvc == True:
print(f"Bc.vc kısaltılmış link: {r.text}")
else:
print("Bc.vc seçilmedi !")
print(f"Bit.ly kısaltılmış link: {bitlylink}")
if urlturk == True:
if str(urlturk_res.json()["status"]).lower() == "success":
urll = urlturk_res.json().get("shortenedUrl")
print("Urlturk kısaltılmış link: " + str(urll).replace('\\', ''))
else:
print("Urlturk link kısaltılamadı ! Detaylar:\n" + urlturk_res.json()["status"] + " " + urlturk_res.json()[
"message"])
else:
print("Urlturk seçilmedi !")
if trlink == True:
if str(trlink1["status"]).lower() == "success":
print("Tr.link (ay.link) kısaltılmış link: " + str(trlink1['shortenedUrl']).replace('\\', ''))
else:
print("Tr.link (ay.link) link kısaltılamadı ! Detaylar:\n" + trlink1["status"] + " " + trlink1["message"])
else:
print("Trlink seçilmedi !")