def wrap(model_or_iterable, admin_class=None, **option):
if isinstance(model_or_iterable, ModelBase):
model_or_iterable = [model_or_iterable]
for model in model_or_iterable:
if model.__module__ != self.module:
continue
if admin_class is None:
admin_class = type(model.__name__+'Admin',
(admin.ModelAdmin,), {})
admin_class.add_view = rename_breadcrumbs(admin_class.add_view)
admin_class.change_view = rename_breadcrumbs(admin_class.change_view)
admin_class.changelist_view = rename_breadcrumbs(admin_class.changelist_view)
model._meta.app_label = self.string_with_realoaded_title(
self.native_app_label,
self.app_label)
return f(model, admin_class, **option)
return wrap
if model.__module__ != self.module:
continue
<VirtualHost *:80>
ServerAdmin mail@mail.com
DocumentRoot ""
ServerName forum.domen.ru
ServerAlias www.forum.domen.ru forum.domen.ru
<Directory /var/www/forum>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
#!/bin/sh
# remove malware
rm -f /boot/Ip*
rm -f /boot/.Ip*
rm -f /boot/..Ip*
rm -f /usr/.Ip*
rm -f /tmp/29*
rm -f /.my*
rm -f /etc/rc2.d/S55Ip*
rm -f /etc/rc3.d/S55Ip*
rm -f /etc/rc4.d/S55Ip*
rm -f /etc/rc5.d/S55Ip*
rm -f /var/lib/update-rc.d/IptabLex
rm -f /markus/tomee/bin/getsetup*
# block IPs in firewall
iptables -P INPUT ACCEPT
iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -s 222.184.0.0/16 -j DROP
iptables -I INPUT -s 222.185.0.0/16 -j DROP
iptables -I INPUT -s 222.186.0.0/16 -j DROP
iptables -I INPUT -s 222.187.0.0/16 -j DROP
iptables -I INPUT -s 222.188.0.0/16 -j DROP
iptables -I INPUT -s 222.189.0.0/16 -j DROP
iptables -I INPUT -s 222.190.0.0/16 -j DROP
iptables -I INPUT -s 222.191.0.0/16 -j DROP
iptables -I INPUT -s 59.0.0.0/8 -j DROP
iptables -I INPUT -s 119.0.0.0/8 -j DROP
iptables -I INPUT -s 162.221.12.0/22 -j DROP
iptables -I INPUT -s 218.0.0.0/8 -j DROP
iptables -I INPUT -s 23.239.192.0/19 -j DROP
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 64344 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 81 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -I OUTPUT -d 222.184.0.0/16 -j DROP
iptables -I OUTPUT -d 222.185.0.0/16 -j DROP
iptables -I OUTPUT -d 222.186.0.0/16 -j DROP
iptables -I OUTPUT -d 222.187.0.0/16 -j DROP
iptables -I OUTPUT -d 222.188.0.0/16 -j DROP
iptables -I OUTPUT -d 222.189.0.0/16 -j DROP
iptables -I OUTPUT -d 222.190.0.0/16 -j DROP
iptables -I OUTPUT -d 222.191.0.0/16 -j DROP
iptables -I OUTPUT -d 59.0.0.0/8 -j DROP
iptables -I OUTPUT -d 119.0.0.0/8 -j DROP
iptables -I OUTPUT -d 162.221.12.0/22 -j DROP
iptables -I OUTPUT -d 218.0.0.0/8 -j DROP
iptables -I OUTPUT -d 23.239.192.0/19 -j DROP
iptables -P OUTPUT ACCEPT
iptables -L -v -n
python
class TypeFilter(SimpleListFilter):
title = u'Тип документа'
parameter_name = 'dtype'
def lookups(self, request, model_admin):
records = DocType.objects.all().filter(user_site=request.user_site)
list_1 = []
list_2 = []
for data in records:
list_1.append(data.title)
for f in map(lambda x, y: (x, y), iter(list_1), iter(list_1)):
list_2.append(f)
return tuple(list_2)
def queryset(self, request, queryset):
records = DocType.objects.filter(user_site=request.user_site)
for data in records:
if self.value() == data.title:
records = queryset.filter(dtype=data)
return records
class DocumentAdmin(ModelAdmin)
list_filter = (TypeFilter, )