Git Product home page Git Product logo

posix-omni-parser's Introduction

posix-omni-parser

The posix-omni-parser aims to parse the traced system calls from various interposing utilities (eg strace on Linux, truss on Solaris, dtrace on BSD and Mac OSX) on different POSIX-compliant platforms into a more useful representation.

Trace Object

This module contains the Trace object, which is used to capture all the extracted information from a trace file.

Example using this module: import Trace trace = Trace.Trace(path_to_trace) print(trace)

The Trace object represents an entire system call trace, which means that it holds all the information extracted from a system call trace file created by an interposition utility such as the strace utility on Linux, the truss utility on Solaris or the dtrace utility on BSD and OSX platforms.

self.trace_path:
  The path to the file containing the traced system calls.

self.tracing_utility:
  The detected tracing utility used to generate the trace file, e.g strace.

self.parser:
  The parser to use in order to extract the information from the trace file.
  The choice of parser depends on the tracing utility used to generate the 
  trace file, i.e self.tracing_utility.

self.syscalls:
  This variable holds all the parsed system calls. It is a list of Syscall
  objects returned by the parser.

self.platform:
  The platform in which the trace is parsed on (sys.platform). This is
  especially useful when creating a trace bundle containing not only the
  parsed system calls but also a representation of all the files referenced
  in trace file.

Parser Object

Acts as the parent for all parsers. Defines some abstract methods required by all parsers and some helper methods that can be used by any parser.

StraceParser Object

This module holds a set of methods needed to parse the output of the strace utility. More information about strace can be found in the manual page under most Linux platforms (man strace)

The path to a file generated by the strace utility must be passed to the constructor method when initializing a StraceParser object. Then the parse_trace method of the parser can be called, which will return a list of Syscall objects, each containing all the information about a single system call parsed from the strace output file.

Example using this module:

import StraceParser

parser = StraceParser.StraceParser(path_to_trace)
print(parser)

# this will return a list of Syscall objects.
syscalls = parser.parse_trace()

TrussParser Object

This module holds a set of methods needed to parse the output of the truss utility. More information about truss can be found in the manual page under most Solaris distributions.

The path to a file generated by the truss utility must be passed to the constructor method when initializing a TrussParser object. Then the parse_trace method of the parser can be called, which will return a list of Syscall objects, each containing all the information about a single system call parsed from the truss output file.

Example using this module: import TrussParser

parser = TrussParser.TrussParser(path_to_trace)
print(parser)

# this will return a list of Syscall objects.
syscalls = parser.parse_trace()

Syscall Object

This object is used to describe a system call, holding all the information extracted from the trace file. The same object is used to describe system calls independently on which utility was used to generate the trace file.
self.original_line:
  A string holding the original line from which this object was created.

self.type:
  The type of the system call. This can be one of the UNFINISHED, RESUMED or
  COMPLETE.

self.pid:
  The process id of this system call.

self.name:
  The name of the system call.

self.args:
  A tuple containing all the arguments of the system call. The value of each
  argument can be either a string or wrapped into a more meaningful class.

self.ret:
  A tuple holding the return part of the system call. This tuple should
  always contain two items. The first one is the return value of the system
  call. The second is either a string holding the error label eg "EACCES"
  in case the system call had an error or None if the syscall executed 
  correctly.

self.inst_pointer:
  The instruction pointer at the time of the system call.

self.timestamp:
  This value can have different formats and content according to the parser
  options. For example it can hold  a relative timestamp indicating the
  interval between the beginning of successive syscalls or it can hold the
  time the syscall was executed.

self.elapsed_time:
  The time difference between the beginning and the end of the system call.

posix-omni-parser's People

Contributors

ssavvides avatar

Watchers

James Cloos avatar Philippe Ombredanne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.