1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

r2339: my first python commit!

added command line options for binding string, domain, username and password
(This used to be commit e94bec1079)
This commit is contained in:
Andrew Tridgell 2004-09-15 04:36:13 +00:00 committed by Gerald (Jerry) Carter
parent 31288d6545
commit d97f808cb6

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
import dcerpc
from optparse import OptionParser
def test_Connect(handle):
@ -56,10 +57,33 @@ def test_Connect(handle):
result = dcerpc.samr_Connect5(pipe, r)
print result
# parse command line
parser = OptionParser()
parser.add_option("-b", "--binding", action="store", type="string", dest="binding")
parser.add_option("-d", "--domain", action="store", type="string", dest="domain")
parser.add_option("-u", "--username", action="store", type="string", dest="username")
parser.add_option("-p", "--password", action="store", type="string", dest="password")
(options, args) = parser.parse_args()
if not options.binding:
parser.error('You must supply a binding string')
if not options.username or not options.password or not options.domain:
parser.error('You must supply a domain, username and password')
binding=options.binding
domain=options.domain
username=options.username
password=options.password
# Connect to server
pipe = dcerpc.pipe_connect('ncacn_np:win2k3dc',
pipe = dcerpc.pipe_connect(binding,
dcerpc.DCERPC_SAMR_UUID, dcerpc.DCERPC_SAMR_VERSION,
'win2k3dom', 'administrator', 'penguin')
domain, username, password)
test_Connect(pipe)