-
Notifications
You must be signed in to change notification settings - Fork 0
/
gvsnap.py
44 lines (18 loc) · 801 Bytes
/
gvsnap.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
#!/usr/bin/python
import os,commands,cgi,cgitb
cgitb.enable()
print "content-type:text/html"
print ""
x=cgi.FieldStorage()
day=x.getvalue('dy')
commands.getstatusoutput("sudo touch /"+day+".py")
commands.getstatusoutput("sudo chmod 777 /"+day+".py")
f=open('/'+day+'.py', 'w')
f.write("#!/usr/bin/python")
f.write("\nimport os,commands")
f.write("\ncommands.getstatusoutput(\'mkdir /media/"+day+"\')")
f.write("\ncommands.getstatusoutput(\'mount 192.168.122.41:/media/"+day+" /media/"+day+"\')")
f.close()
awq=commands.getstatusoutput("sudo tar -cvf " + day+".tar /"+day+".py")
bzs=commands.getstatusoutput("sudo mv " + day+".tar /var/www/html/")
print "<META HTTP-EQUIV=refresh CONTENT=\"0;URL=http://192.168.122.41/"+day+".tar\">\n"