| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # Copyright 2012 The LUCI Authors. All rights reserved. | 3 # Copyright 2012 The LUCI Authors. All rights reserved. |
| 4 # Use of this source code is governed under the Apache License, Version 2.0 | 4 # Use of this source code is governed under the Apache License, Version 2.0 |
| 5 # that can be found in the LICENSE file. | 5 # that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """Traces an executable and its child processes and extract the files accessed | 7 """Traces an executable and its child processes and extract the files accessed |
| 8 by them. | 8 by them. |
| 9 | 9 |
| 10 The implementation uses OS-specific API. The native Kernel logger and the ETL | 10 The implementation uses OS-specific API. The native Kernel logger and the ETL |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ## OS-specific imports | 47 ## OS-specific imports |
| 48 | 48 |
| 49 if sys.platform == 'win32': | 49 if sys.platform == 'win32': |
| 50 from ctypes.wintypes import byref, c_int, c_wchar_p | 50 from ctypes.wintypes import byref, c_int, c_wchar_p |
| 51 from ctypes.wintypes import windll # pylint: disable=E0611 | 51 from ctypes.wintypes import windll # pylint: disable=E0611 |
| 52 | 52 |
| 53 | 53 |
| 54 __version__ = '0.2' | 54 __version__ = '0.2' |
| 55 | 55 |
| 56 | 56 |
| 57 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 57 BASE_DIR = os.path.dirname(os.path.abspath( |
| 58 __file__.decode(sys.getfilesystemencoding()))) |
| 58 ROOT_DIR = os.path.dirname(os.path.dirname(BASE_DIR)) | 59 ROOT_DIR = os.path.dirname(os.path.dirname(BASE_DIR)) |
| 59 | 60 |
| 60 | 61 |
| 61 class TracingFailure(Exception): | 62 class TracingFailure(Exception): |
| 62 """An exception occured during tracing.""" | 63 """An exception occured during tracing.""" |
| 63 def __init__(self, description, pid, line_number, line, *args): | 64 def __init__(self, description, pid, line_number, line, *args): |
| 64 super(TracingFailure, self).__init__( | 65 super(TracingFailure, self).__init__( |
| 65 description, pid, line_number, line, *args) | 66 description, pid, line_number, line, *args) |
| 66 self.description = description | 67 self.description = description |
| 67 self.pid = pid | 68 self.pid = pid |
| (...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3396 sys.stderr.write('\n') | 3397 sys.stderr.write('\n') |
| 3397 return 1 | 3398 return 1 |
| 3398 | 3399 |
| 3399 | 3400 |
| 3400 if __name__ == '__main__': | 3401 if __name__ == '__main__': |
| 3401 subprocess42.inhibit_os_error_reporting() | 3402 subprocess42.inhibit_os_error_reporting() |
| 3402 fix_encoding.fix_encoding() | 3403 fix_encoding.fix_encoding() |
| 3403 tools.disable_buffering() | 3404 tools.disable_buffering() |
| 3404 colorama.init() | 3405 colorama.init() |
| 3405 sys.exit(main(sys.argv[1:])) | 3406 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |