Update the android manifest related feature
This commit is contained in:
parent
52ed5fe3ea
commit
7d846847f6
|
@ -190,10 +190,17 @@
|
|||
<None Include="Resources\document_paperclip_list_paper_icon_219544.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\OneDrive\문서\GitHub\androidxmldotnet\AndroidXml\AndroidXml.csproj">
|
||||
<Project>{607eeb2c-6b7c-409e-959e-3b458a109426}</Project>
|
||||
<Name>AndroidXml</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\OneDrive\문서\GitHub\SsdeepNET\Source\SsdeepNET\SsdeepNET.csproj">
|
||||
<Project>{b1244c5a-cdeb-4d1d-8807-bf40251abcab}</Project>
|
||||
<Name>SsdeepNET</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\2333410-android-os-smartphone_85588.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,9 +1,15 @@
|
|||
using Catswords.DataType.Client.Model;
|
||||
using AndroidXml;
|
||||
using Catswords.DataType.Client.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Catswords.DataType.Client.Helper
|
||||
{
|
||||
|
@ -48,21 +54,30 @@ namespace Catswords.DataType.Client.Helper
|
|||
{
|
||||
List<AndroidPermission> permissions = new List<AndroidPermission>();
|
||||
|
||||
// Read the AndroidManifest.xml file
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(ManifestPath);
|
||||
|
||||
// Find all <uses-permission> elements
|
||||
XmlNodeList permissionNodes = doc.GetElementsByTagName("uses-permission");
|
||||
foreach (XmlNode node in permissionNodes)
|
||||
using (FileStream stream = File.OpenRead(ManifestPath))
|
||||
{
|
||||
// Extract permissions
|
||||
permissions.Add(new AndroidPermission
|
||||
// Read the AndroidManifest.xml file
|
||||
var reader = new AndroidXmlReader(stream);
|
||||
XDocument doc = XDocument.Load(reader);
|
||||
|
||||
// Find all <uses-permission> elements
|
||||
var permissionNodes = doc.Descendants().Where(e => e.Name.LocalName == "uses-permission");
|
||||
foreach (var node in permissionNodes)
|
||||
{
|
||||
Name = node.Attributes["android:name"].Value,
|
||||
Description = "",
|
||||
Severity = 0
|
||||
});
|
||||
foreach (var attr in node.Attributes())
|
||||
{
|
||||
if (attr.Name.LocalName == "name")
|
||||
{
|
||||
permissions.Add(new AndroidPermission
|
||||
{
|
||||
Name = attr.Value,
|
||||
Description = "",
|
||||
Severity = 0,
|
||||
CreatedAt = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return permissions;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Catswords.DataType.Client.Helper
|
|||
Indicators.Add(new Indicator()
|
||||
{
|
||||
Id = itemNode.SelectSingleNode("id").InnerText,
|
||||
CreatedAt = FormatDateTime(itemNode.SelectSingleNode("datetime").InnerText),
|
||||
CreatedAt = GetDateTimeFromString(itemNode.SelectSingleNode("datetime").InnerText),
|
||||
Content = itemNode.SelectSingleNode("description").InnerText,
|
||||
Url = ""
|
||||
});
|
||||
|
@ -54,16 +54,22 @@ namespace Catswords.DataType.Client.Helper
|
|||
}
|
||||
}
|
||||
|
||||
public string FormatDateTime(string dateString)
|
||||
public static DateTime GetDateTimeFromString(string dateString)
|
||||
{
|
||||
string formattedDateTime = "";
|
||||
DateTime parsedDateTime;
|
||||
|
||||
if (DateTime.TryParseExact(dateString, "yyyy-MM-dd HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out DateTime parsedDateTime))
|
||||
if (DateTime.TryParseExact(dateString, "yyyy-MM-dd HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out parsedDateTime))
|
||||
{
|
||||
formattedDateTime = parsedDateTime.ToString();
|
||||
return parsedDateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
parsedDateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
return formattedDateTime;
|
||||
return parsedDateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,21 +33,22 @@ namespace Catswords.DataType.Client.Helper
|
|||
return result;
|
||||
}
|
||||
|
||||
public static string FormatDateTime(string dateString)
|
||||
public static DateTime GetDateTimeFromString(string dateString)
|
||||
{
|
||||
string formattedDateTime = "";
|
||||
DateTime localTime;
|
||||
|
||||
// 날짜와 시간을 파싱
|
||||
if (DateTime.TryParseExact(dateString, "MM/dd/yyyy HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out DateTime parsedDateTime))
|
||||
{
|
||||
// UTC에서 로컬 시간으로 변환
|
||||
DateTime localTime = parsedDateTime.ToLocalTime();
|
||||
|
||||
// 현재 스레드의 문화권에 따라 날짜와 시간 출력
|
||||
formattedDateTime = localTime.ToString();
|
||||
localTime = parsedDateTime.ToLocalTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
localTime = DateTime.Now;
|
||||
}
|
||||
|
||||
return formattedDateTime;
|
||||
return localTime;
|
||||
}
|
||||
|
||||
public void Fetch(string q)
|
||||
|
@ -78,7 +79,7 @@ namespace Catswords.DataType.Client.Helper
|
|||
|
||||
Indicators.Add(new Indicator
|
||||
{
|
||||
CreatedAt = FormatDateTime(createdAt),
|
||||
CreatedAt = GetDateTimeFromString(createdAt),
|
||||
Content = RemoveHtmlTags(content)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
namespace Catswords.DataType.Client.Model
|
||||
using System;
|
||||
|
||||
namespace Catswords.DataType.Client.Model
|
||||
{
|
||||
class AndroidPermission
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int Severity { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
namespace Catswords.DataType.Client.Model
|
||||
using System;
|
||||
|
||||
namespace Catswords.DataType.Client.Model
|
||||
{
|
||||
public class Indicator
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string CreatedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,16 @@ namespace Catswords.DataType.Client.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap _2333410_android_os_smartphone_85588 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("_2333410_android_os_smartphone_85588", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
|
|
|
@ -133,4 +133,7 @@
|
|||
<data name="message_bubble_conversation_speech_communication_talk_chat_icon_219299" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\message_bubble_conversation_speech_communication_talk_chat_icon_219299.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_2333410_android_os_smartphone_85588" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\2333410-android-os-smartphone_85588.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
|
@ -58,7 +58,7 @@
|
|||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "Opinion";
|
||||
this.columnHeader2.Text = "Description";
|
||||
this.columnHeader2.Width = 200;
|
||||
//
|
||||
// label1
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Catswords.DataType.Client
|
|||
// Set image size
|
||||
imageList.Images.Add(Properties.Resources.data_database_icon_177024);
|
||||
imageList.Images.Add(Properties.Resources.message_bubble_conversation_speech_communication_talk_chat_icon_219299);
|
||||
imageList.Images.Add(Properties.Resources._2333410_android_os_smartphone_85588);
|
||||
|
||||
// set image list
|
||||
listView1.SmallImageList = imageList;
|
||||
|
@ -72,11 +73,11 @@ namespace Catswords.DataType.Client
|
|||
// Get data from file extension database
|
||||
FetchFromFileExtensionDB();
|
||||
|
||||
// Get data from timeline
|
||||
FetchFromTimeline();
|
||||
|
||||
// Get data from Android manifest
|
||||
FetchFromAndroidManifest();
|
||||
|
||||
// Get data from timeline
|
||||
FetchFromTimeline();
|
||||
}
|
||||
|
||||
private void FetchFromFileExtensionDB()
|
||||
|
@ -85,7 +86,7 @@ namespace Catswords.DataType.Client
|
|||
search.Fetch(fileExtension);
|
||||
foreach (Indicator ind in search.Indicators)
|
||||
{
|
||||
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt, ind.Content }, 0));
|
||||
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt.ToString(), ind.Content }, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +144,7 @@ namespace Catswords.DataType.Client
|
|||
// Show the timeline
|
||||
foreach (Indicator ind in search.Indicators)
|
||||
{
|
||||
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt, ind.Content }, 1));
|
||||
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt.ToString(), ind.Content }, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,10 +153,12 @@ namespace Catswords.DataType.Client
|
|||
if (fileExtension == "apk")
|
||||
{
|
||||
var extractor = new ApkManifestExtractor(filePath);
|
||||
extractor.Open();
|
||||
foreach (AndroidPermission perm in extractor.GetPermissions())
|
||||
{
|
||||
listView1.Items.Add(new ListViewItem(new string[] { perm.Name, perm.Description }));
|
||||
listView1.Items.Add(new ListViewItem(new string[] { perm.CreatedAt.ToString(), perm.Name + ' ' + perm.Description }, 2));
|
||||
}
|
||||
extractor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Catswords.DataType.Client",
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SsdeepNET", "..\..\..\OneDrive\문서\GitHub\SsdeepNET\Source\SsdeepNET\SsdeepNET.csproj", "{B1244C5A-CDEB-4D1D-8807-BF40251ABCAB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AndroidXml", "..\..\..\OneDrive\문서\GitHub\androidxmldotnet\AndroidXml\AndroidXml.csproj", "{607EEB2C-6B7C-409E-959E-3B458A109426}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -41,6 +43,18 @@ Global
|
|||
{B1244C5A-CDEB-4D1D-8807-BF40251ABCAB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B1244C5A-CDEB-4D1D-8807-BF40251ABCAB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B1244C5A-CDEB-4D1D-8807-BF40251ABCAB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|x64.Build.0 = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{607EEB2C-6B7C-409E-959E-3B458A109426}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Reference in New Issue
Block a user