mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 14:54:29 +08:00
Merge remote-tracking branch 'origin/Ghidra_12.1'
This commit is contained in:
+5
-1
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.postgresql.core.Utils;
|
||||||
|
|
||||||
import ghidra.features.bsim.query.client.IDSQLResolution;
|
import ghidra.features.bsim.query.client.IDSQLResolution;
|
||||||
import ghidra.features.bsim.query.client.SQLEffects;
|
import ghidra.features.bsim.query.client.SQLEffects;
|
||||||
import ghidra.features.bsim.query.description.ExecutableRecord;
|
import ghidra.features.bsim.query.description.ExecutableRecord;
|
||||||
@@ -39,7 +41,9 @@ public class ExecutableNameBSimFilterType extends BSimFilterType {
|
|||||||
throws SQLException {
|
throws SQLException {
|
||||||
effect.setExeTable();
|
effect.setExeTable();
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("exetable.name_exec = '").append(atom.value).append('\'');
|
buf.append("exetable.name_exec = '");
|
||||||
|
Utils.escapeLiteral(buf, atom.value, true);
|
||||||
|
buf.append('\'');
|
||||||
effect.addWhere(this, buf.toString());
|
effect.addWhere(this, buf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.postgresql.core.Utils;
|
||||||
|
|
||||||
import ghidra.features.bsim.query.client.IDSQLResolution;
|
import ghidra.features.bsim.query.client.IDSQLResolution;
|
||||||
import ghidra.features.bsim.query.client.SQLEffects;
|
import ghidra.features.bsim.query.client.SQLEffects;
|
||||||
import ghidra.features.bsim.query.description.ExecutableRecord;
|
import ghidra.features.bsim.query.description.ExecutableRecord;
|
||||||
@@ -38,7 +40,9 @@ public class NotExecutableNameBSimFilterType extends BSimFilterType {
|
|||||||
throws SQLException {
|
throws SQLException {
|
||||||
effect.setExeTable();
|
effect.setExeTable();
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("exetable.name_exec != '").append(atom.value).append('\'');
|
buf.append("exetable.name_exec != '");
|
||||||
|
Utils.escapeLiteral(buf, atom.value, true);
|
||||||
|
buf.append('\'');
|
||||||
effect.addWhere(this, buf.toString());
|
effect.addWhere(this, buf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -17,6 +17,8 @@ package ghidra.features.bsim.gui.filters;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.postgresql.core.Utils;
|
||||||
|
|
||||||
import ghidra.features.bsim.query.client.IDSQLResolution;
|
import ghidra.features.bsim.query.client.IDSQLResolution;
|
||||||
import ghidra.features.bsim.query.client.SQLEffects;
|
import ghidra.features.bsim.query.client.SQLEffects;
|
||||||
import ghidra.features.bsim.query.description.ExecutableRecord;
|
import ghidra.features.bsim.query.description.ExecutableRecord;
|
||||||
@@ -40,7 +42,9 @@ public class PathStartsBSimFilterType extends BSimFilterType {
|
|||||||
effect.setExeTable();
|
effect.setExeTable();
|
||||||
effect.setPathTable();
|
effect.setPathTable();
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("position( \'").append(atom.value).append("\' in pathtable.val) = 1");
|
buf.append("position( '");
|
||||||
|
Utils.escapeLiteral(buf, atom.value, true);
|
||||||
|
buf.append("' in pathtable.val) = 1");
|
||||||
effect.addWhere(this, buf.toString());
|
effect.addWhere(this, buf.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-14
@@ -22,6 +22,8 @@ import java.util.*;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.postgresql.core.Utils;
|
||||||
|
|
||||||
import generic.lsh.vector.LSHVector;
|
import generic.lsh.vector.LSHVector;
|
||||||
import generic.lsh.vector.WeightedLSHCosineVectorFactory;
|
import generic.lsh.vector.WeightedLSHCosineVectorFactory;
|
||||||
import ghidra.features.bsim.query.*;
|
import ghidra.features.bsim.query.*;
|
||||||
@@ -104,15 +106,10 @@ public final class PostgresFunctionDatabase
|
|||||||
private void changePassword(Connection c, String username, char[] newPassword)
|
private void changePassword(Connection c, String username, char[] newPassword)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
buffer.append("ALTER ROLE \"");
|
buffer.append("ALTER ROLE ");
|
||||||
buffer.append(username);
|
Utils.escapeIdentifier(buffer, username);
|
||||||
buffer.append("\" WITH PASSWORD '");
|
buffer.append(" WITH PASSWORD '");
|
||||||
for (char ch : newPassword) {
|
Utils.escapeLiteral(buffer, new String(newPassword), true);
|
||||||
if (ch == '\'') {
|
|
||||||
buffer.append(ch); // Escape single quote by appending it twice
|
|
||||||
}
|
|
||||||
buffer.append(ch);
|
|
||||||
}
|
|
||||||
buffer.append('\'');
|
buffer.append('\'');
|
||||||
// Don't think jdbc does anything to this statement to encrypt password before sending it.
|
// Don't think jdbc does anything to this statement to encrypt password before sending it.
|
||||||
// The connection with the server SHOULD be under SSL at this point
|
// The connection with the server SHOULD be under SSL at this point
|
||||||
@@ -194,11 +191,12 @@ public final class PostgresFunctionDatabase
|
|||||||
BSimServerInfo defaultServerInfo =
|
BSimServerInfo defaultServerInfo =
|
||||||
new BSimServerInfo(DBType.postgres, serverInfo.getUserInfo(),
|
new BSimServerInfo(DBType.postgres, serverInfo.getUserInfo(),
|
||||||
serverInfo.getServerName(), serverInfo.getPort(), DEFAULT_DATABASE_NAME);
|
serverInfo.getServerName(), serverInfo.getPort(), DEFAULT_DATABASE_NAME);
|
||||||
String createdbstring = "CREATE DATABASE \"" + serverInfo.getDBName() + '"';
|
StringBuilder sb = new StringBuilder("CREATE DATABASE ");
|
||||||
|
Utils.escapeIdentifier(sb, serverInfo.getDBName());
|
||||||
BSimPostgresDataSource defaultDs =
|
BSimPostgresDataSource defaultDs =
|
||||||
BSimPostgresDBConnectionManager.getDataSource(defaultServerInfo);
|
BSimPostgresDBConnectionManager.getDataSource(defaultServerInfo);
|
||||||
try (Connection db = defaultDs.getConnection(); Statement st = db.createStatement()) {
|
try (Connection db = defaultDs.getConnection(); Statement st = db.createStatement()) {
|
||||||
st.executeUpdate(createdbstring);
|
st.executeUpdate(sb.toString());
|
||||||
postgresDs.initializeFrom(defaultDs);
|
postgresDs.initializeFrom(defaultDs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,8 +262,9 @@ public final class PostgresFunctionDatabase
|
|||||||
|
|
||||||
try (Connection defaultDb = defaultDs.getConnection();
|
try (Connection defaultDb = defaultDs.getConnection();
|
||||||
Statement defaultSt = defaultDb.createStatement()) {
|
Statement defaultSt = defaultDb.createStatement()) {
|
||||||
try (ResultSet rs = defaultSt.executeQuery(
|
StringBuilder sb = new StringBuilder("SELECT 1 FROM pg_database WHERE datname= ");
|
||||||
"SELECT 1 FROM pg_database WHERE datname='" + serverInfo.getDBName() + "'")) {
|
Utils.escapeIdentifier(sb, serverInfo.getDBName());
|
||||||
|
try (ResultSet rs = defaultSt.executeQuery(sb.toString())) {
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
return; // database does not exist
|
return; // database does not exist
|
||||||
}
|
}
|
||||||
@@ -292,7 +291,9 @@ public final class PostgresFunctionDatabase
|
|||||||
postgresDs.dispose(); // disconnect before dropping database
|
postgresDs.dispose(); // disconnect before dropping database
|
||||||
|
|
||||||
Msg.info(this, "Dropping BSim postgresql database: " + serverInfo);
|
Msg.info(this, "Dropping BSim postgresql database: " + serverInfo);
|
||||||
defaultSt.executeUpdate("DROP DATABASE \"" + serverInfo.getDBName() + '"');
|
sb = new StringBuilder("DROP DATABASE ");
|
||||||
|
Utils.escapeIdentifier(sb, serverInfo.getDBName());
|
||||||
|
defaultSt.executeUpdate(sb.toString());
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// ensure
|
// ensure
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ sun.security.x509.X509CertImpl;
|
|||||||
|
|
||||||
java.rmi.server.UID;
|
java.rmi.server.UID;
|
||||||
java.rmi.server.ObjID;
|
java.rmi.server.ObjID;
|
||||||
|
[Ljava.rmi.server.ObjID;
|
||||||
|
|
||||||
java.rmi.dgc.DGC;
|
java.rmi.dgc.DGC;
|
||||||
java.rmi.dgc.Lease;
|
java.rmi.dgc.Lease;
|
||||||
|
|||||||
+3
-2
@@ -51,10 +51,11 @@ public class HCS12ConventionAnalyzer extends AbstractAnalyzer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAnalyze(Program program) {
|
public boolean canAnalyze(Program program) {
|
||||||
// Only analyze HCS12 Programs
|
// Only analyze HCS-12 / HCS-12X Programs
|
||||||
Processor processor = program.getLanguage().getProcessor();
|
Processor processor = program.getLanguage().getProcessor();
|
||||||
|
boolean canDo = "HCS-12".equals(processor.toString()) ||
|
||||||
|
"HCS-12X".equals(processor.toString());
|
||||||
|
|
||||||
boolean canDo = processor.equals(Processor.findOrPossiblyCreateProcessor("HCS12"));
|
|
||||||
if (canDo) {
|
if (canDo) {
|
||||||
xgate = program.getRegister("XGATE");
|
xgate = program.getRegister("XGATE");
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-2
@@ -339,6 +339,20 @@ def getCurrentDateTimeLong() {
|
|||||||
return formattedDate
|
return formattedDate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************
|
||||||
|
* Returns the project object from the given projectDependency
|
||||||
|
*********************************************************************************/
|
||||||
|
def getDependencyProject(p, projectDependency) {
|
||||||
|
if (projectDependency.hasProperty("path")) {
|
||||||
|
// Supported by Gradle 8.11 and later
|
||||||
|
return p.project(projectDependency.path)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Supported in Gradle 8.5, removed in Gradle 9
|
||||||
|
return projectDependency.dependencyProject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Returns true if 'project' has a direct or transitive API project dependency
|
* Returns true if 'project' has a direct or transitive API project dependency
|
||||||
* on the project with path 'targetPath'. The 'targetPath' should be specified
|
* on the project with path 'targetPath'. The 'targetPath' should be specified
|
||||||
@@ -355,11 +369,11 @@ boolean hasApiProjectDependency(Project project, String targetPath) {
|
|||||||
.allDependencies
|
.allDependencies
|
||||||
.withType(org.gradle.api.artifacts.ProjectDependency)
|
.withType(org.gradle.api.artifacts.ProjectDependency)
|
||||||
|
|
||||||
if (apiDeps.any { it.dependencyProject.path == targetPath }) {
|
if (apiDeps.any { getDependencyProject(p, it).path == targetPath }) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiDeps.any { dep -> walk(dep.dependencyProject) }
|
return apiDeps.any { walk(getDependencyProject(p, it)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
walk(project)
|
walk(project)
|
||||||
|
|||||||
Reference in New Issue
Block a user