Skip to content

Commit

Permalink
Merge pull request worawit#8 from cclauss/patch-1
Browse files Browse the repository at this point in the history
Old style exceptions --> new style exceptions
  • Loading branch information
worawit authored Jul 19, 2017
2 parents b670b0d + 5ea7281 commit f4b6b5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
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]))


Expand Down
8 changes: 4 additions & 4 deletions zzz_exploit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit f4b6b5a

Please sign in to comment.