Update ApkManifestExtractor.cs and more

This commit is contained in:
Namhyeon Go 2024-04-12 16:23:38 +09:00
parent b581a947d2
commit 5d269a31ce
43 changed files with 2353 additions and 0 deletions

22
App.config Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{72A9E640-F785-4202-9CEA-BEC46A9B09B8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Catswords.DataType.Client</RootNamespace>
<AssemblyName>Catswords.DataType.Client</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BencodeNET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BencodeNET.4.0.0\lib\netstandard2.0\BencodeNET.dll</HintPath>
</Reference>
<Reference Include="Crc32.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dc0b95cf99bf4e99, processorArchitecture=MSIL">
<HintPath>..\packages\Crc32.NET.1.2.0\lib\net20\Crc32.NET.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PeNet, Version=4.0.4.0, Culture=neutral, PublicKeyToken=6cf2bfba59bcfb3f, processorArchitecture=MSIL">
<HintPath>..\packages\PeNet.4.0.4\lib\net48\PeNet.dll</HintPath>
</Reference>
<Reference Include="PeNet.Asn1, Version=2.0.1.0, Culture=neutral, PublicKeyToken=1e2e3568f0050bf5, processorArchitecture=MSIL">
<HintPath>..\packages\PeNet.Asn1.2.0.1\lib\net48\PeNet.Asn1.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.Cryptography.Pkcs, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Pkcs.8.0.0\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="Helper\ApkManifestExtractor.cs" />
<Compile Include="Helper\FileHasher.cs" />
<Compile Include="Helper\FileExtensionDB.cs" />
<Compile Include="Helper\FileCompany.cs" />
<Compile Include="Helper\FileMagic.cs" />
<Compile Include="Helper\ImpHash.cs" />
<Compile Include="Helper\Timeline.cs" />
<Compile Include="Model\AndroidPermission.cs" />
<Compile Include="Model\FileHash.cs" />
<Compile Include="Model\Indicator.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserControl1.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UserControl1.Designer.cs">
<DependentUpon>UserControl1.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="UserControl1.resx">
<DependentUpon>UserControl1.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\image1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\fediverse.1024x1020.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\fediverse.256x255.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon_32.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\officedatabase_103574.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\database_theapplication_3365.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\chat_bubble_talk_conversation_talking_snapchat_icon-icons.com_59964.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\message_bubble_conversation_speech_communication_talk_chat_icon_219299.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\data_96285.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\data_database_icon_177024.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ok_done_yes_accept_checklist_checkmark_icon_232033.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\checkmark_checklist_agenda_schedule_budget_wedding_cost_list_planner_icon_255066.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\document_paperclip_list_paper_icon_219544.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

9
Config.cs Normal file
View File

@ -0,0 +1,9 @@
namespace Catswords.DataType.Client
{
public class Config
{
public static string SEARCH_URL = "https://exts.kr/extlist.xml?q=";
public static string MASTODON_HOST = "catswords.social";
public static string MASTODON_ACCESS_TOKEN = "HDVTEfLswvSJZq5MRpim2tp7DifTcgKbMl0mBM5-uHw";
}
}

51
Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,51 @@
namespace Catswords.DataType.Client
{
partial class Form1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.ClientSize = new System.Drawing.Size(384, 469);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Catswords.DataType.Client";
this.Icon = Properties.Resources.icon;
this.ResumeLayout(false);
}
#endregion
}
}

15
Form1.cs Normal file
View File

@ -0,0 +1,15 @@
using System.Windows.Forms;
namespace Catswords.DataType.Client
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
UserControl1 userControl1 = new UserControl1(this);
this.Controls.Add(userControl1);
}
}
}

120
Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

289
Form2.Designer.cs generated Normal file
View File

