<commit_before>#!/usr/bin/env python

# pylint: disable=W0201
# pylint: disable=W0703

import os
import pyvex # pylint: disable=F0401
import simuvex # pylint: disable=F0401
import cPickle as pickle
import collections
import struct
import md5

from .binary import Binary
from .memory_dict import MemoryDict
from .errors import AngrException

import logging
l = logging.getLogger("angr.project")

granularity = 0x1000000

class Project(object): # pylint: disable=R0904,
	def __init__(self, filename, arch="AMD64", load_libs=True, use_sim_procedures=False, default_analysis_mode='static'):
		self.binaries = { }
		self.arch = arch
		self.dirname = os.path.dirname(filename)
		self.filename = os.path.basename(filename)
		self.default_analysis_mode = default_analysis_mode

		l.info("Loading binary %s" % self.filename)
		l.debug("... from directory: %s", self.dirname)
		self.binaries[self.filename] = Binary(filename, arch)
		self.min_addr = self.binaries[self.filename].min_addr()
		self.max_addr = self.binaries[self.filename].max_addr()
		self.entry = self.binaries[self.filename].entry()
		self.sim_procedures = { } # This is a map from IAT addr to SimProcedure

		if load_libs:
			self.load_libs()
			self.resolve_imports_from_libs()
		if use_sim_procedures:
			self.resolve_imports_using_sim_procedures()

		self.mem = MemoryDict(self.binaries, 'mem')
		self.perm = MemoryDict(self.binaries, 'perm', granularity=0x1000) # TODO: arch-dependent pages<commit_msg>add option for not resolving imports<commit_after>#!/usr/bin/env python

# pylint: disable=W0201
# pylint: disable=W0703

import os
import pyvex # pylint: disable=F0401
import simuvex # pylint: disable=F0401
import cPickle as pickle
import collections
import struct
import md5

from .binary import Binary
from .memory_dict import MemoryDict
from .errors import AngrException

import logging
l = logging.getLogger("angr.project")

granularity = 0x1000000

class Project(object): # pylint: disable=R0904,
	def __init__(self, filename, arch="AMD64", load_libs=True, resolve_imports=True, use_sim_procedures=False, default_analysis_mode='static'):
		self.binaries = { }
		self.arch = arch
		self.dirname = os.path.dirname(filename)
		self.filename = os.path.basename(filename)
		self.default_analysis_mode = default_analysis_mode

		l.info("Loading binary %s" % self.filename)
		l.debug("... from directory: %s", self.dirname)
		self.binaries[self.filename] = Binary(filename, arch)
		self.min_addr = self.binaries[self.filename].min_addr()
		self.max_addr = self.binaries[self.filename].max_addr()
		self.entry = self.binaries[self.filename].entry()
		self.sim_procedures = { } # This is a map from IAT addr to SimProcedure

		if load_libs:
			self.load_libs()
			if resolve_imports:
				self.resolve_imports_from_libs()
		if use_sim_procedures:
			self.resolve_imports_using_sim_procedures()

		self.mem = MemoryDict(self.binaries, 'mem')
		self.perm = MemoryDict(self.binaries, 'perm', granularity=0x1000) # TODO: arch-dependent pages
{'fraction_non_alphanumeric': 0.11177844511177845, 'fraction_numerical': 0.024024024024024024, 'mean_word_length': 5.285115303983228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6734301', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1004, 'n_words': 225}