
from lib.core.packages import Package

class Bash(Package):
    """ Bash shell script analysys package. """

    def start(self):
        # Some scripts are not executable, so we have to use /bin/bash to
        # invoke them
        self.args = [self.target] + self.args
        self.target = "/bin/bash"

        if "method" in self.options:
            method = self.options["method"]
        else: # fallback to dtruss
            method = "dtruss"

        if "dtruss" in method:
            for x in self._start_dtruss():
                yield x
        else:
            yield "Invalid analysis method \"%S\" for package \"Bash\"" % method


from lib.core.packages import Package

class Bash(Package):
    """ Bash shell script analysys package. """

    def start(self):
        # Some scripts are not executable, so we have to use /bin/bash to
        # invoke them
        self.args = [self.target] + self.args
        self.target = "/bin/bash"

        if "method" in self.options:
            method = self.options["method"]
        else: # fallback to dtruss
            method = "dtruss"

        if "dtruss" in method:
            for x in self._start_dtruss():
                yield x
        elif "apicalls" in method:
            for x in self._start_apicalls():
                yield x
        else:
            yield "Invalid analysis method \"%S\" for package \"Bash\"" % method

Add support for apicalls in Bash package
Add support for apicalls in Bash package

  
  from lib.core.packages import Package
  
  class Bash(Package):
      """ Bash shell script analysys package. """
  
      def start(self):
          # Some scripts are not executable, so we have to use /bin/bash to
          # invoke them
          self.args = [self.target] + self.args
          self.target = "/bin/bash"
  
          if "method" in self.options:
              method = self.options["method"]
          else: # fallback to dtruss
              method = "dtruss"
  
          if "dtruss" in method:
              for x in self._start_dtruss():
                  yield x
+         elif "apicalls" in method:
+             for x in self._start_apicalls():
+                 yield x
          else:
              yield "Invalid analysis method \"%S\" for package \"Bash\"" % method
  
Add support for apicalls in Bash package
## Code Before:

from lib.core.packages import Package

class Bash(Package):
    """ Bash shell script analysys package. """

    def start(self):
        # Some scripts are not executable, so we have to use /bin/bash to
        # invoke them
        self.args = [self.target] + self.args
        self.target = "/bin/bash"

        if "method" in self.options:
            method = self.options["method"]
        else: # fallback to dtruss
            method = "dtruss"

        if "dtruss" in method:
            for x in self._start_dtruss():
                yield x
        else:
            yield "Invalid analysis method \"%S\" for package \"Bash\"" % method

## Instruction:
Add support for apicalls in Bash package
## Code After:

from lib.core.packages import Package

class Bash(Package):
    """ Bash shell script analysys package. """

    def start(self):
        # Some scripts are not executable, so we have to use /bin/bash to
        # invoke them
        self.args = [self.target] + self.args
        self.target = "/bin/bash"

        if "method" in self.options:
            method = self.options["method"]
        else: # fallback to dtruss
            method = "dtruss"

        if "dtruss" in method:
            for x in self._start_dtruss():
                yield x
        elif "apicalls" in method:
            for x in self._start_apicalls():
                yield x
        else:
            yield "Invalid analysis method \"%S\" for package \"Bash\"" % method
