Merge pull request #8 from cclauss/patch-1
Old style exceptions --> new style exceptions
This commit is contained in:
@@ -76,9 +76,9 @@ for pipe_name, pipe_uuid in pipes.items():
|
||||
else:
|
||||
print('{}: Ok ({})'.format(pipe_name, str(e)))
|
||||
dce.disconnect()
|
||||
except smb.SessionError, e:
|
||||
except smb.SessionError as e:
|
||||
print('{}: {}'.format(pipe_name, nt_errors.ERROR_MESSAGES[e.error_code][0]))
|
||||
except smbconnection.SessionError, e:
|
||||
except smbconnection.SessionError as e:
|
||||
print('{}: {}'.format(pipe_name, nt_errors.ERROR_MESSAGES[e.error][0]))
|
||||
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ def find_named_pipe(conn):
|
||||
fid = conn.nt_create_andx(tid, pipe)
|
||||
conn.close(tid, fid)
|
||||
found_pipe = pipe
|
||||
except smb.SessionError, e:
|
||||
except smb.SessionError as e:
|
||||
pass
|
||||
|
||||
conn.disconnect_tree(tid)
|
||||
@@ -924,7 +924,7 @@ def service_exec(conn, cmd):
|
||||
# First we try to open the service in case it exists. If it does, we remove it.
|
||||
try:
|
||||
resp = scmr.hROpenServiceW(rpcsvc, svcHandle, service_name+'\x00')
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if str(e).find('ERROR_SERVICE_DOES_NOT_EXIST') == -1:
|
||||
raise e # Unexpected error
|
||||
else:
|
||||
@@ -945,13 +945,13 @@ def service_exec(conn, cmd):
|
||||
# using command line always makes starting service fail because SetServiceStatus() does not get called
|
||||
#print('Stoping service %s.....' % service_name)
|
||||
#scmr.hRControlService(rpcsvc, serviceHandle, scmr.SERVICE_CONTROL_STOP)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
print('Removing service %s.....' % service_name)
|
||||
scmr.hRDeleteService(rpcsvc, serviceHandle)
|
||||
scmr.hRCloseServiceHandle(rpcsvc, serviceHandle)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print("ServiceExec Error on: %s" % conn.get_remote_host())
|
||||
print(str(e))
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user