Repository: Scope-IT/marksman
Branch: master
Commit: 2975110d5ddb
Files: 10
Total size: 51.2 KB
Directory structure:
gitextract_j25imnp_/
├── .gitattributes
├── .gitignore
├── App.config
├── Broker.cs
├── LICENSE
├── Marksman.cs
├── Properties/
│ └── AssemblyInfo.cs
├── README.md
├── marksman.csproj
└── marksman.sln
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
/SnipeDemo
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/SnipeSharp.Demo
/SnipeSharp/nuget.exe
================================================
FILE: App.config
================================================
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener"/>
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="API" value="YOUR_API_KEY_HERE"/>
<add key="BaseURI" value="http://YOUR_SNIPE_IT_URL_HERE/api/v1"/>
<add key="DefaultStatusLabel" value="Ready to Deploy"/>
<add key="Company" value="Your Company"/>
<add key="Location" value="Your Location"/>
<add key="OUEnabled" value="false"/>
<add key="OULevel" value="1"/>
<add key="Interactive" value="false"/>
<add key="WarrantyMonths" value="60"/>
<add key="AssetTagPrefix" value="002"/>
</appSettings>
</configuration>
================================================
FILE: Broker.cs
================================================
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SnipeSharp;
using System.Diagnostics;
using SnipeSharp.Endpoints.Models;
using SnipeSharp.Endpoints.SearchFilters;
using SnipeSharp.Common;
using System.Net;
namespace Marksman
{
class Broker
{
public Broker()
{
}
public bool IsIdentical(Asset a1, Asset a2)
{
// We only need to check fields that are being populated by the Marksman agent
// i.e.. not ID, since that is managed by DB
if (a1.AssetTag != a2.AssetTag || a1.Serial != a2.Serial || a1.Name != a2.Name)
{
return false;
}
if (a1.WarrantyMonths != a2.WarrantyMonths)
{
return false;
}
if (a1.Location?.Id != a2.Location?.Id)
{
return false;
}
// Checking sub-object IDs
if (a1.Company?.Id != a2.Company?.Id || a1.Model?.Id != a2.Model?.Id ||
a1.StatusLabel?.Id != a2.StatusLabel?.Id)
{
return false;
}
// Should be something for custom fields -> for now leaving blank
return true;
}
public bool CheckConnection(NameValueCollection appSettings)
{
// This method might seem overly complicated for what it is doing (simply
// checking a connection to the Snipe-IT instance. However, there are a lot
// of different ways that the connection can fail (usually related to improperly
// set values in the config file).
// This method allows a set of specific, descriptive error messages to be passed
// showing exactly what kind of configuration problem needs to be fixed.
string uri = "";
string query = "users?limit=0";
string baseUri = appSettings["BaseURI"];
// Note: The program should be able to handle a BaseURI that has a trailing '/' or not.
if (baseUri.EndsWith("/")){
uri = baseUri + query;
} else
{
uri = baseUri + "/" + query;
}
HttpWebRequest request;
try
{
request = (HttpWebRequest)WebRequest.Create(uri);
request.Headers["Authorization"] = "Bearer " + appSettings["API"];
request.Accept = "application/json";
}
catch (System.NotSupportedException e)
{
Console.WriteLine(e);
Console.WriteLine("Please double-check the BaseURI key in your <appSettings>\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.");
return false;
}
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
Console.WriteLine("HTTP 200: Connection to Snipe-IT instance succeded.");
return true;
} else {
Console.WriteLine("HTTP {0}", response.StatusCode);
Console.WriteLine("Unexpected HTTP response code, could not connect to Snipe-IT instance.");
return false;
}
} catch (WebException e)
{
HttpWebResponse r = (HttpWebResponse)e.Response;
if (r == null)
{
Console.WriteLine(e);
Console.WriteLine("Please double-check the BaseURI key in your <appSettings>\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.");
}
else if (r.StatusCode == HttpStatusCode.Unauthorized)
{
Console.WriteLine("HTTP 403: Unauthorized. Please check the API key value in your <appSettings>\nblock of the Marksman config file and ensure it has been set to a valid key.");
}
else if (r.StatusCode == HttpStatusCode.NotFound)
{
Console.WriteLine("HTTP 404: URL not found. Please double-check the BaseURI key in your <appSettings>\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.");
} else
{
Console.WriteLine("Unexpected error, could not connect to Snipe-IT instance.");
Console.WriteLine(e);
}
return false;
}
}
public List<IRequestResponse> SyncAll(SnipeItApi snipe, Asset currentAsset, Model currentModel, Manufacturer currentManufacturer,
Category currentCategory, Company currentCompany, StatusLabel currentStatusLabel, Location currentLocation)
{
// Let's try to simplify the logic into a repeatable structure:
// Each of these categories (Asset, Model, Location, etc.) has a single
// value that uniquely specifies it, which must be:
// a) Uniquely associated to it in the physical world
// b) Not the database unique ID
// Why can't it be the database unique ID? Because the uniqueID is not something that
// is inherently associated to the computer's hardware, it's just a number that SnipeIT
// uses internally.
// By category: Unique identifiers
// Asset: computer serial (string)
// Model: model full name (string)
// Category: model types, as given by the WMIC fullnames (string)
// Manufacturer: full name (string)
// Company: full name (string)
// StatusLabel: full name (string)
// Location: full name (string)
// Really, we only need the update functionality for the assets, as the computer name can change,
// along with its location, etc.
// However we are not in change of things like a computer manufacturer changing the name of
// its company. So those have a simpler functionality.
List<IRequestResponse> messages = new List<IRequestResponse>();
messages.Add(snipe.ManufacturerManager.Create(currentManufacturer));
SearchFilter manufacturerFilter = new SearchFilter(currentManufacturer.Name);
Manufacturer updatedManufacturer = snipe.ManufacturerManager.FindOne(manufacturerFilter);
messages.Add(snipe.CategoryManager.Create(currentCategory));
SearchFilter categoryFilter = new SearchFilter(currentCategory.Name);
Category updatedCategory = snipe.CategoryManager.FindOne(categoryFilter);
currentModel.Manufacturer = updatedManufacturer;
currentModel.Category = updatedCategory;
messages.Add(snipe.ModelManager.Create(currentModel));
SearchFilter modelFilter = new SearchFilter(currentModel.Name);
Model updatedModel = snipe.ModelManager.FindOne(modelFilter);
messages.Add(snipe.CompanyManager.Create(currentCompany));
SearchFilter companyFilter = new SearchFilter(currentCompany.Name);
Company updatedCompany = snipe.CompanyManager.FindOne(companyFilter);
messages.Add(snipe.StatusLabelManager.Create(currentStatusLabel));
SearchFilter statusLabelFilter = new SearchFilter(currentStatusLabel.Name);
StatusLabel updatedStatusLabel = snipe.StatusLabelManager.FindOne(statusLabelFilter);
messages.Add(snipe.LocationManager.Create(currentLocation));
SearchFilter locationFilter = new SearchFilter(currentLocation.Name);
Location updatedLocation = snipe.LocationManager.FindOne(locationFilter);
currentAsset.Model = updatedModel;
currentAsset.Company = updatedCompany;
currentAsset.StatusLabel = updatedStatusLabel;
currentAsset.Location = updatedLocation;
string currentSerial = currentAsset.Serial;
Asset dbAsset = snipe.AssetManager.FindBySerial(currentSerial);
if (dbAsset == null)
{
Console.WriteLine("Asset does not exist in database, creating...");
snipe.AssetManager.Create(currentAsset);
} else
{
Console.WriteLine("Asset already exists in db. Checking for consistency.");
bool isIdentical = IsIdentical(currentAsset, dbAsset);
if (isIdentical)
{
Console.WriteLine("No changes required! Asset already exists and is up-to-date.");
} else
{
Console.WriteLine("Changes in asset detected. Updating:");
// Setting old ID for consistency
currentAsset.Id = dbAsset.Id;
currentAsset.LastCheckout = dbAsset.LastCheckout;
currentAsset.AssignedTo = dbAsset.AssignedTo;
messages.Add(snipe.AssetManager.Update(currentAsset));
}
}
return messages;
}
}
}
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2018,2019] [Scope-IT]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Marksman.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Management;
using System.Diagnostics;
using System.DirectoryServices.AccountManagement;
using System.Collections.Specialized;
using SnipeSharp;
using SnipeSharp.Endpoints.Models;
using SnipeSharp.Endpoints.SearchFilters;
namespace Marksman
{
public class PCSystemTypes {
public Dictionary<string, string> SystemTypes;
}
public class WindowsSystemTypes : PCSystemTypes
{
public WindowsSystemTypes()
{
this.SystemTypes = new Dictionary<string, string>();
this.SystemTypes.Add("0", "Undefined");
this.SystemTypes.Add("1", "Desktop");
this.SystemTypes.Add("2", "Laptop");
this.SystemTypes.Add("3", "Workstation");
this.SystemTypes.Add("4", "Enterprise Server");
this.SystemTypes.Add("5", "SOHO Server");
this.SystemTypes.Add("6", "Appliance PC");
this.SystemTypes.Add("7", "Performance Server");
this.SystemTypes.Add("8", "Maximum");
}
}
public class Sentry // Data acquissition
{
private Dictionary<string, List<string>> Queries; // Where key = query type, value = query itself
private Dictionary<string, string> Values; // Internal representation of query results
private System.Collections.Specialized.NameValueCollection Settings;
public Dictionary<string, string> rawResults // Public representation of query results - raw values. Useful for debug
{
get { return this.Values; }
}
public Sentry(System.Collections.Specialized.NameValueCollection appSettings) // constructor
{
Queries = new Dictionary<string, List<string>>();
Settings = appSettings;
}
public Location GetLocation(NameValueCollection appSettings, SnipeItApi snipe)
{
string assetLocation = this.Values["Location"];
Location currentLocation = new Location(assetLocation);
return currentLocation;
}
public StatusLabel GetStatusLabel(NameValueCollection appSettings, SnipeItApi snipe)
{
string defaultLabel = appSettings["DefaultStatusLabel"];
StatusLabel defaultStatusLabel = new StatusLabel(defaultLabel);
return defaultStatusLabel;
}
public Company GetCompany(NameValueCollection appSettings, SnipeItApi snipe)
{
string companyName = appSettings["Company"];
Company currentCompany = new Company(companyName);
return currentCompany;
}
public Category GetCategory(NameValueCollection appSettings, SnipeItApi snipe)
{
string systemType = GetOutputVariable("Win32_ComputerSystem.PCSystemType");
// TODO: Place in a separate enum class:
WindowsSystemTypes winTypes = new WindowsSystemTypes();
string systemTypeFull = "Undefined";
try
{
systemTypeFull = winTypes.SystemTypes[systemType];
}
catch (Exception e)
{
Trace.WriteLine("Exception encountered while processing WinSystemType: " + e.ToString());
}
Category currentCategory = new Category(systemTypeFull);
return currentCategory;
}
public Manufacturer GetManufacturer(NameValueCollection appSettings, SnipeItApi snipe)
{
string manufacturer = GetOutputVariable("Win32_ComputerSystem.Manufacturer");
Manufacturer systemManufacturer = new Manufacturer(manufacturer);
return systemManufacturer;
}
public Model GetModel(NameValueCollection appSettings, SnipeItApi snipe)
{
string modelTotal = GetOutputVariable("Win32_ComputerSystem.Model");
// TODO: This only works is in the exact format "ModelName ModelNumber"
List<String> modelFragments = modelTotal.Split(' ').ToList();
string modelNumber = modelFragments[modelFragments.Count() - 1];
string modelMake = modelFragments[0];
Model currentModel = new Model
{
Name = modelTotal,
Manufacturer = null,
Category = null,
ModelNumber = modelNumber,
};
return currentModel;
}
public Asset GetAsset(NameValueCollection appSettings, SnipeItApi snipe)
{
string systemName = GetOutputVariable("Win32_ComputerSystem.Name");
string serialNumber = GetOutputVariable("Win32_ComputerSystemProduct.IdentifyingNumber");
string macAddress = GetOutputVariable("Win32_NetworkAdapter.MACAddress");
Dictionary<string, string> customFields = new Dictionary<string, string>();
customFields.Add("_snipeit_mac_address_1", macAddress);
string warrantyMonths = appSettings["WarrantyMonths"];
bool isInteractive = false;
bool interactiveParseSuccess = Boolean.TryParse(appSettings["Interactive"], out isInteractive);
if (interactiveParseSuccess && isInteractive)
{
Console.WriteLine("Enter the computer name: ");
systemName = Console.ReadLine();
}
Asset currentComputer = new SnipeSharp.Endpoints.Models.Asset
{
Company = null,
AssetTag = appSettings["AssetTagPrefix"] + "-" + serialNumber, // <-- to be implemented.. somehow, somewhere
Model = null,
StatusLabel = null,
RtdLocation = null,
Name = systemName,
Serial = serialNumber,
WarrantyMonths = warrantyMonths,
CustomFields = customFields,
};
return currentComputer;
}
public void AddQuery(string queryType, string queryString) { // safely addes queries to the queryList monstrocity, built for expandability (c)
List<string> queryList = new List<string>();
if (this.Queries.ContainsKey(queryType))
{
queryList = Queries[queryType];
queryList.Add(queryString);
this.Queries[queryType] = queryList;
return;
} else
{
queryList.Add(queryString);
this.Queries.Add(queryType, queryList);
return;
}
}
private void RunWMI() { // runs all WMI queries
Dictionary<string, string> resultDictionary = new Dictionary<string, string>();
ManagementObjectCollection queryCollection;
//Query system for Operating System information
foreach (string wmiQuery in this.Queries["WMI"])
{
int count = 0;
SelectQuery selectQuery = new SelectQuery(wmiQuery);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(selectQuery);
queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
// Display all properties.
foreach (PropertyData property in m.Properties)
{
string propertyValue = "<undefined>";
if (!String.IsNullOrWhiteSpace(property.Value.ToString()))
{
propertyValue = property.Value.ToString().Trim();
}
if (!resultDictionary.ContainsKey(selectQuery.ClassName + "." + property.Name))
{
resultDictionary.Add(selectQuery.ClassName + "." + property.Name, propertyValue);
}
else
{
resultDictionary.Add(selectQuery.ClassName + "." + property.Name + "." + count.ToString(), propertyValue);
}
}
count++;
}
}
this.Values = resultDictionary;
}
private void RunLocation() // Runs all code related to location & location sources
{
string location_string = "";
foreach (string locationQuery in this.Queries["Location"])
{
if (locationQuery == "OU")
{
try
{
int ouLevel;
bool ouLevelSuccess = int.TryParse(Settings["OULevel"], out ouLevel);
if (!ouLevelSuccess)
{
ouLevel = 1;
}
string[] machineOU;
using (var context = new PrincipalContext(ContextType.Domain))
using (var comp = ComputerPrincipal.FindByIdentity(context, Environment.MachineName))
machineOU = comp.DistinguishedName.Split(',').SkipWhile(s => !s.StartsWith("OU=")).ToArray();
location_string = machineOU[0].Split('=')[ouLevel];
}
catch (Exception e)
{
Trace.WriteLine("Could not get location from OU");
Trace.WriteLine(e.ToString());
Trace.WriteLine("Getting location from config file instead");
location_string = Settings["Location"];
}
} else
{
location_string = Settings["Location"];
}
}
this.Values.Add("Location", location_string);
}
public string GetOutputVariable(string key)
{
if (this.Values.ContainsKey(key))
{
return this.Values[key];
} else
{
return "";
}
}
public string GetFormattedVariable(string key, string variable = "", string format="<name>=<var>") // produces formatted output, supposed to throw exception if no results in raw results
{
if (String.IsNullOrEmpty(variable))
{
format = "<var>";
}
if (this.Values.ContainsKey(key))
{
return format.Replace("<var>", this.Values[key]).Replace("<name>",variable);
} else
{
return "ERROR: key \"" + key + "\" not found in the results of the query";
}
}
public void Run() // supposed to run all queries of all types and handle per-type errors
{
this.RunWMI();
this.RunLocation();
}
}
class Marksman
{
static void Main(string[] args)
{
Trace.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": Started application.");
var debugTimer = new Stopwatch();
System.Collections.Specialized.NameValueCollection appSettings = System.Configuration.ConfigurationManager.AppSettings;
debugTimer.Start();
SnipeItApi snipe = new SnipeItApi();
snipe.ApiSettings.ApiToken = appSettings["API"];
snipe.ApiSettings.BaseUrl = new Uri(appSettings["BaseURI"]);
Sentry mySentry = new Sentry(appSettings); // creating new Sentry (we can have multiple for parallel execution at a later point)
// Adding what we want
mySentry.AddQuery("WMI", "SELECT Name, Manufacturer, Model, PCSystemType FROM Win32_ComputerSystem");
mySentry.AddQuery("WMI", "SELECT IdentifyingNumber FROM Win32_ComputerSystemProduct");
mySentry.AddQuery("WMI", "SELECT Name FROM Win32_BIOS");
mySentry.AddQuery("WMI", "SELECT Manufacturer,Name,MACAddress FROM Win32_NetworkAdapter WHERE NetEnabled=true AND AdapterTypeId=0 AND netConnectionStatus=2");
mySentry.AddQuery("WMI", "SELECT Manufacturer,Model,SerialNumber FROM Win32_DiskDrive WHERE Index=0");
mySentry.AddQuery("WMI", "SELECT EndingAddress FROM Win32_MemoryArray");
mySentry.AddQuery("WMI", "SELECT Name FROM Win32_DesktopMonitor");
mySentry.AddQuery("WMI", "SELECT Manufacturer,Product,SerialNumber FROM Win32_BaseBoard");
mySentry.AddQuery("WMI", "SELECT Name,NumberOfCores,NumberOfLogicalProcessors FROM Win32_Processor");
bool getOU = false;
bool getOUSuccess = Boolean.TryParse(appSettings["OUEnabled"], out getOU);
if (getOUSuccess && getOU)
{
mySentry.AddQuery("Location", "OU");
} else
{
mySentry.AddQuery("Location", "Config");
}
mySentry.Run();
Asset currentAsset = mySentry.GetAsset(appSettings, snipe);
Model currentModel = mySentry.GetModel(appSettings, snipe);
Manufacturer currentManufacturer = mySentry.GetManufacturer(appSettings, snipe);
Category currentCategory = mySentry.GetCategory(appSettings, snipe);
Company currentCompany = mySentry.GetCompany(appSettings, snipe);
StatusLabel currentStatusLabel = mySentry.GetStatusLabel(appSettings, snipe);
Location currentLocation = mySentry.GetLocation(appSettings, snipe);
//Broker.syncAsset(snipe, currentComputer);
Broker snipeBroker = new Broker();
bool connectionStatus = snipeBroker.CheckConnection(appSettings);
if (connectionStatus)
{
snipeBroker.SyncAll(snipe, currentAsset, currentModel, currentManufacturer, currentCategory,
currentCompany, currentStatusLabel, currentLocation);
} else {
Console.WriteLine("ERROR: Could not connect to SnipeIT database instance.");
// Until a standardized logging framework is set up, quick way to make user see crash message.
Console.ReadKey();
}
debugTimer.Stop();
Trace.WriteLine("Total program execution time " + debugTimer.ElapsedMilliseconds + "ms.");
Trace.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": Exiting application.");
Trace.WriteLine(" ");
}
}
}
================================================
FILE: Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Marksman")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vladimir Rurukin and Daniel Hogg")]
[assembly: AssemblyProduct("Marksman")]
[assembly: AssemblyCopyright("Copyright Vladimir Rurukin and Daniel Hogg © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f459d03d-c5c4-4942-a437-aa9e99635311")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: README.md
================================================
## Marksman - A Windows agent for Snipe-IT
## Installation
1. Download and install the latest .msi installer from the [releases tab](https://github.com/Scope-IT/marksman/releases/).
2. By default, the program will be installed in Program Files (x86)/Scope-IT/Marksman. Edit the Marksman.exe.config file to include your API key and BaseURI from the default values to the ones given by your Snipe-IT instance.
3. Set the Company and Location parameters in Marksman.exe.config, then run the .exe.
## Features
* The agent creates an asset and fills out the fields:
- Asset name (currently machine hostname, unless agent is run in interactive mode)
- Asset id (Asset tag prefix + serial number)
- Location (from a config file or the Organizational Unit)
- Warranty (from config file)
- Status label (from config file)
- Mac address
- Make, model of the machine (as reported to Windows)
* Ensures that the assets created is unique
* New locations, makes, models are created as needed
## Getting started
You will need a working [Snipe-IT](https://snipeitapp.com/) database with API access and an API key.
*We recommend creating a separate user for the agent with minimal (read + add) permissions.*
You can run it via a GPO or Scheduled task (recommended way is to run the agent once on boot with a delay of 1+ minute)
## Developer Guide
If you want to not only use Marksman.exe, but edit the sources and build the project, here are some steps for getting started. Marksman has a dependency on our [specific fork of SnipeSharp](https://github.com/Scope-IT/SnipeSharp), so you will need to build it as well.
1. Create a development folder. Inside this folder, clone the following repos:
* git clone https://github.com/Scope-IT/SnipeSharp
* git clone https://github.com/Scope-IT/marksman
2. Open the SnipeSharp project .sln, and build the solution.
3. Open the marksman project. Check the 'references' under the marksman project, and see if SnipeSharp has been added automatically. Make sure that the path of the SnipeSharp reference points to the repository you just built. If a reference does not exist, you may need to add it manually.
4. Build the marksman project. It should build correctly - if there are any errors at this stage please file a bug report.
5. You can now proceed to edit the config file so that your API key and BaseURI correspond to your Snipe-IT instance. Once the config file is set, the program can be run.
## Bug Reports & Feature Requests
We welcome community participation in this project. Please submit an issue or pull request to participate in the development.
## License
This project is licensed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0)
## Planned features
- [ ] Component lookup (automatic tracking of connected hard drives, CPU, GPU, etc.)
- [ ] Automatic update feature (tracking of computer name and other property changes)
- [ ] Additional query types for location
- [ ] Warranty lookup APIs
- [ ] Cross-platform (Windows/MacOS/Linux) agent using Mono
## Acknowledgments
* The project is based on [SnipeSharp API](https://github.com/cnitschkowski/SnipeSharp) by [barrycarey](https://github.com/barrycarey) and [cnitschkowski](https://github.com/cnitschkowski) with modifications by [velaar](https://github.com/velaar)
* Snipe-IT 4.0+ is required for proper operation
================================================
FILE: marksman.csproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F459D03D-C5C4-4942-A437-AA9E99635311}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Marksman</RootNamespace>
<AssemblyName>Marksman</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="SnipeSharp, Version=0.3.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SnipeSharp\SnipeSharp\bin\Debug\SnipeSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Broker.cs" />
<Compile Include="Marksman.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
================================================
FILE: marksman.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "marksman", "marksman.csproj", "{F459D03D-C5C4-4942-A437-AA9E99635311}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "MarksmanSetup", "..\MarksmanSetup\MarksmanSetup.vdproj", "{6CB58217-2239-4887-A1FB-E515ADAFAB69}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F459D03D-C5C4-4942-A437-AA9E99635311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F459D03D-C5C4-4942-A437-AA9E99635311}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F459D03D-C5C4-4942-A437-AA9E99635311}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F459D03D-C5C4-4942-A437-AA9E99635311}.Release|Any CPU.Build.0 = Release|Any CPU
{6CB58217-2239-4887-A1FB-E515ADAFAB69}.Debug|Any CPU.ActiveCfg = Debug
{6CB58217-2239-4887-A1FB-E515ADAFAB69}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D05F479D-4C4F-4AE5-9E2A-B384BAA229E0}
EndGlobalSection
EndGlobal
gitextract_j25imnp_/ ├── .gitattributes ├── .gitignore ├── App.config ├── Broker.cs ├── LICENSE ├── Marksman.cs ├── Properties/ │ └── AssemblyInfo.cs ├── README.md ├── marksman.csproj └── marksman.sln
SYMBOL INDEX (25 symbols across 2 files)
FILE: Broker.cs
class Broker (line 16) | class Broker
method Broker (line 18) | public Broker()
method IsIdentical (line 23) | public bool IsIdentical(Asset a1, Asset a2)
method CheckConnection (line 55) | public bool CheckConnection(NameValueCollection appSettings)
method SyncAll (line 127) | public List<IRequestResponse> SyncAll(SnipeItApi snipe, Asset currentA...
FILE: Marksman.cs
class PCSystemTypes (line 19) | public class PCSystemTypes {
class WindowsSystemTypes (line 23) | public class WindowsSystemTypes : PCSystemTypes
method WindowsSystemTypes (line 25) | public WindowsSystemTypes()
class Sentry (line 40) | public class Sentry // Data acquissition
method Sentry (line 52) | public Sentry(System.Collections.Specialized.NameValueCollection appSe...
method GetLocation (line 58) | public Location GetLocation(NameValueCollection appSettings, SnipeItAp...
method GetStatusLabel (line 65) | public StatusLabel GetStatusLabel(NameValueCollection appSettings, Sni...
method GetCompany (line 72) | public Company GetCompany(NameValueCollection appSettings, SnipeItApi ...
method GetCategory (line 79) | public Category GetCategory(NameValueCollection appSettings, SnipeItAp...
method GetManufacturer (line 97) | public Manufacturer GetManufacturer(NameValueCollection appSettings, S...
method GetModel (line 104) | public Model GetModel(NameValueCollection appSettings, SnipeItApi snipe)
method GetAsset (line 122) | public Asset GetAsset(NameValueCollection appSettings, SnipeItApi snipe)
method AddQuery (line 155) | public void AddQuery(string queryType, string queryString) { // safely...
method RunWMI (line 174) | private void RunWMI() { // runs all WMI queries
method RunLocation (line 218) | private void RunLocation() // Runs all code related to location & loca...
method GetOutputVariable (line 260) | public string GetOutputVariable(string key)
method GetFormattedVariable (line 271) | public string GetFormattedVariable(string key, string variable = "", s...
method Run (line 288) | public void Run() // supposed to run all queries of all types and hand...
class Marksman (line 298) | class Marksman
method Main (line 303) | static void Main(string[] args)
Condensed preview — 10 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (55K chars).
[
{
"path": ".gitattributes",
"chars": 2518,
"preview": "###############################################################################\n# Set default behavior to automatically "
},
{
"path": ".gitignore",
"chars": 4357,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": "App.config",
"chars": 953,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n <startup> \n <supportedRuntime version=\"v4.0\" sku=\".N"
},
{
"path": "Broker.cs",
"chars": 9458,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.T"
},
{
"path": "LICENSE",
"chars": 11347,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "Marksman.cs",
"chars": 14772,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusi"
},
{
"path": "Properties/AssemblyInfo.cs",
"chars": 1449,
"preview": "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Infor"
},
{
"path": "README.md",
"chars": 3367,
"preview": "## Marksman - A Windows agent for Snipe-IT\n\n## Installation\n1. Download and install the latest .msi installer from the ["
},
{
"path": "marksman.csproj",
"chars": 2759,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
},
{
"path": "marksman.sln",
"chars": 1399,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27703.2026\nM"
}
]
About this extraction
This page contains the full source code of the Scope-IT/marksman GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 10 files (51.2 KB), approximately 11.4k tokens, and a symbol index with 25 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.