The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

24 satır
914 B

  1. from bubble_config import bubble_network, bubble_port
  2. from mitmproxy import ctx
  3. import requests
  4. HEADER_BUBBLE_MATCHERS='X-Bubble-Matchers'
  5. # todo: cache responses by remote_addr+host for a limited time (1 minute?)
  6. def bubble_matchers (remote_addr, flow, host):
  7. headers = {'X-Forwarded-For': remote_addr}
  8. try:
  9. data = {
  10. 'fqdn': host,
  11. 'uri': flow.request.path,
  12. 'userAgent': flow.request.headers['User-Agent'],
  13. 'remoteAddr': flow.client_conn.address[0]
  14. }
  15. response = requests.post('http://127.0.0.1:'+bubble_port+'/api/filter/matchers', headers=headers, data=data)
  16. if response.ok:
  17. return response.json()
  18. ctx.log.warn('bubble_matchers returned '+response.status_code+', returning empty matchers array')
  19. except Exception as e:
  20. ctx.log.warn('bubble_matchers API call failed: '+repr(e))
  21. return []