Пример #1
0

class dcerpc_interface_table(Structure):
    pass


# struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx,
#                                                    const char *binding,
#                                                    const struct dcerpc_interface_table *table,
#                                                    struct cli_credentials *credentials,
#                                                    struct event_context *ev);
library.dcerpc_pipe_connect_send.restype = POINTER(composite_context)
library.dcerpc_pipe_connect_send.argtypes = [
    c_void_p, c_char_p, c_void_p, c_void_p, c_void_p
]
library.dcerpc_pipe_connect_send = logFuncCall(
    library.dcerpc_pipe_connect_send)

# NTSTATUS dcerpc_pipe_connect_recv(struct composite_context *c,
#                                   TALLOC_CTX *mem_ctx,
#                                   struct dcerpc_pipe **pp);
library.dcerpc_pipe_connect_recv.restype = NTSTATUS
library.dcerpc_pipe_connect_recv.argtypes = [
    POINTER(composite_context), c_void_p, c_void_p
]
library.dcerpc_pipe_connect_recv = logFuncCall(
    library.dcerpc_pipe_connect_recv)

# _PUBLIC_ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
library.dcerpc_ndr_request_recv.restype = NTSTATUS
library.dcerpc_ndr_request_recv.argtypes = [c_void_p]
library.dcerpc_ndr_request_recv = logFuncCall(library.dcerpc_ndr_request_recv)
from pysamba.composite_context import composite_context
from twisted.internet import defer
from ctypes import *

import Globals
from Products.ZenUtils.Driver import drive

import datetime
import logging

from winreg_ import *
from pysamba.library import library, logFuncCall

library.dcerpc_winreg_OpenHKPD_send.restype = c_void_p
library.dcerpc_winreg_OpenHKPD_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_OpenHKPD_send = logFuncCall(library.dcerpc_winreg_OpenHKPD_send)
library.dcerpc_winreg_QueryValue_send.restype = c_void_p
library.dcerpc_winreg_QueryValue_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_QueryValue_send = logFuncCall(library.dcerpc_winreg_QueryValue_send)
library.dcerpc_winreg_CloseKey_send.restype = c_void_p
library.dcerpc_winreg_CloseKey_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_CloseKey_send = logFuncCall(library.dcerpc_winreg_CloseKey_send)

def pointerTo(obj):
    "Compute a typed pointer to an object"
    return cast(addressof(obj), POINTER(obj.__class__))

class FetchBeforeConnectedError(Exception): pass

class PerfRpc(Rpc):
    def __init__(self, counters, capturePath=None, ntlmv2auth=False):
Пример #3
0
from pysamba.composite_context import composite_context
from twisted.internet import defer
from ctypes import *

import Globals
from Products.ZenUtils.Driver import drive

import datetime
import logging

from winreg_ import *
from pysamba.library import library, logFuncCall

library.dcerpc_winreg_OpenHKPD_send.restype = c_void_p
library.dcerpc_winreg_OpenHKPD_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_OpenHKPD_send = logFuncCall(
    library.dcerpc_winreg_OpenHKPD_send)
library.dcerpc_winreg_QueryValue_send.restype = c_void_p
library.dcerpc_winreg_QueryValue_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_QueryValue_send = logFuncCall(
    library.dcerpc_winreg_QueryValue_send)
library.dcerpc_winreg_CloseKey_send.restype = c_void_p
library.dcerpc_winreg_CloseKey_send.argtypes = [c_void_p, c_void_p, c_void_p]
library.dcerpc_winreg_CloseKey_send = logFuncCall(
    library.dcerpc_winreg_CloseKey_send)


def pointerTo(obj):
    "Compute a typed pointer to an object"
    return cast(addressof(obj), POINTER(obj.__class__))

Пример #4
0
class dcerpc_pipe(Structure):
    pass


class dcerpc_interface_table(Structure):
    pass


# struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx,
#                                                    const char *binding,
#                                                    const struct dcerpc_interface_table *table,
#                                                    struct cli_credentials *credentials,
#                                                    struct event_context *ev);
library.dcerpc_pipe_connect_send.restype = POINTER(composite_context)
library.dcerpc_pipe_connect_send.argtypes = [c_void_p, c_char_p, c_void_p, c_void_p, c_void_p]
library.dcerpc_pipe_connect_send = logFuncCall(library.dcerpc_pipe_connect_send)

# NTSTATUS dcerpc_pipe_connect_recv(struct composite_context *c,
#                                   TALLOC_CTX *mem_ctx,
#                                   struct dcerpc_pipe **pp);
library.dcerpc_pipe_connect_recv.restype = NTSTATUS
library.dcerpc_pipe_connect_recv.argtypes = [POINTER(composite_context), c_void_p, c_void_p]
library.dcerpc_pipe_connect_recv = logFuncCall(library.dcerpc_pipe_connect_recv)

# _PUBLIC_ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
library.dcerpc_ndr_request_recv.restype = NTSTATUS
library.dcerpc_ndr_request_recv.argtypes = [c_void_p]
library.dcerpc_ndr_request_recv = logFuncCall(library.dcerpc_ndr_request_recv)

# _PUBLIC_ void composite_continue_rpc(struct composite_context *ctx,
#                                 struct rpc_request *new_req,
Пример #5
0
        return res
    inner.__name__ = f.__name__
    return inner

@logFuncCall
@check
def talloc_zero(ctx, type):
    typename = 'struct ' + type.__name__
    return cast(library._talloc_zero(ctx,
                                     sizeof(type),
                                     typename),
                POINTER(type))

#char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
library.talloc_asprintf.restype = c_char_p
library.talloc_asprintf = logFuncCall(library.talloc_asprintf)

@logFuncCall
@check
def talloc_asprintf(*args):
    ctx  = args[0]
    fmt = args[1]
    s = fmt % args[2:]
    ret = library.talloc_strdup(ctx, s)
    return ret

def talloc_get_type(obj, type):
    result = library.talloc_check_name(obj, 'struct ' + type.__name__)
    if not result:
        raise TallocError("Probable mis-interpretation of memory block: "
                          "Have %s, wanted %s" % (talloc_get_name(obj),
Пример #6
0
    inner.__name__ = f.__name__
    return inner


@logFuncCall
@check
def talloc_zero(ctx, type):
    typename = 'struct ' + type.__name__
    return cast(library._talloc_zero(ctx, sizeof(type), typename),
                POINTER(type))


#char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
library.talloc_asprintf.restype = c_char_p
library.talloc_asprintf = logFuncCall(library.talloc_asprintf)


@logFuncCall
@check
def talloc_asprintf(*args):
    ctx = args[0]
    fmt = args[1]
    s = fmt % args[2:]
    ret = library.talloc_strdup(ctx, s)
    return ret


def talloc_get_type(obj, type):
    result = library.talloc_check_name(obj, 'struct ' + type.__name__)
    if not result: