summaryrefslogtreecommitdiff
path: root/tools/ffuzzer/process.py
blob: c1bf2b70a12d4695514a9989348722be22ca8d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-

from gi.repository import Gtk
from pychrysalide.analysis import LoadedBinary
from pychrysalide.analysis.contents import FileContent

import sys

for arg in sys.argv[1:]:

    fc = FileContent(arg)

    print('  --> file content:', fc)

    binary = LoadedBinary(fc)

    print('  --> loaded binary:', binary)

    if binary is not None:

        def disassembly_is_done(obj, binary):
            Gtk.main_quit()

        binary.connect('disassembly-done', disassembly_is_done, binary)

        binary.analyse()

        # Attente de la réception du signal
        # Cf. http://stackoverflow.com/questions/28873688/python-how-to-block-in-pygtk-while-waiting-for-timeout-add-callback
        Gtk.main()