资源简介
GitStack_2.3.10破解方法
1、安装GitStack
2、license.pyc复制替换到%GitStack安装目录%\python\Lib\site-packages\django\middleware\
3、common.pyc和common.py复制替换到%GitStack安装目录%\app\gitstack\
4、重启GitStack服务
代码片段和文件信息
import hashlib
import re
import os
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.log import getLogger
logger = getLogger(‘django.request‘)
class CommonMiddleware(object):
“““
“Common“ middleware for taking care of some basic operations:
- Forbids access to User-Agents in settings.DISALLOWED_USER_AGENTS
- URL rewriting: based on the APPEND_SLASH and PREPEND_WWW settings
this middleware appends missing slashes and/or prepends missing
“www.“s.
- If APPEND_SLASH is set and the initial URL doesn‘t end with a
slash and it is not found in urlpatterns a new URL is formed by
appending a slash at the end. If this new URL is found in
urlpatterns then an HTTP-redirect is returned to this new URL;
otherwise the initial URL is processed as usual.
- ETags: If the USE_ETAGS setting is set ETags will be calculated from
the entire page content and Not Modified responses will be returned
appropriately.
“““
def process_request(self request):
“““
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
“““
# check that the models file has not been modified
# import os
# print os.path.getsize(“C:/dev/gitstack/app/gitstack/models.pyc“)
# print os.path.getsize(“C:/dev/gitstack/app/gitstack/license.pyc“)
‘‘‘model_size = os.path.getsize(settings.INSTALL_DIR + ‘/app/gitstack/models.pyc‘)
model_size_original = 29950L
# define the configuration
if not model_size == model_size_original:
return http.HttpResponseForbidden(‘Forbidden
‘)
license_size = os.path.getsize(settings.INSTALL_DIR + ‘/app/gitstack/license.pyc‘)
license_size_original = 4250L
# define the configuration
if not license_size == license_size_original:
return http.HttpResponseForbidden(‘Forbidden
‘)
‘‘‘
# Check for denied User-Agents
if ‘HTTP_USER_AGENT‘ in request.meta:
for user_agent_regex in settings.DISALLOWED_USER_AGENTS:
if user_agent_regex.search(request.meta[‘HTTP_USER_AGENT‘]):
logger.warning(‘Forbidden (User agent): %s‘ request.path
extra={
‘status_code‘: 403
‘request‘: request
}
)
return http.HttpResponseForbidden(‘Forbidden
‘)
# Check for a redirect based on settings.APPEND_SLASH
# and settings.PREPEND_WWW
host = request.get_host()
old_url = [host request.path]
new_url = old_url[:]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7689 2017-12-13 17:44 GitStack_2.3.10破解方法\common.py
文件 6176 2017-12-13 17:45 GitStack_2.3.10破解方法\common.pyc
文件 2882 2017-12-13 18:04 GitStack_2.3.10破解方法\license.pyc
文件 192 2017-12-13 18:11 GitStack_2.3.10破解方法\readme.txt
目录 0 2017-12-13 18:12 GitStack_2.3.10破解方法
----------- --------- ---------- ----- ----
16939 5
评论
共有 条评论