@ -0,0 +1,289 @@
namespace Catswords.DataType.Client
{
partial class Form2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.labelTitle = new System.Windows.Forms.Label();
this.txtLocale = new System.Windows.Forms.TextBox();
this.txtExtension = new System.Windows.Forms.TextBox();
this.txtHashSha256 = new System.Windows.Forms.TextBox();
this.txtMagic = new System.Windows.Forms.TextBox();
this.txtHashCrc32 = new System.Windows.Forms.TextBox();
this.txtHashSha1 = new System.Windows.Forms.TextBox();
this.txtHashMd5 = new System.Windows.Forms.TextBox();
this.labelLocale = new System.Windows.Forms.Label();
this.labelExtension = new System.Windows.Forms.Label();
this.labelSha256 = new System.Windows.Forms.Label();
this.labelHead32 = new System.Windows.Forms.Label();
this.labelCrc32 = new System.Windows.Forms.Label();
this.labelSha1 = new System.Windows.Forms.Label();
this.labelMd5 = new System.Windows.Forms.Label();
this.labelInfoHash = new System.Windows.Forms.Label();
this.txtInfoHash = new System.Windows.Forms.TextBox();
this.labelTools = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// labelTitle
//
this.labelTitle.AutoSize = true;
this.labelTitle.BackColor = System.Drawing.Color.Transparent;
this.labelTitle.Font = new System.Drawing.Font("Arial", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTitle.Location = new System.Drawing.Point(136, 65);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(105, 34);
this.labelTitle.TabIndex = 0;
this.labelTitle.Text = "Expert";
//
// txtLocale
//
this.txtLocale.Location = new System.Drawing.Point(129, 379);
this.txtLocale.Name = "txtLocale";
this.txtLocale.Size = new System.Drawing.Size(284, 20);
this.txtLocale.TabIndex = 1;
//
// txtExtension
//
this.txtExtension.Location = new System.Drawing.Point(129, 308);
this.txtExtension.Name = "txtExtension";
this.txtExtension.Size = new System.Drawing.Size(284, 20);
this.txtExtension.TabIndex = 1;
//
// txtHashSha256
//
this.txtHashSha256.Location = new System.Drawing.Point(129, 272);
this.txtHashSha256.Name = "txtHashSha256";
this.txtHashSha256.Size = new System.Drawing.Size(284, 20);
this.txtHashSha256.TabIndex = 1;
//
// txtMagic
//
this.txtMagic.Location = new System.Drawing.Point(129, 236);
this.txtMagic.Name = "txtMagic";
this.txtMagic.Size = new System.Drawing.Size(284, 20);
this.txtMagic.TabIndex = 1;
//
// txtHashCrc32
//
this.txtHashCrc32.Location = new System.Drawing.Point(129, 200);
this.txtHashCrc32.Name = "txtHashCrc32";
this.txtHashCrc32.Size = new System.Drawing.Size(284, 20);
this.txtHashCrc32.TabIndex = 1;
//
// txtHashSha1
//
this.txtHashSha1.Location = new System.Drawing.Point(129, 166);
this.txtHashSha1.Name = "txtHashSha1";
this.txtHashSha1.Size = new System.Drawing.Size(284, 20);
this.txtHashSha1.TabIndex = 1;
//
// txtHashMd5
//
this.txtHashMd5.Location = new System.Drawing.Point(129, 132);
this.txtHashMd5.Name = "txtHashMd5";
this.txtHashMd5.Size = new System.Drawing.Size(284, 20);
this.txtHashMd5.TabIndex = 1;
//
// labelLocale
//
this.labelLocale.AutoSize = true;
this.labelLocale.Location = new System.Drawing.Point(30, 383);
this.labelLocale.Name = "labelLocale";
this.labelLocale.Size = new System.Drawing.Size(39, 13);
this.labelLocale.TabIndex = 0;
this.labelLocale.Text = "Locale";
//
// labelExtension
//
this.labelExtension.AutoSize = true;
this.labelExtension.Location = new System.Drawing.Point(30, 311);
this.labelExtension.Name = "labelExtension";
this.labelExtension.Size = new System.Drawing.Size(53, 13);
this.labelExtension.TabIndex = 0;
this.labelExtension.Text = "Extension";
//
// labelSha256
//
this.labelSha256.AutoSize = true;
this.labelSha256.Location = new System.Drawing.Point(30, 275);
this.labelSha256.Name = "labelSha256";
this.labelSha256.Size = new System.Drawing.Size(47, 13);
this.labelSha256.TabIndex = 0;
this.labelSha256.Text = "SHA256";
//
// labelHead32
//
this.labelHead32.AutoSize = true;
this.labelHead32.Location = new System.Drawing.Point(30, 239);
this.labelHead32.Name = "labelHead32";
this.labelHead32.Size = new System.Drawing.Size(36, 13);
this.labelHead32.TabIndex = 0;
this.labelHead32.Text = "Magic";
//
// labelCrc32
//
this.labelCrc32.AutoSize = true;
this.labelCrc32.Location = new System.Drawing.Point(30, 204);
this.labelCrc32.Name = "labelCrc32";
this.labelCrc32.Size = new System.Drawing.Size(41, 13);
this.labelCrc32.TabIndex = 0;
this.labelCrc32.Text = "CRC32";
//
// labelSha1
//
this.labelSha1.AutoSize = true;
this.labelSha1.Location = new System.Drawing.Point(30, 169);
this.labelSha1.Name = "labelSha1";
this.labelSha1.Size = new System.Drawing.Size(35, 13);
this.labelSha1.TabIndex = 0;
this.labelSha1.Text = "SHA1";
//
// labelMd5
//
this.labelMd5.AutoSize = true;
this.labelMd5.Location = new System.Drawing.Point(30, 135);
this.labelMd5.Name = "labelMd5";
this.labelMd5.Size = new System.Drawing.Size(30, 13);
this.labelMd5.TabIndex = 0;
this.labelMd5.Text = "MD5";
//
// labelInfoHash
//
this.labelInfoHash.AutoSize = true;
this.labelInfoHash.Location = new System.Drawing.Point(30, 348);
this.labelInfoHash.Name = "labelInfoHash";
this.labelInfoHash.Size = new System.Drawing.Size(50, 13);
this.labelInfoHash.TabIndex = 0;
this.labelInfoHash.Text = "InfoHash";
//
// txtInfoHash
//
this.txtInfoHash.Location = new System.Drawing.Point(129, 343);
this.txtInfoHash.Name = "txtInfoHash";
this.txtInfoHash.Size = new System.Drawing.Size(284, 20);
this.txtInfoHash.TabIndex = 1;
//
// labelTools
//
this.labelTools.AutoSize = true;
this.labelTools.Font = new System.Drawing.Font("Segoe UI", 9F);
this.labelTools.Location = new System.Drawing.Point(31, 418);
this.labelTools.Name = "labelTools";
this.labelTools.Size = new System.Drawing.Size(34, 15);
this.labelTools.TabIndex = 6;
this.labelTools.Text = "Tools";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.button1.Location = new System.Drawing.Point(129, 418);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(284, 23);
this.button1.TabIndex = 3;
this.button1.Text = "View on ByteViewer...";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Segoe UI", 9F);
this.button2.Location = new System.Drawing.Point(129, 447);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(284, 23);
this.button2.TabIndex = 7;
this.button2.Text = "View on VirusTotal...";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.BackgroundImage = global::Catswords.DataType.Client.Properties.Resources.document_paperclip_list_paper_icon_219544;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(441, 488);
this.Controls.Add(this.button2);
this.Controls.Add(this.labelTools);
this.Controls.Add(this.button1);
this.Controls.Add(this.txtInfoHash);
this.Controls.Add(this.txtLocale);
this.Controls.Add(this.txtExtension);
this.Controls.Add(this.labelTitle);
this.Controls.Add(this.txtHashSha256);
this.Controls.Add(this.labelMd5);
this.Controls.Add(this.txtMagic);
this.Controls.Add(this.labelSha1);
this.Controls.Add(this.txtHashCrc32);
this.Controls.Add(this.labelCrc32);
this.Controls.Add(this.txtHashSha1);
this.Controls.Add(this.labelHead32);
this.Controls.Add(this.txtHashMd5);
this.Controls.Add(this.labelSha256);
this.Controls.Add(this.labelInfoHash);
this.Controls.Add(this.labelLocale);
this.Controls.Add(this.labelExtension);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::Catswords.DataType.Client.Properties.Resources.icon;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form2";
this.Text = "Expert";
this.TopMost = true;
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label labelTitle;
private System.Windows.Forms.TextBox txtLocale;
private System.Windows.Forms.TextBox txtExtension;
private System.Windows.Forms.TextBox txtHashSha256;
private System.Windows.Forms.TextBox txtMagic;
private System.Windows.Forms.TextBox txtHashCrc32;
private System.Windows.Forms.TextBox txtHashSha1;
private System.Windows.Forms.TextBox txtHashMd5;
private System.Windows.Forms.Label labelLocale;
private System.Windows.Forms.Label labelExtension;
private System.Windows.Forms.Label labelSha256;
private System.Windows.Forms.Label labelHead32;
private System.Windows.Forms.Label labelCrc32;
private System.Windows.Forms.Label labelSha1;
private System.Windows.Forms.Label labelMd5;
private System.Windows.Forms.Label labelInfoHash;
private System.Windows.Forms.TextBox txtInfoHash;
private System.Windows.Forms.Label labelTools;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}

54
Form2.cs Normal file
View File

@ -0,0 +1,54 @@
using Catswords.DataType.Client.Model;
using System;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Windows.Forms;
namespace Catswords.DataType.Client
{
public partial class Form2 : Form
{
private UserControl1 parent;
private FileHash hashed;
public Form2(UserControl1 parent)
{
InitializeComponent();
this.parent = parent;
}
private void Form2_Load(object sender, EventArgs e)
{
hashed = Helper.FileHasher.Compute(parent.filePath);
txtExtension.Text = hashed.Extension;
txtHashMd5.Text = hashed.MD5;
txtHashSha1.Text = hashed.SHA1;
txtHashCrc32.Text = hashed.CRC32;
txtHashSha256.Text = hashed.SHA256;
txtMagic.Text = hashed.MAGIC;
txtInfoHash.Text = hashed.InfoHash;
}
private void button1_Click(object sender, EventArgs e)
{
ByteViewer bv = new ByteViewer();
bv.SetFile(parent.filePath); // or SetBytes
Form newForm = new Form();
newForm.Size = new System.Drawing.Size(650, 600);
newForm.Text = "ByteViewer";
newForm.Icon = Properties.Resources.icon;
newForm.MinimizeBox = false;
newForm.MaximizeBox = false;
newForm.FormBorderStyle = FormBorderStyle.FixedSingle;
newForm.Controls.Add(bv);
newForm.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Process.Start("https://www.virustotal.com/gui/file/" + hashed.SHA256);
}
}
}

120
Form2.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,71 @@
using Catswords.DataType.Client.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Xml;
namespace Catswords.DataType.Client.Helper
{
class ApkManifestExtractor
{
private string ApkPath;
private string TempDirectory;
private string ManifestPath;
public ApkManifestExtractor(string ApkPath)
{
this.ApkPath = ApkPath;
}
public void Open()
{
// Create a temporary directory for extraction
TempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(TempDirectory);
using (ZipArchive apkArchive = ZipFile.OpenRead(ApkPath))
{
foreach (ZipArchiveEntry entry in apkArchive.Entries)
{
if (entry.FullName == "AndroidManifest.xml")
{
ManifestPath = Path.Combine(TempDirectory, entry.FullName);
entry.ExtractToFile(ManifestPath);
break;
}
}
}
}
public void Close()
{
// Delete the temporary directory and its contents
Directory.Delete(TempDirectory, true);
}
public List<AndroidPermission> GetPermissions()
{
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)
{
// Extract permissions
permissions.Add(new AndroidPermission
{
Name = node.Attributes["android:name"].Value,
Description = "",
Severity = 0
});
}
return permissions;
}
}
}

