Skip to content

Instantly share code, notes, and snippets.

@k3170makan
k3170makan / symbolic_registers.py
Created December 31, 2019 18:07
Example of modeling register values using angr
#!/usr/bin/python3
import angr
import claripy
import sys
def solve(binary="",target=0x0,start=0x0,avoid=[]):
padding_length = 32
project = angr.Project(binary)
@k3170makan
k3170makan / argv_example.angr.py
Created December 31, 2019 16:44
Example of using an argv constraint with angr
#!/usr/bin/python3
import angr
import sys
import claripy
def solve(elf_binary="./binary.elf"):
project = angr.Project(elf_binary)
argv = claripy.BVS('argv',8*0x6)
#!/usr/bin/python3
import angr
import sys
import claripy
def solve(elf_binary="./binary.elf"):
project = angr.Project(elf_binary) #load up binary
arg = claripy.BVS('arg',8*0x20) #set a bit vector for argv[1]
#!/usr/bin/python3
import angr
import sys
import claripy
def solve(elf_binary="./binary.elf"):
project = angr.Project(elf_binary)
arg = claripy.BVS('arg',8*0x20)
@k3170makan
k3170makan / file_opreations_finder.sh
Created May 17, 2019 07:30
Quick script for finding device file_operations structs quickly and opening them in vim
for line in `grep --color=never * -Rnie file_operations`; do LINE=`echo $line | awk -F\: '{ print $2 }'`; FILE=`echo $line | awk -F\: '{ print $1 }'`; [ "$LINE" != "" ] && echo "[*] vim +"$LINE" $FILE"; done > vim_cmds.sh
@k3170makan
k3170makan / log.txt
Created March 7, 2019 02:12
example log output of successfull verilog synthesize with project icestorm for the icestick40
>make
yosys -p 'synth_ice40 -top top -blif example.blif' example.v
/----------------------------------------------------------------------------\
| |
| yosys -- Yosys Open SYnthesis Suite |
| |
| Copyright (C) 2012 - 2018 Clifford Wolf <clifford@clifford.at> |
| |
| Permission to use, copy, modify, and/or distribute this software for any |
@k3170makan
k3170makan / LEDBlinker.v
Last active March 7, 2019 02:03
LEDBlinker.v
`default_nettype none
module top(
input clk, //clock input
output reg LED1, //LED outputs
output reg LED2,
output reg LED3,
output reg LED4,
output reg LED5
);
@k3170makan
k3170makan / icestick.pcf
Created March 7, 2019 01:32
Example pcf file for ICE40 FPGA board
set_io --warn-no-port RX 9
set_io --warn-no-port TX 8
set_io LED1 99
set_io LED2 98
set_io LED3 97
set_io LED4 96
set_io LED5 95
set_io clk 21
@k3170makan
k3170makan / icemaker.sh
Created March 7, 2019 01:23
Cheat bash script to make setting up project icestorm tools easier
cat /etc/lsb-release
sudo apt-get install build-essential clang bison flex libreadline-dev\
gawk tcl-dev libffi-dev git mercurial graphviz\
xdot pkg-config python python3 libftdi-dev\
qt5-default python3-dev libboost-all-dev cmake
git clone https://github.com/cliffordwolf/icestorm.git icestorm
cd icestorm
make -j$(nproc)
@k3170makan
k3170makan / Makefile
Created March 7, 2019 00:55
ICEStick Makefile example
VER=example
DEV=1k
all: $(VER).txt
icepack $(VER).txt $(VER).bin
$(VER).txt: $(VER).blif
arachne-pnr -d $(DEV) -p $(VER).pcf $(VER).blif -o $(VER).txt
$(VER).blif: $(VER).v
yosys -p 'synth_ice40 -top top -blif $(VER).blif' $(VER).v