leonW7 / shdep

Shdep is an analysis tool to trace the shell script dependency.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shdep

License

Shdep is an analysis tool to trace the shell script dependency.

Installation

  1. Prerequisite

    Shdep leverages shfmt/v2.0 to parse the script syntax tree. A copy can be found in tools folder. Put it in one of your path in $PATH.

  2. Build Gradle Task

     ./gradlew shdep
    

Run Shdep

  1. Security Concerns

    Some commands in scripts could be run for anlaysis. For security concerns, it is recommanded to run the tool in a docker container or a vitual machine.

  2. Execute JAR

     java -jar build/libs/shdep.jar sample/cramfs-root  # To unpack the sample file first.
    
  3. Output

    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/readbits
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/eraseflash
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/echo
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/cp
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/set_led -> /bin/statusled
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/set_led -> /var/run/statusled
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/set_led -> /bin/networkled
    /sbin/rc.init -> /sbin/rc.factorydefault -> /bin/set_led -> /bin/powerled
    ...
    ...
    ...
    

About

Shdep is an analysis tool to trace the shell script dependency.


Languages

Language:Java 100.0%