예제 #1
0
def test(file_name, ind, file_name1, ind1):
    from parser_1 import parse_file
    from struct_dump import _pprint
    assert file_name[-5:] == ".json"
    assert file_name1[-5:] == ".json"
    trace = parse_file(file_name)
    trace_1 = parse_file(file_name1)
    print(trace)
    graphs = []
    tx = trace[ind]
    tx1 = trace_1[ind1]
    # print("length test",len(trace))
    graph = Graph(tx.call_level_traces, "a")
    graph1 = Graph(tx1.call_level_traces, "b")
    # dot = Digraph(comment=tx.tx_hash)
    # dot.node("A","test")
    # dot.node("B", "test1")
    # dot.node("C","test3")
    # dot.edge("A","B","edge")
    # dot.edge("A","C","test22",style="dotted",color="red")
    # dot.render("test.gv")
    # graph = Graph(tx)
    graph.render("%s.gv" % ("crosslinker"))

    graph1.render("%s.gv" % ("crosslinker"))
    # graph.render("test.gv")
    graphs.append(graph)
    graphs.append(graph1)
    print(graphs)
    _pprint(graphs)
예제 #2
0
def test(file_name, ind):
    from trace_parser import parse_file
    from struct_dump import _pprint
    assert file_name[-5:] == ".json"
    trace = parse_file(file_name)
    graphs = []
    # for i in range(len(trace)):
    tx = trace[ind]
    graph = Graph(tx)
    graph.render("%s_%d.gv" % (file_name[:-5], ind))
    graphs.append(graph)
    _pprint(graphs)
예제 #3
0
def test(file_name, ind):
    from parser_1 import parse_file
    from struct_dump import _pprint
    assert file_name[-5:] == ".json"
    trace = parse_file(file_name)
    print(trace)
    graphs = []
    tx = trace[ind]
    graph = Graph(tx.call_level_traces)
    graph.render("%s_%d.gv" % (file_name[:-5], ind))
    graphs.append(graph)
    _pprint(graphs)
예제 #4
0
def test(file_name, ind):
    from parser_1 import parse_file
    from struct_dump import _pprint
    assert file_name[-5:] == ".json"
    trace = parse_file(file_name)
    print(trace)
    graphs = []

    tx = trace[ind]
    print("length test", len(trace))
    graph = Graph(tx.call_level_traces)
    # dot = Digraph(comment=tx.tx_hash)
    # dot.node("A","test")
    # dot.node("B", "test1")
    # dot.node("C","test3")
    # dot.edge("A","B","edge")
    # dot.edge("A","C","test22",style="dotted",color="red")
    # dot.render("test.gv")
    # graph = Graph(tx)
    graph.render("%s_%d.gv" % (file_name[:-5], ind))
    # graph.render("test.gv")
    graphs.append(graph)
    print(graphs)
    _pprint(graphs)
예제 #5
0
def test(file_name):
    from struct_dump import _pprint
    assert file_name[-5:] == ".json"
    _pprint(parse_file(file_name))
예제 #6
0
    def greybox_trxn(self, tx_id):
        tx = self.DFG[tx_id]
        newcalls = []
        for call in tx.call_level_traces:
            # newcalls.append(self.greybox_call(tx_id, call.call_id))
            if call.call_tree_path == []:
                rootcall = call
                break
        for call in tx.call_level_traces:
            if call.call_id != rootcall.call_id:
                rootcall.taints.extend(call.taints)
        print("all taints")
        for taint in rootcall.taints:
            print(str(taint.serial_id) + " " + taint.name)
        tx.call_level_traces = [rootcall]
        tx.call_level_traces = [self.greybox_call(tx_id, rootcall.call_id)]

        return tx

if __name__ == "__main__":
    trs = Transformer("traces/", 12345679)
    # call = trs.greybox_call(0, 0)
    # _pprint(call)
    # graph = Graph([call])
    # graph.render("%s_%d.gv" % (12345679, 0))
    trxn = trs.greybox_trxn(0)
    _pprint(trxn)
    graph = Graph(trxn.call_level_traces)
    graph.render("%s_%d.gv" % (12345679, 111))