331 lines
17 KiB
Python
331 lines
17 KiB
Python
import UserDict
|
|
from UserDict import DictMixin
|
|
from UserList import UserList
|
|
from _strptime import TimeRE
|
|
import abc
|
|
import argparse
|
|
import ast
|
|
import atexit
|
|
import base64
|
|
from base64 import b64decode, b64encode
|
|
import binascii
|
|
from binascii import hexlify, unhexlify
|
|
import bisect
|
|
import bootstrap
|
|
import bz2
|
|
import cProfile
|
|
import cgi
|
|
import collections
|
|
from collections import defaultdict, deque, namedtuple
|
|
import commands
|
|
import contextlib
|
|
from contextlib import closing, contextmanager, nested
|
|
import copy
|
|
import csv
|
|
import ctypes
|
|
from ctypes import CDLL
|
|
import datetime
|
|
import decimal
|
|
from decimal import Decimal
|
|
import decorator
|
|
import difflib
|
|
from difflib import SequenceMatcher, context_diff
|
|
import dis
|
|
import email
|
|
from email import encoders
|
|
from email.encoders import encode_base64
|
|
from email.message import Message
|
|
from email.mime.audio import MIMEAudio
|
|
from email.utils import COMMASPACE, formatdate
|
|
import errno
|
|
from errno import (E2BIG, EACCES, EADDRINUSE,
|
|
EADDRNOTAVAIL, EAFNOSUPPORT, EAGAIN,
|
|
EALREADY, EBADF, EBADMSG, EBUSY,
|
|
ECHILD, ECONNABORTED, ECONNREFUSED,
|
|
ECONNRESET, EDEADLK, EDESTADDRREQ,
|
|
EDOM, EDQUOT, EEXIST, EFAULT, EFBIG,
|
|
EHOSTDOWN, EHOSTUNREACH, EIDRM, EILSEQ,
|
|
EINPROGRESS, EINTR, EINVAL, EIO,
|
|
EISCONN, EISDIR, ELOOP, EMFILE, EMLINK,
|
|
EMSGSIZE, EMULTIHOP, ENAMETOOLONG,
|
|
ENETDOWN, ENETRESET, ENETUNREACH,
|
|
ENFILE, ENOBUFS, ENODATA, ENODEV,
|
|
ENOENT, ENOEXEC, ENOLCK, ENOLINK,
|
|
ENOMEM, ENOMSG, ENOPROTOOPT, ENOSPC,
|
|
ENOSR, ENOSTR, ENOSYS, ENOTBLK,
|
|
ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTSOCK,
|
|
ENOTSUP, ENOTTY, ENXIO, EOPNOTSUPP,
|
|
EOVERFLOW, EPERM, EPFNOSUPPORT, EPIPE,
|
|
EPROTO, EPROTONOSUPPORT, EPROTOTYPE,
|
|
ERANGE, EREMOTE, EROFS, ESHUTDOWN,
|
|
ESOCKTNOSUPPORT, ESPIPE, ESRCH, ESTALE,
|
|
ETIME, ETIMEDOUT, ETOOMANYREFS,
|
|
ETXTBSY, EUSERS, EWOULDBLOCK, EXDEV)
|
|
import exceptions
|
|
import fcntl
|
|
import filecmp
|
|
import fileinput
|
|
import functional
|
|
import functools
|
|
from functools import (partial, reduce, total_ordering,
|
|
update_wrapper, wraps)
|
|
import gc
|
|
import getpass
|
|
from getpass import getuser
|
|
import glob
|
|
import grp
|
|
from grp import getgrall, getgrgid, getgrnam
|
|
import gzip
|
|
import h5py
|
|
import hashlib
|
|
from hashlib import (md5, sha1, sha224, sha256, sha384,
|
|
sha512)
|
|
import heapq
|
|
import imp
|
|
import inspect
|
|
from inspect import ArgSpec, getargspec
|
|
import io
|
|
import itertools
|
|
from itertools import (chain, count, groupby, islice, product,
|
|
repeat, tee)
|
|
import json
|
|
from keyword import iskeyword
|
|
import linecache
|
|
import locale
|
|
import logging
|
|
from lxml import etree
|
|
import marshal
|
|
import math
|
|
import matplotlib
|
|
import mimetypes
|
|
import misc.double
|
|
import mmap
|
|
import new
|
|
import numbers
|
|
from numbers import (Complex, Integral, Number, Rational,
|
|
Real)
|
|
import operator
|
|
from operator import add, indexOf, itemgetter, mul
|
|
import optparse
|
|
from optparse import (BadOptionError, OptParseError,
|
|
OptionParser, OptionValueError)
|
|
import os
|
|
from os import (chmod, close, getcwd, getenv, geteuid,
|
|
getpid, getuid, makedirs, mkdir,
|
|
mkfifo, path, remove, rename, system,
|
|
unlink)
|
|
import os.path
|
|
from os.path import (abspath, basename, dirname, exists,
|
|
getsize, isfile, normpath, realpath)
|
|
import parser
|
|
import pdb
|
|
import pickle
|
|
from pickle import PickleError, UnpicklingError
|
|
import pickletools
|
|
import pkg_resources
|
|
from pkg_resources import load_entry_point
|
|
import pkgutil
|
|
import pprint
|
|
import psutil
|
|
import pwd
|
|
from pwd import getpwall, getpwnam, getpwuid
|
|
import random
|
|
from random import shuffle
|
|
import re
|
|
import resource
|
|
import select
|
|
import shlex
|
|
import shutil
|
|
from shutil import (copyfile, copyfileobj, copystat,
|
|
copytree, rmtree)
|
|
import signal
|
|
import six
|
|
from six import StringIO
|
|
from six.moves import (builtins, cPickle, configparser,
|
|
copyreg, email_mime_base,
|
|
email_mime_image, email_mime_multipart,
|
|
email_mime_text, http_client, map,
|
|
queue, zip)
|
|
from six.moves.urllib.parse import urlencode
|
|
from six.moves.urllib.request import urlopen
|
|
import smtplib
|
|
from smtplib import (SMTP, SMTPAuthenticationError,
|
|
SMTPConnectError, SMTPDataError,
|
|
SMTPException, SMTPHeloError,
|
|
SMTPRecipientsRefused,
|
|
SMTPResponseException,
|
|
SMTPSenderRefused,
|
|
SMTPServerDisconnected, SMTP_SSL)
|
|
import socket
|
|
from socket import (AF_APPLETALK, AF_ASH, AF_ATMPVC,
|
|
AF_ATMSVC, AF_AX25, AF_BRIDGE,
|
|
AF_DECnet, AF_ECONET, AF_INET,
|
|
AF_INET6, AF_IPX, AF_IRDA, AF_KEY,
|
|
AF_LLC, AF_NETBEUI, AF_NETLINK,
|
|
AF_NETROM, AF_PACKET, AF_PPPOX,
|
|
AF_ROSE, AF_ROUTE, AF_SECURITY, AF_SNA,
|
|
AF_TIPC, AF_UNIX, AF_UNSPEC,
|
|
AF_WANPIPE, AF_X25, AI_ADDRCONFIG,
|
|
AI_ALL, AI_CANONNAME, AI_NUMERICHOST,
|
|
AI_NUMERICSERV, AI_PASSIVE,
|
|
AI_V4MAPPED, CAPI, EAI_ADDRFAMILY,
|
|
EAI_AGAIN, EAI_BADFLAGS, EAI_FAIL,
|
|
EAI_FAMILY, EAI_MEMORY, EAI_NODATA,
|
|
EAI_NONAME, EAI_OVERFLOW, EAI_SERVICE,
|
|
EAI_SOCKTYPE, EAI_SYSTEM,
|
|
INADDR_ALLHOSTS_GROUP, INADDR_ANY,
|
|
INADDR_BROADCAST, INADDR_LOOPBACK,
|
|
INADDR_MAX_LOCAL_GROUP, INADDR_NONE,
|
|
INADDR_UNSPEC_GROUP, IPPORT_RESERVED,
|
|
IPPORT_USERRESERVED, IPPROTO_AH,
|
|
IPPROTO_DSTOPTS, IPPROTO_EGP,
|
|
IPPROTO_ESP, IPPROTO_FRAGMENT,
|
|
IPPROTO_GRE, IPPROTO_HOPOPTS,
|
|
IPPROTO_ICMP, IPPROTO_ICMPV6,
|
|
IPPROTO_IDP, IPPROTO_IGMP, IPPROTO_IP,
|
|
IPPROTO_IPIP, IPPROTO_IPV6,
|
|
IPPROTO_NONE, IPPROTO_PIM, IPPROTO_PUP,
|
|
IPPROTO_RAW, IPPROTO_ROUTING,
|
|
IPPROTO_RSVP, IPPROTO_TCP, IPPROTO_TP,
|
|
IPPROTO_UDP, IPV6_CHECKSUM,
|
|
IPV6_DSTOPTS, IPV6_HOPLIMIT,
|
|
IPV6_HOPOPTS, IPV6_JOIN_GROUP,
|
|
IPV6_LEAVE_GROUP, IPV6_MULTICAST_HOPS,
|
|
IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP,
|
|
IPV6_NEXTHOP, IPV6_PKTINFO,
|
|
IPV6_RECVDSTOPTS, IPV6_RECVHOPLIMIT,
|
|
IPV6_RECVHOPOPTS, IPV6_RECVPKTINFO,
|
|
IPV6_RECVRTHDR, IPV6_RECVTCLASS,
|
|
IPV6_RTHDR, IPV6_RTHDRDSTOPTS,
|
|
IPV6_RTHDR_TYPE_0, IPV6_TCLASS,
|
|
IPV6_UNICAST_HOPS, IPV6_V6ONLY,
|
|
IP_ADD_MEMBERSHIP,
|
|
IP_DEFAULT_MULTICAST_LOOP,
|
|
IP_DEFAULT_MULTICAST_TTL,
|
|
IP_DROP_MEMBERSHIP, IP_HDRINCL,
|
|
IP_MAX_MEMBERSHIPS, IP_MULTICAST_IF,
|
|
IP_MULTICAST_LOOP, IP_MULTICAST_TTL,
|
|
IP_OPTIONS, IP_RECVOPTS,
|
|
IP_RECVRETOPTS, IP_RETOPTS, IP_TOS,
|
|
IP_TTL, MSG_CTRUNC, MSG_DONTROUTE,
|
|
MSG_DONTWAIT, MSG_EOR, MSG_OOB,
|
|
MSG_PEEK, MSG_TRUNC, MSG_WAITALL,
|
|
NETLINK_DNRTMSG, NETLINK_FIREWALL,
|
|
NETLINK_IP6_FW, NETLINK_NFLOG,
|
|
NETLINK_ROUTE, NETLINK_USERSOCK,
|
|
NETLINK_XFRM, NI_DGRAM, NI_MAXHOST,
|
|
NI_MAXSERV, NI_NAMEREQD, NI_NOFQDN,
|
|
NI_NUMERICHOST, NI_NUMERICSERV,
|
|
PACKET_BROADCAST, PACKET_FASTROUTE,
|
|
PACKET_HOST, PACKET_LOOPBACK,
|
|
PACKET_MULTICAST, PACKET_OTHERHOST,
|
|
PACKET_OUTGOING, PF_PACKET, SHUT_RD,
|
|
SHUT_RDWR, SHUT_WR, SOCK_DGRAM,
|
|
SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET,
|
|
SOCK_STREAM, SOL_IP, SOL_SOCKET,
|
|
SOL_TCP, SOL_TIPC, SOL_UDP, SOMAXCONN,
|
|
SO_ACCEPTCONN, SO_ATTACH_FILTER,
|
|
SO_BINDTODEVICE, SO_BROADCAST,
|
|
SO_BSDCOMPAT, SO_DEBUG,
|
|
SO_DETACH_FILTER, SO_DONTROUTE,
|
|
SO_ERROR, SO_KEEPALIVE, SO_LINGER,
|
|
SO_NO_CHECK, SO_OOBINLINE, SO_PASSCRED,
|
|
SO_PASSSEC, SO_PEERCRED, SO_PEERNAME,
|
|
SO_PEERSEC, SO_PRIORITY, SO_RCVBUF,
|
|
SO_RCVBUFFORCE, SO_RCVLOWAT,
|
|
SO_RCVTIMEO, SO_REUSEADDR,
|
|
SO_SECURITY_AUTHENTICATION,
|
|
SO_SECURITY_ENCRYPTION_NETWORK,
|
|
SO_SECURITY_ENCRYPTION_TRANSPORT,
|
|
SO_SNDBUF, SO_SNDBUFFORCE, SO_SNDLOWAT,
|
|
SO_SNDTIMEO, SO_TIMESTAMP,
|
|
SO_TIMESTAMPNS, SO_TYPE, SocketType,
|
|
TCP_CONGESTION, TCP_CORK,
|
|
TCP_DEFER_ACCEPT, TCP_INFO,
|
|
TCP_KEEPCNT, TCP_KEEPIDLE,
|
|
TCP_KEEPINTVL, TCP_LINGER2, TCP_MAXSEG,
|
|
TCP_MD5SIG, TCP_MD5SIG_MAXKEYLEN,
|
|
TCP_NODELAY, TCP_QUICKACK, TCP_SYNCNT,
|
|
TCP_WINDOW_CLAMP, TIPC_ADDR_ID,
|
|
TIPC_ADDR_NAME, TIPC_ADDR_NAMESEQ,
|
|
TIPC_CFG_SRV, TIPC_CLUSTER_SCOPE,
|
|
TIPC_CONN_TIMEOUT,
|
|
TIPC_CRITICAL_IMPORTANCE,
|
|
TIPC_DEST_DROPPABLE,
|
|
TIPC_HIGH_IMPORTANCE, TIPC_IMPORTANCE,
|
|
TIPC_LOW_IMPORTANCE,
|
|
TIPC_MEDIUM_IMPORTANCE,
|
|
TIPC_NODE_SCOPE, TIPC_PUBLISHED,
|
|
TIPC_SRC_DROPPABLE,
|
|
TIPC_SUBSCR_TIMEOUT, TIPC_SUB_CANCEL,
|
|
TIPC_SUB_PORTS, TIPC_SUB_SERVICE,
|
|
TIPC_TOP_SRV, TIPC_WAIT_FOREVER,
|
|
TIPC_WITHDRAWN, TIPC_ZONE_SCOPE,
|
|
gaierror, getaddrinfo, getfqdn,
|
|
gethostbyaddr, gethostbyname,
|
|
gethostbyname_ex, gethostname,
|
|
getnameinfo, getprotobyname,
|
|
getservbyname, getservbyport, htonl,
|
|
htons, inet_aton, inet_ntoa, inet_ntop,
|
|
inet_pton, ntohl, ntohs,
|
|
setdefaulttimeout, socketpair)
|
|
import sqlite3
|
|
import ssl
|
|
import stat
|
|
from stat import (ST_MTIME, S_IFMT, S_IMODE, S_ISBLK,
|
|
S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK,
|
|
S_ISREG, S_ISSOCK)
|
|
import string
|
|
import struct
|
|
import subprocess
|
|
from subprocess import (CalledProcessError, PIPE, Popen, call,
|
|
check_call)
|
|
import symbol
|
|
import sys
|
|
from sys import exit, getsizeof, stderr, stdout
|
|
import tempfile
|
|
from tempfile import (NamedTemporaryFile,
|
|
SpooledTemporaryFile, TemporaryFile,
|
|
mkdtemp, mkstemp, mktemp)
|
|
import termios
|
|
import textwrap
|
|
from textwrap import dedent
|
|
import threading
|
|
from threading import (BoundedSemaphore, Condition, Lock,
|
|
RLock, Semaphore, Thread, Timer,
|
|
currentThread, current_thread)
|
|
import time
|
|
from time import (asctime, ctime, gmtime, localtime,
|
|
mktime, sleep, strftime, strptime)
|
|
import timeit
|
|
import token
|
|
import traceback
|
|
import types
|
|
from types import (BooleanType, BufferType,
|
|
BuiltinFunctionType, BuiltinMethodType,
|
|
ClassType, CodeType, ComplexType,
|
|
DictProxyType, DictType,
|
|
DictionaryType, EllipsisType, FileType,
|
|
FloatType, FrameType, FunctionType,
|
|
GeneratorType, GetSetDescriptorType,
|
|
InstanceType, IntType, LambdaType,
|
|
ListType, LongType,
|
|
MemberDescriptorType, MethodType,
|
|
ModuleType, NoneType,
|
|
NotImplementedType, ObjectType,
|
|
SliceType, StringType, StringTypes,
|
|
TracebackType, TupleType, TypeType,
|
|
UnboundMethodType, UnicodeType,
|
|
XRangeType)
|
|
import unittest
|
|
import urllib
|
|
import urllib2
|
|
import warnings
|
|
import weakref
|
|
from weakref import (CallableProxyType, ProxyType,
|
|
ProxyTypes, ReferenceType,
|
|
WeakKeyDictionary, WeakValueDictionary,
|
|
getweakrefcount, getweakrefs)
|
|
from xml.dom import minidom
|
|
import xml.parsers.expat
|
|
import zlib
|