Anonim / 7 lat, 5 miesięcy temu | Download | Plaintext | Odpowiedz |

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

WYKOP_IP = "http://91.102.117.200" # s1.imgwykop.pl

class MyHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        zmienione_pliki = {"/js/core_build_no_210.js": './core.js',
                           "/js/comment_hide_build_no_210.js": './comment_hide.js',
                           }
        if self.path in zmienione_pliki.keys():
            print "Podstawiamy swój plik"
            self.send_response(200)
            self.send_header('Content-type', 'text/javascript')
            self.end_headers()
            f = open(zmienione_pliki[self.path])
            self.wfile.write(f.read())
            f.close()
        else:
            self.send_response(301)
            self.send_header('Location', WYKOP_IP+self.path)
            self.end_headers()
        return 
    
if __name__ == '__main__':
    try:
        server = HTTPServer(('', 80), MyHandler)
        server.serve_forever()
    except KeyboardInterrupt:
        print "wyłączamy"