Melton:How to analyze Openssh
Melton:How to analyze Openssh--Using melton.py
Enter the project dir that contains Makefile (make sure you have run "./configure" to generate Makefile file), and the most simple way to start is:
[xuzb@ISCAS]$ $MELTON_DIR/melton.py -t ~/tmp/openssh-5.9p1 -f ssh
The melton.py script will automatically analyze Makefile,
and use Clang to generate AST files from ".c" files.
-t option specifies where to store the AST files and log files,
which should be an empty dir or a dir that is generated by melton before.
-f option specifies the executable file or library name to be analyzed,
such as "ssh", "sshd", "sftp-server", "libssh.a", etc. that are built from openssh.
If you don't know what executalbe files or libraries are,
go to the dir that -t option specifies (here is ~/tmp/openssh-5.9p1) and cat these files: "a", "exe" or "so" in "info" dir.
Finially, the bug reports are produced at "./BugReports" dir.
For detail usage of melton.py, see section 3 in melton tutorial.
Note: If the source project has been make(built) before,
please remove the generated object files(For example, execute 'make clean'.)
to assure the normal analysis of melton.py.
Melton:How to analyze Openssh--Using driver/panal.py
The melton.py script actually invokes panal.py to process Makefile.
You can also use panal.py to finish the analysis with the following steps.
Enter the project dir that contains Makefile, and:
[xuzb@ISCAS]$ $MELTON_DIR/driver/panal.py log -dir ~/tmp/openssh-5.9p1
It will use "execve" to execute the compile process of openssh, and log all compile commands in ~/tmp/openssh-5.9p1/info.
"a", "exe" and "so" files are generated at this step.
[xuzb@ISCAS]$ $MELTON_DIR/driver/panal.py preprocess -dir ~/tmp/openssh-5.9p1
It will preprocess all source files to be ".i" files in ~/tmp/openssh-5.9p1/src.
[xuzb@ISCAS]$ $MELTON_DIR/driver/panal.py compile -dir ~/tmp/openssh-5.9p1
It will genearte all source files to be AST files in ~/tmp/openssh-5.9p1/src.
[xuzb@ISCAS]$ $MELTON_DIR/driver/panal.py detect-memleak -dir ~/tmp/openssh-5.9p1 -file ssh
Analyze the AST files which are used to build executable file "ssh".