$ cmake -DLLVM_ENABLE_PROJECTS=clang -G Ninja ../llvm -DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True \
-DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False \
-DDEFAULT_SYSROOT="/etc/path/to/riscv64-unknown-elf" \
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf" \
-DLLVM_TARGETS_TO_BUILD="RISCV"
$ cmake --build .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import r2pipe | |
import glob | |
import os | |
target_path = "data/malware" | |
def is_packed(entropy): | |
return any(filter(lambda x: x > 6.8, entropy)) | |
cnt = 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <linux/elf.h> | |
#include <sys/ptrace.h> | |
#include <linux/ptrace.h> | |
#include <sys/types.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define GET_PC ({ register long tmp asm("a0");\ | |
__asm__ __volatile__ ("auipc %0, 0\n\t": "=r"(tmp));\ | |
tmp; }) | |
int main() { | |
const int pc = GET_PC; | |
printf("%x\n", pc); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example::sum: | |
xor eax, eax | |
cmp edi, 2 | |
jl .LBB0_2 | |
lea eax, [rdi - 2] | |
lea ecx, [rdi - 3] | |
imul rcx, rax | |
shr rcx | |
lea eax, [rcx + 2*rdi] | |
add eax, -3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
void bubble(char* p) { | |
const size_t len = strlen(p); | |
for (size_t i = 0; i < len; i++) { | |
for (size_t j = i+1; j < len; j++) { | |
const char tmp0 = p[i]; | |
const char tmp1 = p[j]; | |
if (tmp0 > tmp1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# An example hook script to verify what is about to be pushed. Called by "git | |
# push" after it has checked the remote status, but before anything has been | |
# pushed. If this script exits with a non-zero status nothing will be pushed. | |
# | |
# This hook is called with the following parameters: | |
# | |
# $1 -- Name of the remote to which the push is being done | |
# $2 -- URL to which the push is being done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00000000010922e0 <main.norm2AsRef>: | |
10922e0: 48 8b 44 24 08 mov rax,QWORD PTR [rsp+0x8] | |
10922e5: f2 0f 10 00 movsd xmm0,QWORD PTR [rax] | |
10922e9: f2 0f 10 48 08 movsd xmm1,QWORD PTR [rax+0x8] | |
10922ee: f2 0f 10 50 10 movsd xmm2,QWORD PTR [rax+0x10] | |
10922f3: f2 0f 59 c0 mulsd xmm0,xmm0 | |
10922f7: f2 0f 59 c9 mulsd xmm1,xmm1 | |
10922fb: f2 0f 58 c1 addsd xmm0,xmm1 | |
10922ff: f2 0f 59 d2 mulsd xmm2,xmm2 | |
1092303: f2 0f 58 c2 addsd xmm0,xmm2 |