Skip to content

Instantly share code, notes, and snippets.

@dmgl
Last active September 11, 2019 12:20
Show Gist options
  • Select an option

  • Save dmgl/6f92c154ab93a7d9dd5ef5f5765e9498 to your computer and use it in GitHub Desktop.

Select an option

Save dmgl/6f92c154ab93a7d9dd5ef5f5765e9498 to your computer and use it in GitHub Desktop.

Revisions

  1. dmgl renamed this gist Sep 11, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions how_refferer_header_works.py → how_referer_header_works.py
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    #!/usr/bin/env python

    # save this file and run
    # save this file and run `python how_referer_header_works.py`
    # to stop you can use commnad `lsof -i tcp:9999` and kill pid

    # usage: make public post on any site with link http://0.0.0.0:9999 and click on it
    # usage: make public post on any site with hlink href http://0.0.0.0:9999 and click on it
    # or `curl 0.0.0.0:9999 --referer google.com -H "X-Something: Yeah-yeah-yeah"`

    # and see output of script with headers section (custom refferer)
    # see output of script with headers section (custom referer)


    import SimpleHTTPServer
  2. dmgl renamed this gist Sep 11, 2019. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions simple_server → how_refferer_header_works.py
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,21 @@
    # curl 0.0.0.0:9999 --referer google.com -H "X-Something: Yeah-yeah-yeah"
    #!/usr/bin/env python

    # save this file and run
    # to stop you can use commnad `lsof -i tcp:9999` and kill pid

    # usage: make public post on any site with link http://0.0.0.0:9999 and click on it
    # or `curl 0.0.0.0:9999 --referer google.com -H "X-Something: Yeah-yeah-yeah"`

    # and see output of script with headers section (custom refferer)

    #!/usr/bin/env python

    import SimpleHTTPServer
    import SocketServer
    import logging

    PORT = 9999


    class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):

    def do_GET(self):
  3. dmgl created this gist Nov 13, 2018.
    22 changes: 22 additions & 0 deletions simple_server
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # curl 0.0.0.0:9999 --referer google.com -H "X-Something: Yeah-yeah-yeah"


    #!/usr/bin/env python

    import SimpleHTTPServer
    import SocketServer
    import logging

    PORT = 9999

    class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):

    def do_GET(self):
    logging.error(self.headers)
    SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)


    Handler = GetHandler
    httpd = SocketServer.TCPServer(("", PORT), Handler)

    httpd.serve_forever()