101
Helper/FileCompany.cs Normal file
View File

@ -0,0 +1,101 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
namespace Catswords.DataType.Client.Helper
{
public static class FileCompany
{
static public string Read(string filePath)
{
// 회사 정보 추출
string[] companies = new string[] {
GetCompanyInfo(filePath),
GetProductName(filePath),
GetCopyrightInfo(filePath),
GetOrganization(filePath)
};
foreach (string company in companies)
{
if (company != null && !company.Equals(string.Empty))
{
return company;
}
}
return "Unknown";
}
public static string GetOrganization(string filePath)
{
string organization = string.Empty;
// 서명된 파일인 경우 인증서 정보 추출
X509Certificate2 certificate = GetCertificateInfo(filePath);
if (certificate != null)
{
// Subject 필드에서 O (Organization) 값을 찾아 회사 정보 추출
string[] fields = certificate.Subject.Split(',');
foreach (string field in fields)
{
string[] keyValue = field.Trim().Split('=');
if (keyValue.Length == 2 && keyValue[0].Trim().Equals("O", StringComparison.OrdinalIgnoreCase))
{
organization = keyValue[1].Trim();
}
}
}
return organization;
}
public static string GetCompanyInfo(string filePath)
{
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filePath);
return versionInfo.CompanyName;
}
public static string GetProductName(string filePath)
{
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filePath);
return versionInfo.ProductName;
}
public static string GetCopyrightInfo(string filePath)
{
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filePath);
return versionInfo.LegalCopyright;
}
static X509Certificate2 GetCertificateInfo(string filePath)
{
// GetCertificateInfo 구현
try
{
// 파일에 디지털 서명이 있는지 확인
Assembly assembly = Assembly.LoadFile(filePath);
X509Certificate2 certificate = new X509Certificate2(assembly.Location);
// 서명이 유효한지 확인 (옵션)
X509Chain chain = new X509Chain();
chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; // 여러 인증서를 사용하는 경우 인증서 연쇄를 무시할 수 있습니다.
if (chain.Build(certificate))
{
return certificate;
}
else
{
return null;
}
}
catch
{
return null;
}
}
}
}

69
Helper/FileExtensionDB.cs Normal file
View File

@ -0,0 +1,69 @@
using Catswords.DataType.Client.Model;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace Catswords.DataType.Client.Helper
{
class FileExtensionDB
{
public List<Indicator> Indicators;
public FileExtensionDB()
{
Indicators = new List<Indicator>();
}
public void Fetch(string q)
{
try
{
// 원격 주소에서 XML 다운로드
string url = Config.SEARCH_URL + q;
WebClient client = new WebClient();
client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3");
client.Encoding = Encoding.UTF8;
string xmlString = client.DownloadString(url);
// XmlDocument 객체 생성
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
// 루트 노드 가져오기
XmlNodeList itemList = xmlDoc.SelectNodes("/claw/list/item");
// 각 아이템을 반복하며 정보 출력
foreach (XmlNode itemNode in itemList)
{
Indicators.Add(new Indicator()
{
Id = itemNode.SelectSingleNode("id").InnerText,
CreatedAt = FormatDateTime(itemNode.SelectSingleNode("datetime").InnerText),
Content = itemNode.SelectSingleNode("description").InnerText,
Url = ""
});
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
Console.WriteLine("Error: " + ex.Message);
}
}
public string FormatDateTime(string dateString)
{
string formattedDateTime = "";
if (DateTime.TryParseExact(dateString, "yyyy-MM-dd HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out DateTime parsedDateTime))
{
formattedDateTime = parsedDateTime.ToString();
}
return formattedDateTime;
}
}
}

188
Helper/FileHasher.cs Normal file
View File

@ -0,0 +1,188 @@
using BencodeNET.Parsing;
using BencodeNET.Torrents;
using Catswords.DataType.Client.Model;
using Force.Crc32;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Catswords.DataType.Client.Helper
{
public class FileHasher
{
public static FileHash Compute(string filename)
{
string extension = GetExtension(filename);
return new FileHash
{
Extension = extension,
MD5 = GetMD5(filename),
SHA1 = GetSHA1(filename),
MAGIC = GetMAGIC(filename),
CRC32 = GetCRC32(filename),
SHA256 = GetSHA256(filename),
InfoHash = GetInfoHash(filename, extension)
};
}
private static string GetExtension(string filename)
{
try
{
if (Path.GetExtension(filename).Length > 0)
{
return Path.GetExtension(filename).Substring(1).ToUpper();
}
else
{
return "";
}
}
catch (Exception)
{
return "";
}
}
private static string GetMD5(string filename)
{
string checksum = "";
using (MD5 hasher = MD5.Create())
{
using (FileStream stream = File.OpenRead(filename))
{
byte[] hash = hasher.ComputeHash(stream);
checksum = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
return checksum;
}
private static string GetSHA1(string filename)
{
string checksum = "";
using (SHA1 hasher = SHA1.Create())
{
using (FileStream stream = File.OpenRead(filename))
{
byte[] hash = hasher.ComputeHash(stream);
checksum = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
return checksum;
}
private static string GetCRC32(string filename)
{
string checksum = "";
using (FileStream stream = File.OpenRead(filename))
{
MemoryStream ms = new MemoryStream();
stream.CopyTo(ms);
checksum = string.Format("{0:x}", Crc32Algorithm.Compute(ms.ToArray()));
}
return checksum;
}
private static string GetSHA256(string filename)
{
string checksum = "";
using (SHA256 hasher = SHA256.Create())
{
using (FileStream stream = File.OpenRead(filename))
{
var hash = hasher.ComputeHash(stream);
checksum = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
return checksum;
}
public static byte[] GetFileBytes(string filename, int count = 32)
{
byte[] buffer = new byte[count];
using (var stream = File.OpenRead(filename))
{
int offset = 0;
while (offset < count)
{
try
{
int read = stream.Read(buffer, offset, count - offset);
if (read == 0)
throw new System.IO.EndOfStreamException();
offset += read;
}
catch (EndOfStreamException)
{
break;
}
}
System.Diagnostics.Debug.Assert(offset == count);
}
return buffer;
}
private static string GetMAGIC(string filename)
{
return FileMagic.Read(filename);
}
private static string GetInfoHash(string filename, string extension)
{
string checksum = "";
if (extension.ToUpper() == "TORRENT")
{
BencodeParser parser = new BencodeParser();
Torrent torrent = parser.Parse<Torrent>(filename);
checksum = BitConverter.ToString(torrent.GetInfoHashBytes()).Replace("-", "").ToLowerInvariant();
}
return checksum;
}
public static string GetHexView(byte[] Data)
{
string output = "";
StringBuilder strb = new StringBuilder();
StringBuilder text = new StringBuilder();
char[] ch = new char[1];
for (int x = 0; x < Data.Length; x += 16)
{
text.Length = 0;
strb.Length = 0;
for (int y = 0; y < 16; ++y)
{
if ((x + y) > (Data.Length - 1))
break;
ch[0] = (char)Data[x + y];
strb.AppendFormat("{0,0:X2} ", (int)ch[0]);
if (((int)ch[0] < 32) || ((int)ch[0] > 127))
ch[0] = '.';
text.Append(ch);
}
text.Append("\r\n");
while (strb.Length < 52)
strb.Append(" ");
strb.Append(text.ToString());
output += strb.ToString();
}
return output;
}
}
}

36
Helper/FileMagic.cs Normal file
View File

@ -0,0 +1,36 @@
using System;
using System.IO;
namespace Catswords.DataType.Client.Helper
{
public static class FileMagic
{
public static string Error = string.Empty;
public static string Read(string filePath)
{
string hexString = "";
try
{
// 파일 열기
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
// 첫 3 바이트 읽기
byte[] buffer = new byte[3] { 0x00, 0x00, 0x00 };
int bytesRead = fs.Read(buffer, 0, 3);
// 16진수로 변환하여 출력
hexString = BitConverter.ToString(buffer).Replace("-", string.Empty).ToLower();
}
}
catch (Exception ex)
{
hexString = "000000";
Error = ex.Message;
}
return hexString;
}
}
}

68
Helper/ImpHash.cs Normal file
View File

@ -0,0 +1,68 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Catswords.DataType.Client.Helper
{
public static class ImpHash
{
public static string Calculate(string filePath)
{
string imphash = "";
using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
using (BinaryReader binaryReader = new BinaryReader(fileStream))
{
// DOS Header 크기만큼 스킵
binaryReader.BaseStream.Seek(0x3C, SeekOrigin.Begin);
int peHeaderOffset = binaryReader.ReadInt32();
// PE Header로 이동
binaryReader.BaseStream.Seek(peHeaderOffset, SeekOrigin.Begin);
// Signature 확인
uint signature = binaryReader.ReadUInt32();
if (signature != 0x00004550) // "PE\0\0"
{
throw new InvalidOperationException("Invalid PE file");
}
// Optional Header에서 Import Table Offset 찾기
binaryReader.BaseStream.Seek(20, SeekOrigin.Current); // COFF 파일 헤더 크기만큼 스킵
ushort optionalHeaderSize = binaryReader.ReadUInt16();
binaryReader.BaseStream.Seek(42, SeekOrigin.Current); // ImageBase 크기만큼 스킵
int importTableOffset = peHeaderOffset + 24 + optionalHeaderSize;
binaryReader.BaseStream.Seek(importTableOffset, SeekOrigin.Begin);
// Import Table에서 imphash 생성
StringBuilder imphashBuilder = new StringBuilder();
while (true)
{
uint lookupTableRVA = binaryReader.ReadUInt32();
if (lookupTableRVA == 0)
{
break;
}
binaryReader.BaseStream.Seek(12, SeekOrigin.Current); // 다른 필드들을 스킵
binaryReader.BaseStream.Seek(4, SeekOrigin.Current); // 항상 0인 TimeDateStamp 필드를 스킵
imphashBuilder.Append(lookupTableRVA.ToString("X8"));
}
// MD5 해시 생성
using (MD5 md5 = MD5.Create())
{
byte[] hashBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(imphashBuilder.ToString()));
imphash = BitConverter.ToString(hashBytes).Replace("-", string.Empty).ToLower();
}
}
}
return imphash;
}
}
}

90
Helper/Timeline.cs Normal file
View File

@ -0,0 +1,90 @@
using Newtonsoft.Json.Linq;
using Catswords.DataType.Client.Model;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Catswords.DataType.Client.Helper
{
public class Timeline
{
public string ApiBaseUrl;
public string AccessToken;
public List<Indicator> Indicators;
public string ResponseText;
public Timeline(string host, string access_token)
{
ApiBaseUrl = $"https://{host}/api/v1/timelines/tag";
AccessToken = access_token;
Indicators = new List<Indicator>();
}
public static string RemoveHtmlTags(string input)
{
// 정규 표현식을 사용하여 HTML 태그 제거
string pattern = "<.*?>";
string replacement = "";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, replacement);
return result;
}
public static string FormatDateTime(string dateString)
{
string formattedDateTime = "";
// 날짜와 시간을 파싱
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();
}
return formattedDateTime;
}
public void Fetch(string q)
{
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {AccessToken}");
try
{
// 데이터 요청
Task<HttpResponseMessage> responseTask = client.GetAsync($"{ApiBaseUrl}/{q}");
responseTask.Wait();
// 응답 본문 저장
HttpResponseMessage response = responseTask.Result;
Task<string> readAsStringTask = response.Content.ReadAsStringAsync();
readAsStringTask.Wait();
ResponseText = readAsStringTask.Result;
// JSON 파싱
JArray statuses = JArray.Parse(ResponseText);
foreach (var status in statuses)
{
string createdAt = status["created_at"].Value<string>();
string content = status["content"].Value<string>();
Indicators.Add(new Indicator
{
CreatedAt = FormatDateTime(createdAt),
Content = RemoveHtmlTags(content)
});
}
}
catch { }
}
}
}
}

View File

@ -0,0 +1,9 @@
namespace Catswords.DataType.Client.Model
{
class AndroidPermission
{
public string Name { get; set; }
public string Description { get; set; }
public int Severity { get; set; }
}
}

14
Model/FileHash.cs Normal file
View File

@ -0,0 +1,14 @@
namespace Catswords.DataType.Client.Model
{
public class FileHash
{
public string Path { get; set; }
public string Extension { get; set; }
public string MD5 { get; set; }
public string SHA1 { get; set; }
public string MAGIC { get; set; }
public string CRC32 { get; set; }
public string SHA256 { get; set; }
public string InfoHash { get; set; }
}
}

10
Model/Indicator.cs Normal file
View File

@ -0,0 +1,10 @@
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; }
}
}

22
Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Catswords.DataType.Client
{
internal static class Program
{
/// <summary>
/// 해당 애플리케이션의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Catswords.DataType.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Catswords.DataType.Client")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("72a9e640-f785-4202-9cea-bec46a9b09b8")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

113
Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Catswords.DataType.Client.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Catswords.DataType.Client.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap data_database_icon_177024 {
get {
object obj = ResourceManager.GetObject("data_database_icon_177024", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap document_paperclip_list_paper_icon_219544 {
get {
object obj = ResourceManager.GetObject("document_paperclip_list_paper_icon_219544", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// (아이콘)과(와) 유사한 System.Drawing.Icon 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Icon icon {
get {
object obj = ResourceManager.GetObject("icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap image1 {
get {
object obj = ResourceManager.GetObject("image1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap message_bubble_conversation_speech_communication_talk_chat_icon_219299 {
get {
object obj = ResourceManager.GetObject("message_bubble_conversation_speech_communication_talk_chat_icon_219299", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

136
Properties/Resources.resx Normal file
View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="data_database_icon_177024" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\data_database_icon_177024.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="document_paperclip_list_paper_icon_219544" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\document_paperclip_list_paper_icon_219544.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="image1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\image1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</root>

30
Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Catswords.DataType.Client.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
Resources/data_96285.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
Resources/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
Resources/icon_32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
Resources/image1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

146
UserControl1.Designer.cs generated Normal file
View File

@ -0,0 +1,146 @@
namespace Catswords.DataType.Client
{
partial class UserControl1
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(18, 125);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(347, 277);
this.listView1.TabIndex = 8;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "CreatedAt";
this.columnHeader1.Width = 120;
//
// columnHeader2
//
this.columnHeader2.Text = "Opinion";
this.columnHeader2.Width = 200;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(128, 62);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(118, 42);
this.label1.TabIndex = 7;
this.label1.Text = "label1";
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.Color.White;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.Location = new System.Drawing.Point(16, 445);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(349, 13);
this.textBox1.TabIndex = 11;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(132, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(118, 16);
this.label2.TabIndex = 10;
this.label2.Text = "Conversations with";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(15, 416);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(122, 13);
this.linkLabel1.TabIndex = 9;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Write a review to this file";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// button1
//
this.button1.Location = new System.Drawing.Point(280, 411);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(85, 23);
this.button1.TabIndex = 12;
this.button1.Text = "Expert...";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UserControl1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.BackgroundImage = global::Catswords.DataType.Client.Properties.Resources.image1;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.Controls.Add(this.button1);
this.Controls.Add(this.listView1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.linkLabel1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(433, 457);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Button button1;
}
}

189
UserControl1.cs Normal file
View File

@ -0,0 +1,189 @@
using Catswords.DataType.Client.Helper;
using Catswords.DataType.Client.Model;
using System;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace Catswords.DataType.Client
{
public partial class UserControl1 : UserControl
{
private ImageList imageList = new ImageList();
private Form parent;
public string filePath;
public string fileMagic;
public string fileName;
public string fileExtension;
public UserControl1(Form parent)
{
InitializeComponent();
// set parent form
this.parent = parent;
// 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);
// set image list
listView1.SmallImageList = imageList;
// Store the file path.
filePath = OpenFileDialog();
if (string.IsNullOrEmpty(filePath))
{
MessageBox.Show("Failed to get a file name", "Catswords.DataType.Client");
parent.Close();
return;
}
// Get first 4 bytes from the file.
fileMagic = Helper.FileMagic.Read(filePath);
// Show file magic to the label
label1.Text = "#0x" + fileMagic;
if (Helper.FileMagic.Error != string.Empty)
{
textBox1.Text = Helper.FileMagic.Error;
}
// Get file name and file extension
try
{
fileExtension = Path.GetExtension(filePath);
fileName = Path.GetFileName(filePath);
if (fileExtension.Length > 0 && fileExtension.Substring(0, 1) == ".")
{
fileExtension = fileExtension.Substring(1);
}
}
catch
{
fileExtension = "";
fileName = "";
}
// Get data from file extension database
FetchFromFileExtensionDB();
// Get data from timeline
FetchFromTimeline();
// Get data from Android manifest
FetchFromAndroidManifest();
}
private void FetchFromFileExtensionDB()
{
var search = new Helper.FileExtensionDB();
search.Fetch(fileExtension);
foreach (Indicator ind in search.Indicators)
{
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt, ind.Content }, 0));
}
}
private void FetchFromTimeline()
{
// Request a timeline
var search = new Helper.Timeline(Config.MASTODON_HOST, Config.MASTODON_ACCESS_TOKEN);
// fetch data by file magic
search.Fetch("0x" + fileMagic);
// if PE format (ImpHash)
if (fileMagic.StartsWith("4d5a"))
{
try
{
string imphash = Helper.ImpHash.Calculate(filePath);
search.Fetch(imphash);
string companyInfo = Helper.FileCompany.Read(filePath);
search.Fetch(companyInfo);
textBox1.Text = "ImpHash=" + imphash + "; CompanyInfo=" + companyInfo;
}
catch (Exception ex)
{
textBox1.Text = ex.Message;
}
}
// fetch data by file extension
if (fileExtension.Length > 0)
{
search.Fetch(fileExtension);
// if Office365 format
if (fileExtension.StartsWith("xls") || fileExtension.StartsWith("ppt") || fileExtension.StartsWith("doc"))
{
search.Fetch("office365");
}
}
// if it contains ransomware keywords
if (fileName.ToLower().Contains("readme") || fileName.ToLower().Contains("decrypt"))
{
search.Fetch("ransomware");
}
// if IoC (Indicators of Compomise) mode
if (fileMagic == "58354f") // EICAR test file header
{
search.Fetch("malware");
}
// Show the timeline
foreach (Indicator ind in search.Indicators)
{
listView1.Items.Add(new ListViewItem(new string[] { ind.CreatedAt, ind.Content }, 1));
}
}
private void FetchFromAndroidManifest()
{
if (fileExtension == "apk")
{
var extractor = new ApkManifestExtractor(filePath);
foreach (AndroidPermission perm in extractor.GetPermissions())
{
listView1.Items.Add(new ListViewItem(new string[] { perm.Name, perm.Description }));
}
}
}
public string OpenFileDialog()
{
string filePath = null;
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//Get the path of specified file
filePath = openFileDialog.FileName;
}
}
return filePath;
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://catswords.social/auth/sign_up");
}
private void button1_Click(object sender, EventArgs e)
{
Form newForm = new Form2(this);
newForm.Show();
}
}
}

120
UserControl1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

16
packages.config Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BencodeNET" version="4.0.0" targetFramework="net48" />
<package id="Crc32.NET" version="1.2.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="PeNet" version="4.0.4" targetFramework="net48" />
<package id="PeNet.Asn1" version="2.0.1" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net48" />
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Pkcs" version="8.0.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
</packages>