Skip to content

Instantly share code, notes, and snippets.

View RobinDavid's full-sized avatar

Robin David RobinDavid

View GitHub Profile
@RobinDavid
RobinDavid / get_prob_ida.py
Created April 28, 2020 10:58
Getting all problems in IDA Pro
import ida_ida
import ida_problems
import ida_idaapi
from enum import IntEnum
PrType = IntEnum("PrType", {x: getattr(ida_problems, x) for x in dir(ida_problems) if x.startswith("PR_") and x!="PR_END"})
problems = {}
@RobinDavid
RobinDavid / tokenize_line.py
Created June 28, 2020 18:36
Tokenize a given line as provided by IDA
import ida_lines
import ida_kernwin
from enum import Enum
def tokenize_line(line):
COLOR_ON = "\x01"
COLOR_OFF = "\x02"
blacklist = ["SCOLOR_ON", "SCOLOR_OFF", "SCOLOR_ESC", "SCOLOR_INV", "SCOLOR_UTF8", "SCOLOR_FG_MAX"]
tag_mapping = Enum("TagMapping", {x: getattr(ida_lines, x) for x in dir(ida_lines) if (x.startswith("SCOLOR_") and x not in blacklist)})
@RobinDavid
RobinDavid / pls.py
Created August 30, 2020 17:46
SMT formula very hard to solve, even though its size is rather small
#!/usr/bin/env python3
import z3
a = z3.BitVec("a", 8)
b = z3.BitVec("b", 8)
c = z3.BitVec("c", 8)
d = z3.BitVec("d", 8)
e = z3.BitVec("e", 8)
solver = z3.SolverFor("QF_BV")
@RobinDavid
RobinDavid / extract-pixmap.py
Created November 14, 2024 22:50
Extract the first page as a PNG file.
import fitz # PyMuPDF
import sys
from pathlib import Path
def extract_png_from_pdf(pdf_file, output_path):
# Ouvrir le fichier PDF
pdf_document = fitz.open(pdf_file)
# Sélectionner la première page
first_page = pdf_document[0]
@RobinDavid
RobinDavid / mk_strings.py
Created January 7, 2025 21:12
Try creating strings whenever possible in the given range in IDA
import ida_bytes
from ida_idaapi import BADADDR
import ida_nalt
def mk_strings(ea: int, end: int = BADADDR):
addr = ea
while True:
addr = ida_bytes.next_unknown(addr, end)
if addr == end: