Skip to content

Commit

Permalink
Initial string internationalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdalla committed Nov 14, 2023
1 parent 9701e01 commit 4b0e206
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 19 deletions.
17 changes: 16 additions & 1 deletion iped-app/resources/localization/iped-parsers-messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,19 @@ TelegramReport.joinedByRequest=User joined by Request
TelegramReport.ChannelMigratedFromGroup=This channel migrated from a group
TelegramReport.RecoveredGroup=Recovered deleted group
P2P.FoundInPedoHashDB=* Red lines mean the hashes were found in child porn alert hash databases.
Win10Mail.NotFound=Not Found
Win10Mail.NotFound=Not Found
APKParser.Permissions=Permissions Required
APKParser.Manifest=Manifest XML
APKParser.Package=Package
APKParser.Version=Version
APKParser.SDKVersion=SDK Version
APKParser.Features=Features
APKParser.Signers=Signers
APKParser.SignersV2=Signers(V2)
APKParser.Path=Path
APKParser.Certificate=Certificate
APKParser.Algorithm=Algorithm
APKParser.MD5=MD5
APKParser.OID=OID
APKParser.StartDate=Start Date
APKParser.EndDate=End Date
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,18 @@ TelegramReport.ChannelMigratedFromGroup=Dieser Kanal ist aus einer Gruppe hervor
TelegramReport.RecoveredGroup=wiederhergestellte gelöschte Gruppe
P2P.FoundInPedoHashDB=* Rote Zeile bedeutet, dass der Hash in der KiPo Hash-Datenbank gefunden wurde.
Win10Mail.NotFound=Nicht gefunden
APKParser.Permissions=Permissions Required(TBT)
APKParser.Manifest=Manifest XML(TBT)
APKParser.Package=Package(TBT)
APKParser.Version=Version(TBT)
APKParser.SDKVersion=SDK Version(TBT)
APKParser.Features=Features(TBT)
APKParser.Signers=Signers(TBT)
APKParser.SignersV2=Signers(V2)(TBT)
APKParser.Path=Path(TBT)
APKParser.Certificate=Certificate(TBT)
APKParser.Algorithm=Algorithm(TBT)
APKParser.MD5=MD5(TBT)
APKParser.OID=OID(TBT)
APKParser.StartDate=Start Date(TBT)
APKParser.EndDate=End Date(TBT)
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,18 @@ TelegramReport.ChannelMigratedFromGroup=Este canal ha migrado desde un grupo
TelegramReport.RecoveredGroup=Grupo borrado recuperado
P2P.FoundInPedoHashDB=* Las líneas rojas significan que los hashtags se encontraron en bases de datos de hashtags de alertas de pornografía infantil.
Win10Mail.NotFound=No encontrado
APKParser.Permissions=Permissions Required(TBT)
APKParser.Manifest=Manifest XML(TBT)
APKParser.Package=Package(TBT)
APKParser.Version=Version(TBT)
APKParser.SDKVersion=SDK Version(TBT)
APKParser.Features=Features(TBT)
APKParser.Signers=Signers(TBT)
APKParser.SignersV2=Signers(V2)(TBT)
APKParser.Path=Path(TBT)
APKParser.Certificate=Certificate(TBT)
APKParser.Algorithm=Algorithm(TBT)
APKParser.MD5=MD5(TBT)
APKParser.OID=OID(TBT)
APKParser.StartDate=Start Date(TBT)
APKParser.EndDate=End Date(TBT)
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,18 @@ TelegramReport.ChannelMigratedFromGroup=Questo canale è migrato da un gruppo
TelegramReport.RecoveredGroup=Gruppo cancellato recuperato
P2P.FoundInPedoHashDB=* Le linee rosse indicano che gli hash sono stati trovati nel child porn alert hash databases.
Win10Mail.NotFound=Non trovato
APKParser.Permissions=Permissions Required(TBT)
APKParser.Manifest=Manifest XML(TBT)
APKParser.Package=Package(TBT)
APKParser.Version=Version(TBT)
APKParser.SDKVersion=SDK Version(TBT)
APKParser.Features=Features(TBT)
APKParser.Signers=Signers(TBT)
APKParser.SignersV2=Signers(V2)(TBT)
APKParser.Path=Path(TBT)
APKParser.Certificate=Certificate(TBT)
APKParser.Algorithm=Algorithm(TBT)
APKParser.MD5=MD5(TBT)
APKParser.OID=OID(TBT)
APKParser.StartDate=Start Date(TBT)
APKParser.EndDate=End Date(TBT)
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,18 @@ TelegramReport.ChannelMigratedFromGroup=Este canal migrou de um grupo
TelegramReport.RecoveredGroup=Grupo apagado recuperado
P2P.FoundInPedoHashDB=* Linhas em vermelho indicam que os hashes foram encontrados em bases de hashes de alerta de pornografia infantil
Win10Mail.NotFound=Não Encontrado
APKParser.Permissions=Permissões requeridas
APKParser.Manifest=Manifest XML
APKParser.Package=Pacote
APKParser.Version=Versão
APKParser.SDKVersion=Versão do SDK
APKParser.Features=Características
APKParser.Signers=Assinaturas
APKParser.SignersV2=Assinaturas(V2)
APKParser.Path=Caminho
APKParser.Certificate=Certificado
APKParser.Algorithm=Algorítmo
APKParser.MD5=MD5
APKParser.OID=OID
APKParser.StartDate=Início
APKParser.EndDate=Válido até
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.xml.sax.SAXException;

