Old style exceptions --> new style exceptions
This commit is contained in:
@@ -292,7 +292,7 @@ def find_named_pipe(conn):
|
|||||||
fid = conn.nt_create_andx(tid, pipe)
|
fid = conn.nt_create_andx(tid, pipe)
|
||||||
conn.close(tid, fid)
|
conn.close(tid, fid)
|
||||||
found_pipe = pipe
|
found_pipe = pipe
|
||||||
except smb.SessionError, e:
|
except smb.SessionError as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
conn.disconnect_tree(tid)
|
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.
|
# First we try to open the service in case it exists. If it does, we remove it.
|
||||||
try:
|
try:
|
||||||
resp = scmr.hROpenServiceW(rpcsvc, svcHandle, service_name+'\x00')
|
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:
|
if str(e).find('ERROR_SERVICE_DOES_NOT_EXIST') == -1:
|
||||||
raise e # Unexpected error
|
raise e # Unexpected error
|
||||||
else:
|
else:
|
||||||
@@ -945,13 +945,13 @@ def service_exec(conn, cmd):
|
|||||||
# using command line always makes starting service fail because SetServiceStatus() does not get called
|
# using command line always makes starting service fail because SetServiceStatus() does not get called
|
||||||
#print('Stoping service %s.....' % service_name)
|
#print('Stoping service %s.....' % service_name)
|
||||||
#scmr.hRControlService(rpcsvc, serviceHandle, scmr.SERVICE_CONTROL_STOP)
|
#scmr.hRControlService(rpcsvc, serviceHandle, scmr.SERVICE_CONTROL_STOP)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
print('Removing service %s.....' % service_name)
|
print('Removing service %s.....' % service_name)
|
||||||
scmr.hRDeleteService(rpcsvc, serviceHandle)
|
scmr.hRDeleteService(rpcsvc, serviceHandle)
|
||||||
scmr.hRCloseServiceHandle(rpcsvc, serviceHandle)
|
scmr.hRCloseServiceHandle(rpcsvc, serviceHandle)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print("ServiceExec Error on: %s" % conn.get_remote_host())
|
print("ServiceExec Error on: %s" % conn.get_remote_host())
|
||||||
print(str(e))
|
print(str(e))
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user