diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6001e95 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ida/siard2sqlite"] + path = ida/siard2sqlite + url = git@github.com:immortalvm/siard2sqlite.git diff --git a/Makefile b/Makefile index da1fa50..736c995 100644 --- a/Makefile +++ b/Makefile @@ -50,12 +50,12 @@ THIRDPARTYTINYXML2DIR=$(THIRDPARTYDIR)/tinyxml2 # IDA libraries included in this project IDAROAEPARSERDIR=./ida/roaeparser IDASIARD2SQLDIR=./ida/siard2sql - +IDASIARD2SQLITEDIR=./ida/siard2sqlite # All this directory is included in the IVM filesystem DATADIR=db # IDA project static libraries -ALIBS=$(LIBDIR)/libroae.a $(LIBDIR)/libsiard2sql.a $(LIBDIR)/libminizip.a $(LIBDIR)/libz.a $(LIBDIR)/libtinyxml2.a $(LIBDIR)/libsqlite3.a +ALIBS=$(LIBDIR)/libroae.a $(LIBDIR)/libsiard2sql.a $(LIBDIR)/libsiard2sqlite.a $(LIBDIR)/libminizip.a $(LIBDIR)/libz.a $(LIBDIR)/libtinyxml2.a $(LIBDIR)/libsqlite3.a # Sources required by the shell (used by internal commands ...) REQSRC= $(THIRDPARTYDIR)/utils/libfind.c $(THIRDPARTYDIR)/utils/libgrep.c $(THIRDPARTYDIR)/utils/regexp.c @@ -63,7 +63,7 @@ REQSRC= $(THIRDPARTYDIR)/utils/libfind.c $(THIRDPARTYDIR)/utils/libgrep.c $(THIR .PHONY: roaeshell binaries clean roaeshell: $(ALIBS) $(BUILDDIR)/ivmfs.c libspawn.c $(REQSRC) shell.c - $(CC) $(CFLAGS) -o $(BUILDDIR)/$@ libspawn.c $(BUILDDIR)/ivmfs.c $(REQSRC) shell.c $(INC) -L $(LIBDIR) -lsiard2sql -lroae -lsqlite3 -lstdc++ -lminizip -lz -ltinyxml2 -lm + $(CC) $(CFLAGS) -o $(BUILDDIR)/$@ libspawn.c $(BUILDDIR)/ivmfs.c $(REQSRC) shell.c $(INC) -L $(LIBDIR) -lsiard2sqlite -lsiard2sql -lroae -lsqlite3 -lstdc++ -lminizip -lz -ltinyxml2 -lm cp -r "$(DATADIR)" $(BUILDDIR)/ mkdir -p $(BUILDDIR)/bin/ ; mv -f bin/* $(BUILDDIR)/bin/ ; rmdir -v bin @echo; echo; test -f "$(BUILDDIR)/$@" && echo "Run as: (cd $(BUILDDIR); ./$@)" @@ -106,6 +106,10 @@ $(LIBDIR)/libsiard2sql.a: @mkdir -p $(LIBDIR) || exit -1 @cp -v `find $(IDASIARD2SQLDIR) -name libsiard2sql.a` "$@" +$(LIBDIR)/libsiard2sqlite.a: + cd $(IDASIARD2SQLITEDIR) && ./build.sh -lib + cp $(IDASIARD2SQLITEDIR)/build/libsiard2sqlite.a $(LIBDIR)/libsiard2sqlite.a + #$(LIBDIR)/%.a: $(IDAEXTSIARD2SQLDIR)/$(LIBDIR)/%.a # @mkdir -p $(LIBDIR) || exit -1 # @cp -v "$^" "$@" @@ -120,7 +124,7 @@ binaries: roaeshell.b find.b grep.b roaeshell.b: $(ALIBS) $(BUILDDIR)/ivmfs-empty.c libspawn.c $(REQSRC) shell.c @mkdir -p bin || exit -1 - $(CC) $(CFLAGS) -o bin/$@.ivm libspawn.c $(BUILDDIR)/ivmfs-empty.c $(REQSRC) shell.c $(INC) -L $(LIBDIR) -lsiard2sql -lroae -lsqlite3 -lstdc++ -lminizip -lz -ltinyxml2 -lm + $(CC) $(CFLAGS) -o bin/$@.ivm libspawn.c $(BUILDDIR)/ivmfs-empty.c $(REQSRC) shell.c $(INC) -L $(LIBDIR) -lsiard2sqlite -lsiard2sql -lroae -lsqlite3 -lstdc++ -lminizip -lz -ltinyxml2 -lm if test "$(CC)" = "ivm64-gcc" ; then \ $(IVM_AS) bin/$@.ivm --bin bin/$@ --sym /dev/null; rm -f bin/$@.ivm; chmod +rx "bin/$@"; \ else \ diff --git a/README.md b/README.md index 2f39726..8710f63 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ Type ```build.sh``` for help: If used flag ```-c```, a cleaning is made prior to building. +P.S siard2sqlite is added as a git submodule, therefore you need to run : +```git submodule update --init --recursive``` +at least once to download all of the dependencies. ## Cross compiling for ivm64 When cross-compiling for the ivm64 architecture you need to diff --git a/ida/siard2sqlite b/ida/siard2sqlite new file mode 160000 index 0000000..e6a714c --- /dev/null +++ b/ida/siard2sqlite @@ -0,0 +1 @@ +Subproject commit e6a714c02f565f76704a436df2b3ad862b817c0f diff --git a/shell.c b/shell.c index d5ff2d9..cc40181 100644 --- a/shell.c +++ b/shell.c @@ -2618,6 +2618,29 @@ int main_siard(int argc, char *argv[]) { return 0; } +extern int siard2db(const char * filePath); +extern int siard2sql(const char* filePath); +static void help_siard2sqlite(int argc, char *argv[]) { + printf("Usage: %s \n",argv[0]); + printf("Usage: %s -sql (to output a sql file instead)\n",argv[0]); + } +int main_siard_tosqlite(int argc, char *argv[]) { + if (argc == 3) { + if(strcmp(argv[2], "-sql") == 0) { + siard2sql(argv[1]); + return 0; + } else { + help_siard2sqlite(argc, argv); + return -1; + } + } + if (argc > 3) { + help_siard2sqlite(argc, argv); + return -1; + } + return siard2db(argv[1]); +} + extern int IDA_unzip(const char *zipfile, const char *onefile); int main_unzip(int argc, char *argv[]) { if (argc < 2) { @@ -3066,7 +3089,7 @@ static int main_help(int argc, char *argv[]) "Available redirections:\n" " '> file', ' 2> file', ' >> file', ' < file', ' << HEREDOC'\n" "IDA commands:\n" - " roae siard sqlite unzip\n" + " roae siard siard2sqlite sqlite unzip\n" ); return 0; } @@ -3606,6 +3629,12 @@ int main(void) continue; } + if (!strcmp("siard2sqlite", args[0])){ + fprintf(stderr, "SIARD2sqlite"); + status = main_siard_tosqlite(argc, args); + continue; + } + if (!strcmp("unzip", args[0])){ status = main_unzip(argc, args); continue;