icinga2 执行check_ipmi_sensor 报错


报错: ./check_ipmi_sensor Can't locate IPC/Run.pm in @INC (you may need to install the IPC::Run module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/shar

Read more

解决办法:datetime.datetime(2018, 10, 30, 14, 9, 0, 669000, tzinfo=tzlocal()) is not JSON serializable


import pymssql
import json



def conn():
    connect = pymssql.connect('192.168.28.38:1433', 'root', '123456', 'test')
    if connect:
        #print("sucessful")
        cur = connect.cursor(as_dict=True)  # 若as_dict为False 返回的是一个列表,而不是字典。
        sql = &qu

Read more

redis info 详解


1、client

connected_clients:2053  #当前客户端连接数
client_longest_output_list:0    #当前连接的客户端当中,最长的输出列表
client_biggest_input_buf:0      # 当前连接的客户端当中,最大输入缓存
blocked_clients:0               #被阻塞的客户端数

因为Redis是单线程模型(只能使用单核),来处理所有客户端的请求,且Redis默认允许客户端连接的最大数量是10000。若是看到连接数超过5000以上,那可能会影响Redis的性能。因此监控客户端连接数是非常重要的,因

Read more

常见的WEB攻击总结


1、cc攻击

CC(ChallengeCollapsar,挑战黑洞)攻击是DDoS攻击的一种类型,使用代理服务器向受害服务器发送大量貌似合法的请求。CC根据其工具命名,攻击者使用代理机制,利用众多广泛可用的免费代理服务器发动DDoS攻击。许多免费代理服务器支持匿名模式,这使追踪变得非常困难,也有的通过大量的肉鸡伪造合法请求进行攻击。 肉鸡CC攻击是黑客使用CC攻击软件,控制大量肉鸡,发动攻击,相比用代理的方式肉鸡更难防御。因为肉鸡可以模拟正常用户访问网站的请求。伪造成合法数据包。

  • 防范手段:
  1. 服务器垂直扩展和水平扩容
  2. 数据缓存(内存级别,不要用文件)
  3. 页面静态化
  4. IP限制
  5. 用户级别的调用

Read more

鉴黄接口


1、服务端安装

把雅虎的鉴黄模型下载到服务器

git clone https://github.com/yahoo/open_nsfw.git
# 如果clone比较慢,可以直接下载zip包也行

2、构建Caffe Docker映像(CPU)

docker build -t caffe:cpu https://raw.githubusercontent.com/BVLC/caffe/master/docker/cpu/Dockerfile

3、进行鉴黄

cd open_nsfw
docker run --volume=$(pwd):/workspace caffe:cpu \
python

Read more

django rest framework 安装与使用


1、安装

pip install djangorestframework
pip install markdown       # Markdown support for the browsable API.
pip install django-filter

2、 添加rest_framework 到settings

INSTALLED_APPS = [
    ...
    'rest_framework',
]

3、样例

from django.contrib import admin
from django.urls import path, include
f

Read more