-
Notifications
You must be signed in to change notification settings - Fork 0
/
webscreen.py
50 lines (39 loc) · 1.11 KB
/
webscreen.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
import sys
import os
import subprocess
from os import walk
def CreateHtml(files, folder):
f = open( folder + '/webscreen.html','w')
start = """<html><head></head><body>"""
end ="""</body></html>"""
message =""""""
for img in files:
url = FormatUrl(img)
message += """<a href='""" + url +"""' target='_blank'> <img src='""" + img + """' height="300" width="300"/></a>"""
print "added %s" %img
f.write(start)
f.write(message)
f.write(end)
f.close()
def FormatUrl(file):
file = file.replace('http_', 'http://')
file = file.replace('https_', 'https://')
file = file.replace('_80.png', '')
file = file.replace('_443.png', '')
return file
def GetFiles(folder):
f = []
for (dirpath, dirnames, filenames) in walk(folder):
f.extend(filenames)
break
return f
def main():
if len(sys.argv) != 2:
print ('[+] usage: <folder>')
sys.exit(-1)
folder = sys.argv[1]
files =GetFiles(folder)
CreateHtml(files,folder)
print ('[+] Task finished')
if __name__ == "__main__":
main()