Skip to content

Instantly share code, notes, and snippets.

Avatar

Keith Makan k3170makan

View GitHub Profile
@k3170makan
k3170makan / symbolic_registers.py
Created Dec 31, 2019
Example of modeling register values using angr
View symbolic_registers.py
#!/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 Dec 31, 2019
Example of using an argv constraint with angr
View argv_example.angr.py
#!/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)
View angr-example.py
#!/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]
View angr-example.py
#!/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
Quick script for finding device file_operations structs quickly and opening them in vim
View file_opreations_finder.sh
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 Mar 7, 2019
example log output of successfull verilog synthesize with project icestorm for the icestick40
View log.txt
>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 |
View 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 Mar 7, 2019
Example pcf file for ICE40 FPGA board
View icestick.pcf
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 Mar 7, 2019
Cheat bash script to make setting up project icestorm tools easier
View icemaker.sh
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 Mar 7, 2019
ICEStick Makefile example
View Makefile
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
You can’t perform that action at this time.