Initial commit

This commit is contained in:
Garrett Dickinson 2023-01-23 21:34:50 -06:00
parent 95e7baafd0
commit 2e2056f153
7 changed files with 94 additions and 1 deletions

9
Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "chisel"
version = "0.1.0"
authors = ["Garrett Dickinson <dickinsongarrett@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,2 +1,8 @@
# chisel
Binary analysis tool developed in Rust
`chisel` is a tool for decompiling *nix ELF programs for binary analysis and reverse engineering. This project is being developed alongside coursework for **Auburn University's COMP5970 Binary Program Analysis**.
## Supported Binary formats
`chisel` supports binaries compiled to the [ELF format](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) from most x86 *nix systems, and *does not* currently support macOS Mach-O or Windows PE binaries.

26
src/main.rs Normal file
View File

@ -0,0 +1,26 @@
use std::path;
use std::env;
use std::fs;
use std::process::exit;
fn main() {
let args: Vec<String> = env::args().collect();
let file_path = &args[1];
println!("Got target file '{}'", file_path);
if path::Path::new(file_path).exists() {
println!("File exists, reading '{}'", file_path);
let contents: Result<Vec<u8>, std::io::Error> = fs::read(file_path);
if contents.is_ok() {
let bytes: &Vec<u8> = &contents.expect("");
for byte in bytes {
println!("{}", byte);
}
}
} else {
println!("[Error] '{}' does not exist", file_path);
exit(-1);
}
}

BIN
testing/hello Executable file

Binary file not shown.

5
testing/src/hello.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}

46
testing/src/hello.s Normal file
View File

@ -0,0 +1,46 @@
.file "main.c"
.text
.section .rodata
.LC0:
.string "Hello, World!"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
leaq .LC0(%rip), %rax
movq %rax, %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0"
.section .note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4:

1
testing/testfile Normal file
View File

@ -0,0 +1 @@
hello world