Skip to content

Instantly share code, notes, and snippets.

@ppdouble
Created May 24, 2023 15:44
Show Gist options
  • Save ppdouble/14609b1fb4709b083d89f31aaacfa4bd to your computer and use it in GitHub Desktop.
Save ppdouble/14609b1fb4709b083d89f31aaacfa4bd to your computer and use it in GitHub Desktop.
Download service using web.py
#!/usr/bin/env python
import web
urls = (
'/', 'index'
)
class index:
def GET(self):
dataParam = web.input()
web.header('Content-Disposition', 'attachment;filename=enroll.mobileconfig')
web.header('Content-transfer-encoding','binary')
web.header('Content-Type', 'application/xml-dtd')
print(dataParam.uid)
print("/etc/ios/" + dataParam.uid + "/enroll.mobileconfig")
try:
f=open("/etc/ios/" + dataParam.uid + "/enroll.mobileconfig", 'rb')
c = f.read()
return c
except:
return 'exception'
if __name__ == "__main__":
app = web.application(urls, globals())
web.httpserver.runsimple(app.wsgifunc(), ("0.0.0.0", 9999))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment