1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Added MeshReset Tool

This commit is contained in:
Bryan Roe
2019-01-11 10:59:24 -08:00
parent a0f146b38d
commit 3cf4dfced6
11 changed files with 995 additions and 0 deletions

98
meshreset/MeshReset.rc Normal file
View File

@@ -0,0 +1,98 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,1
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Mesh Messenger"
VALUE "FileVersion", "0.0.0.1"
VALUE "InternalName", "MeshConsole"
VALUE "OriginalFilename", "MeshMessenger.exe"
VALUE "ProductName", "Mesh Messenger"
VALUE "ProductVersion", "0, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

28
meshreset/MeshReset.sln Normal file
View File

@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MeshReset", "MeshReset.vcxproj", "{03A09084-0576-45C5-97CA-B83B1A8688B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x64.ActiveCfg = Debug|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x64.Build.0 = Debug|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x86.ActiveCfg = Debug|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x86.Build.0 = Debug|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x64.ActiveCfg = Release|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x64.Build.0 = Release|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x86.ActiveCfg = Release|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

241
meshreset/MeshReset.vcxproj Normal file
View File

@@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\microstack\ILibCrypto.c" />
<ClCompile Include="..\microstack\ILibParsers.c" />
<ClCompile Include="..\microstack\ILibSimpleDataStore.c" />
<ClCompile Include="..\microstack\nossl\md5.c" />
<ClCompile Include="..\microstack\nossl\sha1.c" />
<ClCompile Include="..\microstack\nossl\sha224-256.c" />
<ClCompile Include="..\microstack\nossl\sha384-512.c" />
<ClCompile Include="main.c" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\microstack\ILibCrypto.h" />
<ClInclude Include="..\microstack\ILibParsers.h" />
<ClInclude Include="..\microstack\ILibSimpleDataStore.h" />
<ClInclude Include="..\microstack\nossl\md5.h" />
<ClInclude Include="..\microstack\nossl\sha-private.h" />
<ClInclude Include="..\microstack\nossl\sha.h" />
<ClInclude Include="..\microstack\nossl\sha1.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{03A09084-0576-45C5-97CA-B83B1A8688B8}</ProjectGuid>
<RootNamespace>MeshConsole</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>MeshReset</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</PostBuildEventUseInBuild>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>$(ProjectName)64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../openssl/include;../../openssl/include/openssl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;WINSOCK2;ILibWebServer_SESSION_TRACKING;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CallingConvention>Cdecl</CallingConvention>
<AssemblerOutput>NoListing</AssemblerOutput>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<Profile>false</Profile>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateMapFile>
</GenerateMapFile>
<MapExports>
</MapExports>
<AssemblyDebug>true</AssemblyDebug>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;_CRT_SECURE_NO_WARNINGS;WINSOCK2;ILibWebServer_SESSION_TRACKING;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>Iphlpapi.lib;DbgHelp.lib;ws2_32.lib;Setupapi.lib;Psapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WINSOCK2;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>Iphlpapi.lib;DbgHelp.lib;Setupapi.lib;ws2_32.lib;Psapi.lib;Crypt32.lib;Wintrust.lib;Version.lib;Wtsapi32.lib;bcrypt.lib;%(AdditionalDependencies);Gdiplus.lib</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshConsole" /du "http://opentools.homeip.net" "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;WINSOCK2;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Psapi.lib;Iphlpapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="main.c" />
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="..\microstack\nossl\md5.c">
<Filter>Microstack\nossl</Filter>
</ClCompile>
<ClCompile Include="..\microstack\nossl\sha1.c">
<Filter>Microstack\nossl</Filter>
</ClCompile>
<ClCompile Include="..\microstack\nossl\sha224-256.c">
<Filter>Microstack\nossl</Filter>
</ClCompile>
<ClCompile Include="..\microstack\nossl\sha384-512.c">
<Filter>Microstack\nossl</Filter>
</ClCompile>
<ClCompile Include="..\microstack\ILibParsers.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\microstack\ILibSimpleDataStore.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\microstack\ILibCrypto.c">
<Filter>Microstack</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="..\microstack\nossl\md5.h">
<Filter>Microstack\nossl</Filter>
</ClInclude>
<ClInclude Include="..\microstack\nossl\sha.h">
<Filter>Microstack\nossl</Filter>
</ClInclude>
<ClInclude Include="..\microstack\nossl\sha1.h">
<Filter>Microstack\nossl</Filter>
</ClInclude>
<ClInclude Include="..\microstack\nossl\sha-private.h">
<Filter>Microstack\nossl</Filter>
</ClInclude>
<ClInclude Include="..\microstack\ILibParsers.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\microstack\ILibSimpleDataStore.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\microstack\ILibCrypto.h">
<Filter>Microstack</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<Filter Include="Microstack">
<UniqueIdentifier>{24205618-7a0a-4260-916f-f08e93a87031}</UniqueIdentifier>
</Filter>
<Filter Include="Microstack\nossl">
<UniqueIdentifier>{2a875bde-bc37-451d-94aa-dd141af887fd}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

7
meshreset/ReadMe.txt Normal file
View File

@@ -0,0 +1,7 @@
Micro LMS
------------------------------------------
Introduction
A implementation of Intel AMT LMS using Microstack.

448
meshreset/main.c Normal file
View File

@@ -0,0 +1,448 @@
/*
Copyright 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#if defined(WIN32) || defined (_WIN32_WCE)
#ifndef MICROSTACK_NO_STDAFX
#include "stdafx.h"
#endif
#endif
#if defined(WIN32)
#define _CRTDBG_MAP_ALLOC
#ifdef _DEBUG
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#endif
#if defined(WINSOCK2)
#include <winsock2.h>
#include <ws2tcpip.h>
#elif defined(WINSOCK1)
#include <winsock.h>
#include <wininet.h>
#endif
#include <io.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <process.h>
#include <Tlhelp32.h>
#include <winbase.h>
#include <string.h>
#include <signal.h>
#include <shlobj.h>
#include "..\microstack\ILibParsers.h"
#include "..\microstack\ILibSimpleDataStore.h"
#if defined(WIN32) & !defined(_CONSOLE)
#include "resource.h"
#endif
#if defined(WIN32) && defined (_DEBUG)
#include <crtdbg.h>
#endif
// The following macros set and clear, respectively, given bits
// of the C runtime library debug flag, as specified by a bitmask.
#ifdef _DEBUG
#define SET_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#define CLEAR_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#else
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
#endif
#ifdef MEMORY_CHECK
#ifdef WIN32
// This routine place comments at the head of a section of debug output
void OutputHeading( const char * explanation )
{
_RPT1( _CRT_WARN, "\n\n%s:\n**************************************************************************\n", explanation );
}
#endif
#endif
void BreakSink(int s)
{
UNREFERENCED_PARAMETER( s );
signal(SIGINT, SIG_IGN); // To ignore any more ctrl-c interrupts
// TODO
}
// Return 1 if the file exists
int isFileExists(char *filePath)
{
#ifdef WIN32
return(_access(filePath, 0) == 0 ? 1 : 0);
#else
return(access(filePath, 0) == 0 ? 1 : 0);
#endif
}
// Find a process by name and kill it.
void killProcess(char *name)
{
PROCESSENTRY32 pEntry;
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
pEntry.dwSize = sizeof(pEntry);
BOOL hRes = Process32First(hSnapShot, &pEntry);
while (hRes) {
if (strcmp(pEntry.szExeFile, name) == 0) {
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, 0, (DWORD)pEntry.th32ProcessID);
if (hProc != NULL) {
printf("Terminating process %p.\r\n", hProc);
TerminateProcess(hProc, 9);
CloseHandle(hProc);
}
}
hRes = Process32Next(hSnapShot, &pEntry);
}
CloseHandle(hSnapShot);
}
// Find a process by name and kill it.
void killProcess2(char *name)
{
snprintf(ILibScratchPad2, sizeof(ILibScratchPad2), "taskkill /F /T /IM %s", name);
system(ILibScratchPad2);
}
// Find a process by name and kill it.
void killService(char *servicename)
{
snprintf(ILibScratchPad2, sizeof(ILibScratchPad2), "taskkill /F /FI \"SERVICES eq %s\"", servicename);
system(ILibScratchPad2);
}
// Uninstall a service
int UninstallService(TCHAR* serviceName)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, serviceName, SERVICE_QUERY_STATUS | DELETE);
if (service)
{
SERVICE_STATUS serviceStatusEx;
if (QueryServiceStatus(service, &serviceStatusEx))
{
if (serviceStatusEx.dwCurrentState == SERVICE_STOPPED)
{
if (DeleteService(service))
{
printf("Mesh service removed successfully.\r\n");
r = 1;
}
else
{
DWORD dwError = GetLastError();
if (dwError == ERROR_ACCESS_DENIED) {
printf("Access denied while trying to remove mesh service.\r\n");
}
else if (dwError == ERROR_INVALID_HANDLE) {
printf("Handle invalid while trying to remove mesh service.\r\n");
}
else if (dwError == ERROR_SERVICE_MARKED_FOR_DELETE) {
printf("Mesh service already marked for deletion.\r\n");
}
}
}
else
{
r = 2;
printf("Mesh service is still running.\r\n");
}
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
// SERVICE_STOPPED 1 The service is not running.
// SERVICE_START_PENDING 2 The service is starting.
// SERVICE_STOP_PENDING 3 The service is stopping.
// SERVICE_RUNNING 4 The service is running.
// SERVICE_CONTINUE_PENDING 5 The service continue is pending.
// SERVICE_PAUSE_PENDING 6 The service pause is pending.
// SERVICE_PAUSED 7 The service is paused.
// SERVICE_NOT_INSTALLED 100 The service is not installed.
int GetServiceState(LPCSTR servicename)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | DELETE);
if (service)
{
SERVICE_STATUS serviceStatusEx;
if (QueryServiceStatus(service, &serviceStatusEx))
{
r = serviceStatusEx.dwCurrentState;
}
CloseServiceHandle(service);
}
else
{
r = 100;
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
// Start a Windows service
int LaunchService(LPCSTR servicename)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SERVICE_QUERY_STATUS | SERVICE_START);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | SERVICE_START);
if (service)
{
SERVICE_STATUS serviceStatusEx;
if (QueryServiceStatus(service, &serviceStatusEx))
{
if (serviceStatusEx.dwCurrentState == SERVICE_STOPPED) { if (StartService(service, 0, NULL) == TRUE) { r = 1; printf("Started service.\r\n"); } }
else { r = 2; }
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
// Stop a Windows service
int StopService(LPCSTR servicename)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SERVICE_QUERY_STATUS | SERVICE_STOP);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | SERVICE_STOP);
if (service)
{
SERVICE_STATUS serviceStatusEx;
if (QueryServiceStatus(service, &serviceStatusEx))
{
if (serviceStatusEx.dwCurrentState != SERVICE_STOPPED)
{
if (ControlService(service, SERVICE_CONTROL_STOP, &serviceStatusEx) == FALSE)
{
// TODO: Unable to stop service
printf("Unable to stop service.\r\n");
}
else
{
printf("Stopped service.\r\n");
Sleep(3000);
r = 1;
}
}
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
void removeDir(char* dir)
{
SHFILEOPSTRUCT file_op = {
NULL,
FO_DELETE,
dir,
"",
FOF_NOCONFIRMATION |
FOF_NOERRORUI |
FOF_SILENT,
FALSE,
0,
"" };
int r = SHFileOperation(&file_op);
if (r == 0) {
printf("Removed folder: %s.\r\n", dir);
} else {
if (r != 124) { printf("Unable to remove folder (%d): %s.\r\n", r, dir); }
}
}
// Remove CoreModule from the .db file
void removeMeshCore(char* file) {
if (ILibSimpleDataStore_Exists(file) != 1) return;
void* ILibSimpleDataStore = ILibSimpleDataStore_Create(file);
if (ILibSimpleDataStore == NULL) return;
printf("Checking %s...\r\n", file);
if (ILibSimpleDataStore_Get(ILibSimpleDataStore, "CoreModule", NULL, 0) != 0) {
if (ILibSimpleDataStore_Delete(ILibSimpleDataStore, "CoreModule") == 1) {
printf("Removed CoreModule.\r\n");
ILibSimpleDataStore_Compact(ILibSimpleDataStore); // While we are at it, compact the .db file.
}
}
ILibSimpleDataStore_Close(ILibSimpleDataStore);
}
int main(int argc, char **argv)
{
// Shutdown on Ctrl + C
signal(SIGINT, BreakSink);
#ifdef _POSIX
signal(SIGPIPE, SIG_IGN);
#ifdef _DEBUG
//mtrace();
#endif
#endif
#ifdef MEMORY_CHECK
#ifdef WIN32
//SET_CRT_DEBUG_FIELD( _CRTDBG_DELAY_FREE_MEM_DF );
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF);
#endif
#endif
if ((argc == 2) && (strcasecmp(argv[1], "reset") == 0)) {
int i;
char targetexe[_MAX_PATH + 40];
size_t targetexelen = 0;
// Reset the mesh agent & clear the core
printf("Attempting MeshAgent Reset...\r\n");
// Kill the agent 3 different ways.
killProcess("meshagent.exe");
killProcess2("meshagent.exe");
killService("Mesh Agent");
Sleep(1000);
// Stop the service
i = GetServiceState("Mesh Agent");
if (i == 100) { printf("Mesh Agent is not installed.\r\n"); return; }
if (i != 1) { StopService("Mesh Agent"); }
// Remove the core from the .db file
if (SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, targetexe) != S_FALSE) {
targetexelen = strnlen_s(targetexe, _MAX_PATH + 40);
memcpy_s(targetexe + targetexelen, _MAX_PATH + 40 - targetexelen, "\\Mesh Agent\\MeshAgent.db\0", 25);
removeMeshCore(targetexe);
} else {
removeMeshCore("C:\\Program Files\\Mesh Agent\\MeshAgent.db");
}
// Remove the core from the .db file
if (SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86 | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, targetexe) != S_FALSE) {
targetexelen = strnlen_s(targetexe, _MAX_PATH + 40);
memcpy_s(targetexe + targetexelen, _MAX_PATH + 40 - targetexelen, "\\Mesh Agent\\MeshAgent.db\0", 25);
removeMeshCore(targetexe);
} else {
removeMeshCore("C:\\Program Files (x86)\\Mesh Agent\\MeshAgent.db");
}
// Start the agent again
LaunchService("Mesh Agent");
printf("Done.\r\n");
} else if ((argc == 2) && (strcasecmp(argv[1], "remove") == 0)) {
int i;
printf("Attempting MeshAgent Removal...\r\n");
// Kill the agent 3 different ways.
killProcess("meshagent.exe");
killProcess2("meshagent.exe");
killService("Mesh Agent");
Sleep(1000);
// Stop & remove the service
i = GetServiceState("Mesh Agent");
if (i != 100) {
if (i != 1) { StopService("Mesh Agent"); }
UninstallService("Mesh Agent");
}
i = GetServiceState("Mesh Agent v2");
if (i != 100) {
if (i != 1) { StopService("Mesh Agent v2"); }
UninstallService("Mesh Agent v2");
}
// Remove the MeshAgent v1 registry keys if present
if (RegDeleteKeyEx(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed WOW64 registry key: LOCALMACHINE\\Software\\Open Source\\MeshAgent.\r\n"); }
if (RegDeleteKeyEx(HKEY_CURRENT_USER, "Software\\Open Source\\MeshAgent", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed WOW64 registry key: CURRENTUSER\\Software\\Open Source\\MeshAgent.\r\n"); }
if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent") == ERROR_SUCCESS) { printf("Removed registry key: LOCALMACHINE\\Software\\Open Source\\MeshAgent.\r\n"); }
if (RegDeleteKey(HKEY_CURRENT_USER, "Software\\Open Source\\MeshAgent") == ERROR_SUCCESS) { printf("Removed registry key: CURRENTUSER\\Software\\Open Source\\MeshAgent.\r\n"); }
// Remove the MeshAgent v2 registry keys if present
if (RegDeleteKeyEx(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent2", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed WOW64 registry key: LOCALMACHINE\\Software\\Open Source\\MeshAgent2.\r\n"); }
if (RegDeleteKeyEx(HKEY_CURRENT_USER, "Software\\Open Source\\MeshAgent2", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed WOW64 registry key: CURRENTUSER\\Software\\Open Source\\MeshAgent2.\r\n"); }
if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent2") == ERROR_SUCCESS) { printf("Removed registry key: LOCALMACHINE\\Software\\Open Source\\MeshAgent2.\r\n"); }
if (RegDeleteKey(HKEY_CURRENT_USER, "Software\\Open Source\\MeshAgent2") == ERROR_SUCCESS) { printf("Removed registry key: CURRENTUSER\\Software\\Open Source\\MeshAgent2.\r\n"); }
// Remove windows service keys
if (RegDeleteKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Mesh Agent", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed service keys.\r\n"); }
if (RegDeleteKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Mesh Agent") == ERROR_SUCCESS) { printf("Removed service keys.\r\n"); }
// Remove uninstall icon if present
if (RegDeleteKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent", KEY_WOW64_32KEY, 0) == ERROR_SUCCESS) { printf("Removed WOW64 uninstall icon.\r\n"); }
if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent") == ERROR_SUCCESS) { printf("Removed uninstall icon.\r\n"); }
// Remote mesh agent folder
removeDir("C:\\Program Files\\Mesh Agent\\");
removeDir("C:\\Program Files (x86)\\Mesh Agent\\");
} else {
// Display help
printf("MeshCentral Agent Reset & Removal Tool v1. Usage:\r\n\r\n");
printf(" MeshReset [RESET|REMOVE]\r\n");
printf("\r\nThis tool should run with administrator privilages.\r\n");
}
#ifdef MEMORY_CHECK
#ifdef WIN32
OutputHeading("Generating the final memory leak report\r\n");
_CrtCheckMemory();
_CrtDumpMemoryLeaks();
#endif
#endif
#ifdef _POSIX
#ifdef _DEBUG
//muntrace();
#endif
#endif
#ifdef _POSIX
exit(EXIT_SUCCESS);
#else
return 0;
#endif
}

58
meshreset/makefile Normal file
View File

@@ -0,0 +1,58 @@
SOURCES = main.c ../microstack/ILibLMS.c
SOURCES += ../microstack/ILibAsyncServerSocket.c ../microstack/ILibAsyncSocket.c ../microstack/ILibWebServer.c ../microstack/ILibWebClient.c ../microstack/ILibParsers.c ../microstack/md5.c ../microstack/sha1.c
SOURCES += ../heci/HECILinux.c ../heci/LMEConnection.c ../heci/PTHICommand.c
SOURCES += $(ADDITIONALSOURCES)
OBJECTS = $(patsubst %.c,%.o, $(SOURCES))
EXENAME = microlms
# Compiler command name
CC = gcc
# need to be separate for dependency generation
INCDIRS = -I. -I../../microstack -I../../core
CFLAGS ?= -g -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -fno-strict-aliasing $(INCDIRS)
LDFLAGS ?= -g -L. -lpthread -ldl -lutil -lrt
.PHONY: all clean
all: $(EXENAME)
$(EXENAME): $(OBJECTS)
$(V)$(CC) $^ $(LDFLAGS) -o $@
release:
$(MAKE) $(MAKEFILE) CFLAGS="-O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lutil"
strip ./$(EXENAME)
linux32:
$(MAKE) $(MAKEFILE) CFLAGS="-m32 -O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lutil -lrt -m32"
strip ./$(EXENAME)
linux64:
$(MAKE) $(MAKEFILE) CFLAGS="-O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lrt -lutil"
strip ./$(EXENAME)
clean:
rm -f *.o
rm -f *.o *~ microlms
rm -f ../heci/*.o
rm -f ../microstack/*.o
depend: $(SOURCES)
$(CC) -M $(CFLAGS) $(SOURCES) $(HEADERS) > depend
run:all
rm -f mtrax
set MALLOC_TRACE=mtrax
export MALLOC_TRACE;
./$(EXENAME)
mtrace ./$(EXENAME) mtrax
vrun:all
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes ./signer_linux
trace:
mtrace ./$(EXENAME) mtrax

15
meshreset/resource.h Normal file
View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MeshMessenger.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

8
meshreset/stdafx.cpp Normal file
View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// TinyMesh.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

15
meshreset/stdafx.h Normal file
View File

@@ -0,0 +1,15 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

13
meshreset/targetver.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif