ppt4j 1.0
 
Loading...
Searching...
No Matches
ppt4j.factory.ExtractorFactory Class Reference

Public Member Functions

JavaExtractor getPreJavaClass (String className)
 
JavaExtractor getPostJavaClass (String className)
 
BytecodeExtractor getBytecodeClass (String className) throws IOException
 
CrossMatcher getPre2Class (String className) throws IOException
 
CrossMatcher getPost2Class (String className) throws IOException
 

Static Public Member Functions

static ExtractorFactory get (String prepatchPath, String postpatchPath, String classPath, String... thirdPartySrcPath)
 
static ExtractorFactory get (Vulnerability vuln, DatabaseType type)
 

Member Function Documentation

◆ get() [1/2]

static ExtractorFactory ppt4j.factory.ExtractorFactory.get ( String prepatchPath,
String postpatchPath,
String classPath,
String... thirdPartySrcPath )
static

Returns an instance of ExtractorFactory initialized with the provided prepatchPath, postpatchPath, classPath, and thirdPartySrcPath.

Parameters
prepatchPaththe path to the pre-patch files
postpatchPaththe path to the post-patch files
classPaththe class path for the ExtractorFactory
thirdPartySrcPathadditional source paths (optional)
Returns
an instance of ExtractorFactory

◆ get() [2/2]

static ExtractorFactory ppt4j.factory.ExtractorFactory.get ( Vulnerability vuln,
DatabaseType type )
static

Retrieves an ExtractorFactory based on the specified Vulnerability and DatabaseType. This method generates necessary paths, checks the VM class path, and initializes the ExtractorFactory.

Parameters
vulnthe Vulnerability object
typethe DatabaseType object
Returns
the ExtractorFactory object

◆ getBytecodeClass()

BytecodeExtractor ppt4j.factory.ExtractorFactory.getBytecodeClass ( String className) throws IOException

Retrieves the bytecode of a class specified by the given class name. If the bytecode for the class is already cached, it returns the cached instance. If the class is contained within a JAR file, it extracts the bytecode from the JAR file. If the class is not found in the JAR file, it logs a debug message and returns a nil BytecodeExtractor. If the class is not within a JAR file, it extracts the bytecode from the classpath directory. It parses the extracted bytecode, adds any inner classes found within the same directory or JAR file, caches the extracted bytecode, and returns the BytecodeExtractor instance.

Parameters
classNamethe name of the class for which bytecode needs to be extracted
Returns
the BytecodeExtractor instance containing the bytecode of the specified class
Exceptions
IOExceptionif an I/O error occurs while attempting to extract bytecode

◆ getPost2Class()

CrossMatcher ppt4j.factory.ExtractorFactory.getPost2Class ( String className) throws IOException

Retrieves a CrossMatcher object associated with a given class name. If the CrossMatcher object is already cached, it is returned directly. Otherwise, a new CrossMatcher object is created using the class name to retrieve the corresponding Java class and bytecode class. The new CrossMatcher object is then cached for future use.

Parameters
classNamethe name of the class to retrieve the CrossMatcher object for
Returns
the CrossMatcher object associated with the provided class name
Exceptions
IOExceptionif an I/O error occurs during the retrieval process

◆ getPostJavaClass()

JavaExtractor ppt4j.factory.ExtractorFactory.getPostJavaClass ( String className)

Returns a JavaExtractor object for the specified class name from the cachedPostExtractors map. If the JavaExtractor object does not exist in the map, a new JavaExtractor object is created using the specified class name and added to the map before returning.

Parameters
classNamethe name of the Java class to extract
Returns
the JavaExtractor object for the specified class name

◆ getPre2Class()

CrossMatcher ppt4j.factory.ExtractorFactory.getPre2Class ( String className) throws IOException

Retrieves a CrossMatcher object for the given class name. If the CrossMatcher object for the class name is already cached, it is returned. Otherwise, a new CrossMatcher object is created using the pre-java class and bytecode class of the given class name, and then cached for future use.

Parameters
classNamethe name of the class
Returns
the CrossMatcher object for the given class name
Exceptions
IOExceptionif an I/O error occurs

◆ getPreJavaClass()

JavaExtractor ppt4j.factory.ExtractorFactory.getPreJavaClass ( String className)

Retrieves a pre-patch Java class extractor for the specified class name.

Parameters
classNamethe name of the Java class to extract
Returns
a JavaExtractor object for the specified class name from the pre-patch database

The documentation for this class was generated from the following file: