<s> import unittest <EOL> import ConfigParser <EOL> from impacket . dcerpc . v5 import transport <EOL> from impacket . dcerpc . v5 import wkst <EOL> from impacket . dcerpc . v5 . ndr import NULL <EOL> class WKSTTests ( unittest . TestCase ) : <EOL> def connect ( self ) : <EOL> rpctransport = transport . DCERPCTransportFactory ( self . stringBinding ) <EOL> if len ( self . hashes ) > <NUM_LIT:0> : <EOL> lmhash , nthash = self . hashes . split ( '<STR_LIT::>' ) <EOL> else : <EOL> lmhash = '<STR_LIT>' <EOL> nthash = '<STR_LIT>' <EOL> if hasattr ( rpctransport , '<STR_LIT>' ) : <EOL> rpctransport . set_credentials ( self . username , self . password , self . domain , lmhash , nthash ) <EOL> dce = rpctransport . get_dce_rpc ( ) <EOL> dce . connect ( ) <EOL> dce . bind ( wkst . MSRPC_UUID_WKST , transfer_syntax = self . ts ) <EOL> return dce , rpctransport <EOL> def test_NetrWkstaGetInfo ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> request = wkst . NetrWkstaGetInfo ( ) <EOL> request [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> request [ '<STR_LIT>' ] = <NUM_LIT:100> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> def test_hNetrWkstaGetInfo ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT:100> ) <EOL> resp . dump ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT> ) <EOL> resp . dump ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT> ) <EOL> resp . dump ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT> ) <EOL> resp . dump ( ) <EOL> def test_NetrWkstaUserEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> request = wkst . NetrWkstaUserEnum ( ) <EOL> request [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> def test_hNetrWkstaUserEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> resp = wkst . hNetrWkstaUserEnum ( dce , <NUM_LIT:0> ) <EOL> resp . dump ( ) <EOL> resp = wkst . hNetrWkstaUserEnum ( dce , <NUM_LIT:1> ) <EOL> resp . dump ( ) <EOL> def test_NetrWkstaTransportEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> request = wkst . NetrWkstaTransportEnum ( ) <EOL> request [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> request [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> request [ '<STR_LIT>' ] = NULL <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> def test_hNetrWkstaTransportEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> resp = wkst . hNetrWkstaTransportEnum ( dce , <NUM_LIT:0> ) <EOL> resp . dump ( ) <EOL> def test_NetrWkstaSetInfo ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> request = wkst . NetrWkstaGetInfo ( ) <EOL> request [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> request [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp = dce . request ( request ) <EOL> resp . dump ( ) <EOL> oldVal = resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> req = wkst . NetrWkstaSetInfo ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = <NUM_LIT> <EOL> req [ '<STR_LIT>' ] = resp [ '<STR_LIT>' ] <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> resp = dce . request ( request ) <EOL> self . assertTrue ( <NUM_LIT> == resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = oldVal <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> def test_hNetrWkstaSetInfo ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT> ) <EOL> resp . dump ( ) <EOL> oldVal = resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT> <EOL> resp2 = wkst . hNetrWkstaSetInfo ( dce , <NUM_LIT> , resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> resp2 . dump ( ) <EOL> resp = wkst . hNetrWkstaGetInfo ( dce , <NUM_LIT> ) <EOL> resp . dump ( ) <EOL> self . assertTrue ( <NUM_LIT> == resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = oldVal <EOL> resp2 = wkst . hNetrWkstaSetInfo ( dce , <NUM_LIT> , resp [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> resp2 . dump ( ) <EOL> def test_NetrWkstaTransportAdd ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrWkstaTransportAdd ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrUseAdd_hNetrUseDel_hNetrUseGetInfo_hNetrUseEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> info1 = wkst . LPUSE_INFO_1 ( ) <EOL> info1 [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> info1 [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> info1 [ '<STR_LIT>' ] = NULL <EOL> resp = wkst . hNetrUseAdd ( dce , <NUM_LIT:1> , info1 ) <EOL> resp . dump ( ) <EOL> if self . ts == ( '<STR_LIT>' , '<STR_LIT:1.0>' ) : <EOL> return <EOL> resp = wkst . hNetrUseEnum ( dce , <NUM_LIT:2> ) <EOL> resp . dump ( ) <EOL> resp2 = wkst . hNetrUseGetInfo ( dce , '<STR_LIT>' , <NUM_LIT:3> ) <EOL> resp2 . dump ( ) <EOL> resp = wkst . hNetrUseDel ( dce , '<STR_LIT>' ) <EOL> resp . dump ( ) <EOL> def test_NetrUseAdd_NetrUseDel_NetrUseGetInfo_NetrUseEnum ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrUseAdd ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = NULL <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> if self . ts == ( '<STR_LIT>' , '<STR_LIT:1.0>' ) : <EOL> return <EOL> req = wkst . NetrUseEnum ( ) <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:2> <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = <NUM_LIT:2> <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = <NUM_LIT> <EOL> req [ '<STR_LIT>' ] = NULL <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> req = wkst . NetrUseGetInfo ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:3> <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> req = wkst . NetrUseDel ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = wkst . USE_LOTS_OF_FORCE <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> def test_NetrWorkstationStatisticsGet ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrWorkstationStatisticsGet ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrWorkstationStatisticsGet ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrWorkstationStatisticsGet ( dce , '<STR_LIT:\x00>' , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrGetJoinInformation ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrGetJoinInformation ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrGetJoinInformation ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp = wkst . hNetrGetJoinInformation ( dce , '<STR_LIT:\x00>' ) <EOL> resp . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrJoinDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrJoinDomain2 ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT> <EOL> req [ '<STR_LIT>' ] = wkst . NETSETUP_DOMAIN_JOIN_IF_JOINED <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrJoinDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp = wkst . hNetrJoinDomain2 ( dce , '<STR_LIT>' , '<STR_LIT>' , NULL , '<STR_LIT:\x00>' * <NUM_LIT> , wkst . NETSETUP_DOMAIN_JOIN_IF_JOINED ) <EOL> resp . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrUnjoinDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrUnjoinDomain2 ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT> <EOL> req [ '<STR_LIT>' ] = wkst . NETSETUP_ACCT_DELETE <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrUnjoinDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp = wkst . hNetrUnjoinDomain2 ( dce , NULL , '<STR_LIT:\x00>' * <NUM_LIT> , wkst . NETSETUP_ACCT_DELETE ) <EOL> resp . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrRenameMachineInDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrRenameMachineInDomain2 ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT> <EOL> req [ '<STR_LIT>' ] = wkst . NETSETUP_ACCT_CREATE <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrRenameMachineInDomain2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp = wkst . hNetrRenameMachineInDomain2 ( dce , '<STR_LIT>' , NULL , '<STR_LIT:\x00>' * <NUM_LIT> , wkst . NETSETUP_ACCT_CREATE ) <EOL> resp . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrValidateName2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrValidateName2 ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = wkst . NETSETUP_NAME_TYPE . NetSetupDomain <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrValidateName2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrValidateName2 ( dce , '<STR_LIT>' , NULL , NULL , wkst . NETSETUP_NAME_TYPE . NetSetupDomain ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrGetJoinableOUs2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrGetJoinableOUs2 ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrGetJoinableOUs2 ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp = wkst . hNetrGetJoinableOUs2 ( dce , '<STR_LIT>' , NULL , NULL , <NUM_LIT:0> ) <EOL> resp . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrAddAlternateComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrAddAlternateComputerName ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = NULL <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> and str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrAddAlternateComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrAddAlternateComputerName ( dce , '<STR_LIT>' , NULL , NULL ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> and str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrRemoveAlternateComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrRemoveAlternateComputerName ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = NULL <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> and str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrRemoveAlternateComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrRemoveAlternateComputerName ( dce , '<STR_LIT>' , NULL , NULL ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> and str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrSetPrimaryComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrSetPrimaryComputerName ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> req [ '<STR_LIT>' ] = NULL <EOL> req [ '<STR_LIT>' ] = NULL <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrSetPrimaryComputerName ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrSetPrimaryComputerName ( dce , '<STR_LIT>' , NULL , NULL ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_NetrEnumerateComputerNames ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> req = wkst . NetrEnumerateComputerNames ( ) <EOL> req [ '<STR_LIT>' ] = '<STR_LIT:\x00>' * <NUM_LIT:10> <EOL> req [ '<STR_LIT>' ] = wkst . NET_COMPUTER_NAME_TYPE . NetAllComputerNames <EOL> try : <EOL> resp2 = dce . request ( req ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> def test_hNetrEnumerateComputerNames ( self ) : <EOL> dce , rpctransport = self . connect ( ) <EOL> try : <EOL> resp2 = wkst . hNetrEnumerateComputerNames ( dce , wkst . NET_COMPUTER_NAME_TYPE . NetAllComputerNames ) <EOL> resp2 . dump ( ) <EOL> except Exception , e : <EOL> if str ( e ) . find ( '<STR_LIT>' ) < <NUM_LIT:0> : <EOL> raise <EOL> class SMBTransport ( WKSTTests ) : <EOL> def setUp ( self ) : <EOL> WKSTTests . setUp ( self ) <EOL> configFile = ConfigParser . ConfigParser ( ) <EOL> configFile . read ( '<STR_LIT>' ) <EOL> self . username = configFile . get ( '<STR_LIT>' , '<STR_LIT:username>' ) <EOL> self . domain = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . serverName = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . password = configFile . get ( '<STR_LIT>' , '<STR_LIT:password>' ) <EOL> self . machine = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . hashes = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . stringBinding = r'<STR_LIT>' % self . machine <EOL> self . ts = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> class SMBTransport64 ( WKSTTests ) : <EOL> def setUp ( self ) : <EOL> WKSTTests . setUp ( self ) <EOL> configFile = ConfigParser . ConfigParser ( ) <EOL> configFile . read ( '<STR_LIT>' ) <EOL> self . username = configFile . get ( '<STR_LIT>' , '<STR_LIT:username>' ) <EOL> self . domain = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . serverName = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . password = configFile . get ( '<STR_LIT>' , '<STR_LIT:password>' ) <EOL> self . machine = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . hashes = configFile . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . stringBinding = r'<STR_LIT>' % self . machine <EOL> self . ts = ( '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import sys <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> testcase = sys . argv [ <NUM_LIT:1> ] <EOL> suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( globals ( ) [ testcase ] ) <EOL> else : <EOL> suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( SMBTransport ) <EOL> suite . addTests ( unittest . TestLoader ( ) . loadTestsFromTestCase ( SMBTransport64 ) ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:1> ) . run ( suite ) </s>
