1. 程式人生 > >zooker未授權訪問指令碼

zooker未授權訪問指令碼

# coding=utf-8
import socket
 
 
def get_plugin_info():
    plugin_info = {
        "name": "Zookeeper未授權訪問",
        "info": "Zookeeper Unauthorized access",
        "level": "中危",
        "type": "未授權訪問"
        "keyword": "server:Zookeeper",
        "source": 1
    }
    return plugin_info
 
 
def check(ip, port, timeout):
    try:
        socket.setdefaulttimeout(timeout)
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((ip, int(port)))
        flag = "envi"
        s.send(flag)
        data = s.recv(1024)
        s.close()
        if 'Environment' in data:
            return u"Zookeeper Unauthorized access"
    except:
        pass
 
 
def main():
    ip = "xxxx"
    print check(ip, 2181, 2)
 
if __name__ == '__main__':
    main()