-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathADSEditor.py
More file actions
306 lines (287 loc) · 12.6 KB
/
ADSEditor.py
File metadata and controls
306 lines (287 loc) · 12.6 KB
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
# Only for Windows 10 / 64 bits
############################################################################
#
# Alternative Data Stream [ Main Program ]
# © 2020 ABDULKADİR GÜNGÖR All Rights Reserved
# Contact email address: abdulkadir_gungor@outlook.com
#
# Developper: Abdulkadir GÜNGÖR (abdulkadir_gungor@outlook.com)
# Date: 09/2020
# All Rights Reserved (Tüm Hakları Saklıdır)
#
############################################################################
import os
from lib.system.win.ADS.filesZoneTransfer import showFilesZoneTransfer as showZone
from lib.system.win.ADS.filesZoneTransfer import writeFilesZoneTransfer as writeZone
from lib.system.win.ADS.filesZoneTransfer import delFilesZoneTransfer as delZone
from lib.system.win.ADS.dir import currentDirectory as curDir
from lib.system.win.ADS.AlternativeDataStream import AlternativeDataStream as ADS
# Ekranı Temizlemek için
def screenClear():
print("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n") # Konsol dışı kullanımda ekranı temizlemek için
# clear screen
# ********************
# Windows
if os.name=='nt':
os.system('cls')
# Linux or MAC
elif os.name=='posix':
os.system('clear')
# ********************
print("")
# Giriş Menüsü
def menu0() -> int:
while True:
screenClear()
print()
print('\t#####################################################')
print('\t#/*************************************************\#')
print('\t#**||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||**#')
print('\t#**|| ||**#')
print('\t#**|| (Alternative Data Stream) ||**#')
print('\t#**|| ADS Editor V1.4 ||**#')
print('\t#**|| 09/2020 ||**#')
print('\t#**|| ||**#')
print('\t#**|| Developer: Abdulkadir GÜNGÖR ||**#')
print('\t#**|| (abdulkadir_gungor@outlook.com) ||**#')
print('\t#**|| ||**#')
print('\t#**||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||**#')
print('\t#\*************************************************/#')
print('\t#####################################################')
print()
print()
print('\t MENU')
print('\t--------------------------------')
print('\t1) Zone Identifier')
print('\t2) Alternative Data Stream (ADS)')
print()
print()
print( '\tÇıkış (Exit) <<e>>' )
tmp=input('\tSeçim (Selection) : ')
if tmp.strip().lower() == 'e' :
exit(0)
elif tmp.strip().isdigit():
slc = int(tmp.strip())
if 0< slc <3:
return slc
#
def menu1():
path = ''
while True:
result, path = curDir(path)
if not result:
path = '<<Error>>'
screenClear()
print()
print('\tCurrent Directory: "' + path + '"' )
print()
print()
print('\t MENU')
print('\t--------------------------------')
print('\t1) Klasor yolunu değiştir. [Set path]')
print('\t2) Bilgileri göster. [Show info(s)]')
print('\t3) Bilgileri dosyaya kaydet. [Save info(s)]')
print('\t4) Bilgileri sil. [Delete info(s)]')
print()
print()
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
tmp = input('\tSeçim (Selection) : ')
#
if tmp.strip().lower() == 'e':
exit(0)
elif tmp.strip().lower() == 'b':
return
elif tmp.strip().isdigit():
slc = int(tmp.strip())
if slc == 1:
screenClear()
print()
print()
print('\tKlasor Yolu (Directory Path) : (Available) '+ path )
value = input('\tKlasor Yolu (Directory Path) : ')
if value.strip() != '':
path = value.strip()
elif slc == 2:
screenClear()
print()
showZone(path=path)
print()
print()
input('\tDevam (Continue) <<enter>>')
elif slc == 3:
screenClear()
print()
print()
file_name_tmp = input('\tDosya ismi (File name) : ')
if file_name_tmp.strip() != '':
file_name = path + '\\' + file_name_tmp
writeZone(writefilename=file_name, path=path)
print()
print()
print('\tDosyaya kaydedildi.(Save file)')
input('\tDevam (Continue) <<enter>>')
else:
print()
print()
print('\tDosyaya kaydedilemedi.(Couldn\'t save file)')
input('\tDevam (Continue) <<enter>>')
elif slc == 4:
screenClear()
print()
delZone(path=path)
print()
print()
input('\tDevam (Continue) <<enter>>')
def menu2():
ads_obj = ADS()
while True:
screenClear()
print()
print('\tCurrent Directory: "' + ads_obj.a1_currenDirectory + '"')
print()
print()
print('\t MENU')
print('\t--------------------------------')
print('\t1) Klasor yolunu değiştir. [Set path]')
print('\t2) ADS İşlemleri. [ADS Operations]')
print('\t3) Dosyayı ADS\'e kopyala. [Copy file to ADS]')
print('\t4) Güncelle! [Update]')
print()
print()
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
tmp = input('\tSeçim (Selection) : ')
#
if tmp.strip().lower() == 'e':
exit(0)
elif tmp.strip().lower() == 'b':
return
elif tmp.strip().isdigit():
slc = int(tmp.strip())
if 0 < slc < 5:
if slc == 1:
screenClear()
print()
print()
print('\tKlasor Yolu (Directory Path) : (Available) ' + ads_obj.a1_currenDirectory )
value = input('\tKlasor Yolu (Directory Path) : ')
if value.strip() != '':
ads_obj.update( new_path=value.strip() )
elif slc == 2:
while True:
screenClear()
print()
ads_obj.showADSFile()
print()
print()
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
tmp2 = input('\tSeçim (Selection) : ')
#
if tmp2.strip().lower() == 'e':
exit(0)
elif tmp2.strip().lower() == 'b' :
break
elif tmp2.strip().isdigit():
slc2 = int(tmp2.strip())
index2 = slc2 - 1
if -1 < index2 < len( ads_obj.a2_ads_files ):
file_obj = ads_obj.a2_ads_files[index2]
txt_tmp = '\t{} : {} \t\t ADS File: "{}"'.format( file_obj.r3_type, file_obj.r1_file, file_obj.r2_ads_data )
while True:
screenClear()
print()
print(txt_tmp)
print()
print()
print('\tSil (Delete) <<d>> , Kopyala (Copy) <<c>>')
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
print()
print()
tmp3 = input('\tSeçim (Selection) : ')
if tmp3.strip().lower() == 'e':
exit(0)
elif tmp3.strip().lower() == 'b':
break
elif tmp3.strip().lower() == 'd' :
print()
ads_obj.delADSFile(index=slc2)
print()
print()
input('\tDevam (Continue) <<enter>>')
break
elif tmp3.strip().lower() == 'c' :
while True:
screenClear()
print()
tmp4 = input('\tDosya adı (File name) : ')
if tmp4.strip() == '':
print()
print()
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
tmp7 = input('\tDevam (Continue) <<enter>>').strip()
if tmp7.lower() == 'e':
exit(0)
elif tmp7.lower() == 'b':
break
else:
print()
ads_obj.copyADSFile_To_Disk( index=slc2, filename=tmp4.strip() )
print()
print()
input('\tDevam (Continue) <<enter>>')
break
#
break
elif slc == 3:
while True:
screenClear()
print()
print('\tCurrent Directory: "' + ads_obj.a1_currenDirectory + '"')
print()
print()
copy_file = input('\tKopyalanacak dosya adı (Copy file name) : ').strip()
ads_file = input('\tADS dosya/klasor adı (ADS file/directory name) : ').strip()
ads_data = input('\tADS data adı (ADS data name) : ').strip()
if copy_file != '' and ads_file != '' and ads_data != '':
print()
ads_obj.copyDisk_To_ADSFile(DiskFile=copy_file, ADSFile=ads_file, ADSDataName=ads_data)
print()
print()
input('\tDevam (Continue) <<enter>>')
break
print()
print()
print('\tÇıkış (Exit) <<e>> , Geri (Back) <<b>>')
tmp5 = input('\tDevam (Continue) <<enter>>').strip()
if tmp5.lower() == 'e':
exit(0)
elif tmp5.lower() == 'b':
break
#
elif slc == 4:
screenClear()
print()
print('\tCurrent Directory: "' + ads_obj.a1_currenDirectory + '"')
print()
print()
print('\t...')
ads_obj.update()
print('\tADS içeriği güncellendi. (ADS content has updated!)')
print()
print()
print('\tÇıkış (Exit) <<e>> ')
tmp5 = input('\tGeri (Back) <<enter>>').strip()
if tmp5.lower() == 'e':
exit(0)
###
def main():
while True:
selection = menu0()
if selection == 1:
menu1()
elif selection == 2:
menu2()
###
###
main()
###
###