import iped.parsers.security.CertificateParser;
import iped.parsers.standard.StandardParser;
import iped.parsers.util.Messages;
import iped.parsers.whatsapp.Util;
import iped.utils.IOUtil;
import iped.utils.ImageUtil;
Expand All @@ -54,7 +54,7 @@
public class APKParser extends AbstractParser {
private static final long serialVersionUID = 8308661247390527209L;
private static final MediaType apkMimeType = MediaType.application("vnd.android.package-archive");
private static final Set<MediaType> SUPPORTED_TYPES = Collections.singleton(apkMimeType);
public static final Set<MediaType> SUPPORTED_TYPES = Collections.singleton(apkMimeType);
private static Logger LOGGER = LoggerFactory.getLogger(APKParser.class);

// TODO: Use another property or reuse this one from CertificateParser?
Expand Down Expand Up @@ -116,9 +116,9 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
}

add(xhtml, icon, name);
add(xhtml, "Package", apkMeta.getPackageName(), false);
add(xhtml, "Version", apkMeta.getVersionName(), false);
add(xhtml, "SDK Version", apkMeta.getCompileSdkVersion(), false);
add(xhtml, Messages.getString("APKParser.Package"), apkMeta.getPackageName(), false);
add(xhtml, Messages.getString("APKParser.Version"), apkMeta.getVersionName(), false);
add(xhtml, Messages.getString("APKParser.SDKVersion"), apkMeta.getCompileSdkVersion(), false);

StringBuilder sb = new StringBuilder();
Set<String> seenCertificates = new HashSet<String>();
Expand All @@ -129,7 +129,7 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
}
if (signers != null && !signers.isEmpty()) {
for (ApkSigner s : signers) {
sb.append("Path: ").append(s.getPath()).append("\n");
sb.append(Messages.getString("APKParser.Path") + ": ").append(s.getPath()).append("\n");

for (CertificateMeta m : s.getCertificateMetas()) {
if (seenCertificates.add(m.toString())) {
Expand All @@ -140,7 +140,7 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
}
}
}
add(xhtml, "Signers", sb.toString(), true);
add(xhtml, Messages.getString("APKParser.Signers"), sb.toString(), true);
}

List<ApkV2Signer> signers2 = null;
Expand All @@ -165,7 +165,7 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
for (CertificateMeta m : certificates) {
sb.append(formatCertificate(m));
}
add(xhtml, "Signers V2", sb.toString(), true);
add(xhtml, Messages.getString("APKParser.SignersV2"), sb.toString(), true);
}
}

Expand All @@ -179,18 +179,18 @@ public int compare(UseFeature o1, UseFeature o2) {
for (UseFeature feature : features) {
sb.append(feature.getName()).append("\n");
}
add(xhtml, "Features", sb.toString(), true);
add(xhtml, Messages.getString("APKParser.Features"), sb.toString(), true);

sb.delete(0, sb.length());
List<String> permissions = apkMeta.getUsesPermissions();
Collections.sort(permissions);
for (String permission : permissions) {
sb.append(permission).append("\n");
}
add(xhtml, "Permissions", sb.toString(), true);
add(xhtml, Messages.getString("APKParser.Permissions"), sb.toString(), true);

String manifestXml = apkFile.getManifestXml();
add(xhtml, "Manifest XML", manifestXml, true);
add(xhtml, Messages.getString("APKParser.Manifest"), manifestXml, true);
} finally {
IOUtil.closeQuietly(apkFile);
tmp.close();
Expand All @@ -209,7 +209,6 @@ private void parseEmbeddedCertificate(CertificateMeta m, EmbeddedDocumentExtract
cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(m.getData()));
Metadata certMetadata = new Metadata();
certMetadata.add(StandardParser.INDEXER_CONTENT_TYPE, CertificateParser.PEM_MIME.toString());
certMetadata.add(TikaCoreProperties.RESOURCE_NAME_KEY, cert.getSubjectX500Principal().getName());
extractor.parseEmbedded(new ByteArrayInputStream(m.getData()), xhtml, certMetadata, true);
} catch (CertificateException e) {
Expand Down Expand Up @@ -287,12 +286,17 @@ private String formatCertificate(CertificateMeta m) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
StringBuilder sb = new StringBuilder();
sb.append(" Certificate").append("\n");
sb.append(" Algorithm : ").append(m.getSignAlgorithm()).append("\n");
sb.append(" MD5 : ").append(m.getCertMd5().toUpperCase()).append("\n");
sb.append(" OID : ").append(m.getSignAlgorithmOID()).append("\n");
sb.append(" Start Date : ").append(df.format(m.getStartDate())).append("\n");
sb.append(" End Date : ").append(df.format(m.getEndDate())).append("\n");
sb.append(" "+Messages.getString("APKParser.Certificate")).append("\n");
sb.append(" " + Messages.getString("APKParser.Algorithm") + " : ").append(m.getSignAlgorithm())
.append("\n");
sb.append(" " + Messages.getString("APKParser.MD5") + " : ").append(m.getCertMd5().toUpperCase())
.append("\n");
sb.append(" " + Messages.getString("APKParser.OID") + " : ").append(m.getSignAlgorithmOID())
.append("\n");
sb.append(" " + Messages.getString("APKParser.StartDate") + " : ").append(df.format(m.getStartDate()))
.append("\n");
sb.append(" " + Messages.getString("APKParser.EndDate") + " : ").append(df.format(m.getEndDate()))
.append("\n");
return sb.toString();
}
}

0 comments on commit 4b0e206

Please sign in to comment.