summaryrefslogtreecommitdiff
path: root/src/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-07-26 23:46:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-07-26 23:46:10 (GMT)
commitdbf4d1f93e54251568854bff0ebc9c84f60857f6 (patch)
tree72fa507ada7ba5b7351f711a7f16a8d3f7d32524 /src/binary.c
parentc4f9b35d4ccb5bb82c4927daddd34d7a828bff3c (diff)
Parsed x86 binary data and displayed the result.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@6 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/binary.c')
-rw-r--r--src/binary.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/binary.c b/src/binary.c
new file mode 100644
index 0000000..79928d6
--- /dev/null
+++ b/src/binary.c
@@ -0,0 +1,78 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * binary.c - traitement des flots de code binaire
+ *
+ * Copyright (C) 2008 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "binary.h"
+
+
+#include "arch/processor.h"
+
+
+
+void fill_snippet(GtkSnippet *snippet)
+{
+ asm_processor *proc;
+ asm_instr *instr;
+
+ // char *data = "\x66\xba\x0c\x00\x00\x00\x66\xb9\x28\x00\x00\x00\x66\xbb\x01\x00\x00\x00\x66\xb8\x04\x00\x00\x00\xcd\x80\x66\xbb\x00\x00\x00\x00\x66\xb8\x01\x00\x00\x00\xcd\x80\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x0a";
+
+ char *data = "\x66\xbb\x00\x00\x00\x00\x66\xb8\x01\x00\x00\x00\xcd\x80\x90";
+
+ off_t pos;
+ off_t len;
+
+ char buffer[64];
+
+ uint64_t base = 0;
+ uint64_t offset = 0;
+
+ proc = create_x86_processor();
+
+ pos = 0;
+ len = 15;
+
+
+
+ gtk_snippet_set_processor(snippet, proc);
+
+
+ gtk_snippet_add_line(snippet, offset, NULL, "Simple HelloWorld !");
+
+
+ while (pos < len)
+ {
+ offset = base + pos;
+
+ instr = decode_instruction(proc, data, &pos, len);
+
+ gtk_snippet_add_line(snippet, offset, instr, NULL);
+
+
+ }
+
+ /*
+ gtk_snippet_build_content(snippet);
+ */
+
+
+}
+