from django shortcuts import render_to_response import string def inde

 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
32
33
34
35
36
37
38
39
40
41
from django.shortcuts import render_to_response
import string
def index(request):
none_text=u'Noooone'
meta={u'REMOTE_ADDR': none_text, #или адрес прокси сервера или реальный адрес
u'HTTP_USER_AGENT': none_text,
u'HTTP_FORWARDED': none_text,
u'HTTP_X_FORWARDED_FOR': none_text, #реальный IP адрес клиента
u'HTTP_CLIENT_IP': none_text,
u'REMOTE_HOST': none_text,
u'HTTP_ACCEPT_LANGUAGE': none_text,
u'HTTP_CONNECTION': none_text,
u'SERVER_PROTOCOL': none_text,
u'HTTP_REFERER': none_text,
u'HTTP_ACCEPT': none_text,
u'HTTP_CACHE_CONTROL': none_text,
u'HTTP_CACHE_INFO': none_text,
u'HTTP_VIA': none_text, #адрес прокси сервера
u'HTTP_XROXY_CONNECTION': none_text,
u'HTTP_PROXY_CONNECTION': none_text
}
for x in meta.keys():
if x in request.META.keys():
meta[x]=request.META[x]
template_vars={}
for x in meta.keys():
template_vars[x]=meta[x]
template_vars['ip']=meta[u'REMOTE_ADDR']
if meta[u'HTTP_X_FORWARDED_FOR']!=none_text and meta[u'HTTP_VIA']!=none_text and meta[u'HTTP_X_FORWARDED_FOR']==meta[u'REMOTE_ADDR']:
resume_message=u'Вы используете простые анонимные прокси (anonymous proxy).'
template_vars['ip']=meta[u'HTTP_VIA']
elif meta[u'HTTP_X_FORWARDED_FOR']!=none_text and meta[u'HTTP_VIA']!=none_text and meta[u'HTTP_X_FORWARDED_FOR']!=meta[u'REMOTE_ADDR']:
resume_message=u'Вы используете искажающие proxy (distorting proxy).'
template_vars['ip']=meta[u'HTTP_X_FORWARDED_FOR']
elif meta[u'HTTP_X_FORWARDED_FOR']==none_text and meta[u'HTTP_VIA']==none_text and meta[u'HTTP_PROXY_CONNECTION']==none_text:
resume_message=u'Вы используете элитные анонимные proxy (high anonymous / elite proxy) или вообще не используете прокси.'
template_vars['ip']=meta[u'REMOTE_ADDR']
template_vars['resume_message']=resume_message
template_vars['none_text']=none_text
return render_to_response("proxy/index.html", template_vars)