示例#1
0
 def __init__(self):
     self.pb = pypacker.packbin()
     self.rr = Random.new()
     self.pgdebug = 0
     # Seed random;
     for aa in range(10):
         self.rr.read(5)
示例#2
0
文件: pydata.py 项目: pglen/pyvserv
 def __init__(self):
     #print(  "DataHandler __init__")
     self.src = None
     self.tout = None
     self.timeout = 7
     self.pgdebug = 0
     self.pglog = 0
     self.wr = pywrap.wrapper()
     self.pb = pypacker.packbin()
示例#3
0
文件: pystate.py 项目: pglen/pyvserv
    def __init__(self, resp):
        # Fill in class globals
        self.curr_state = initial
        self.resp = resp
        self.badpass = 0
        self.wr = pywrap.wrapper()
        self.pb = pypacker.packbin()

        self.wr.pgdebug = 0
示例#4
0
    def __init__(self, sock=None):
        self.sock = sock
        self.verbose = False
        self.comm = ""
        self.pgdebug = 0
        if self.sock != None:
            self.mydathand = pydata.xHandler(self.sock)
            self.myhandler = pydata.DataHandler()
        self.wr = pywrap.wrapper()
        self.pb = pypacker.packbin()

        #self.wr.pgdebug = 2
        self.rr = Random.new()
        # Seed random;
        for aa in range(10):
            self.rr.read(5)
示例#5
0
from Crypto import Random
from Crypto.Hash import SHA512

import pypacker

# ------------------------------------------------------------------------
# Test harness

if __name__ == '__main__':

    xorg = [
        "val1", "val2", "val3", "val4", "val5", "val6", "val7", "val8", "val9",
        "val10", "val11", "val12", "val13", "val14", "val15", "val16", "val17"
    ]

    pb = pypacker.packbin()
    pb.verbose = 5
    #print("pb exports", dir(pb))

    #sorg_var = [ 334, "subx", 'x', xorg]
    sorg_var = xorg

    if pb.verbose > 2:
        print("sorg_var: ", sorg_var)

    eee_var = pb.encode_data("", *sorg_var)

    if pb.verbose > 2:
        print("eee_var type", type(eee_var).__name__, ":\n", eee_var)

    fff_var = pb.decode_data(eee_var)
示例#6
0
#!/usr/bin/env python3

from __future__ import absolute_import
from __future__ import print_function

import os, sys, getopt, signal, uuid, subprocess
import socketserver, socket, random, time, threading

import pysql

sys.path.append('../pycommon')
import pypacker

packer = pypacker.packbin()

myip = ""
myid = bytes("dbgui", "cp437")

pgdebug = 0


def get_myip():

    global myip
    # Only ask once
    if not myip:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        try:
            # doesn't even have to be reachable
            s.connect(('10.255.255.255', 1))
            myip = s.getsockname()[0]