HoneyLib 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HoneyLib --version 1.1.0                
NuGet\Install-Package HoneyLib -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HoneyLib" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HoneyLib --version 1.1.0                
#r "nuget: HoneyLib, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HoneyLib as a Cake Addin
#addin nuget:?package=HoneyLib&version=1.1.0

// Install HoneyLib as a Cake Tool
#tool nuget:?package=HoneyLib&version=1.1.0                

HoneyLib

Managing honeypots. Made easy.

HoneyLib is a library to make managing honeypots easier.

Features

  • Per-IP logging
  • Different logging options
  • Report suspicious activity to AbuseIPDB

This library allows you to manage logging and reporting suspicious IPs that hit your honeypots. The library supports per-IP logging, logging of reports, advanced logging etc!

Usage

We use .NET 6 to run HoneyLib.

Create a honeypot, to link HoneyLib create an object like this

HoneyPot hp = new HoneyPot();
// or
HoneyPot hp2 = new HoneyPot("AbuseIPDB_TOKEN_HERE!");

Then define logging level like this:

hp.LoggingLevel = (int)HoneyPot.Logging.StdOut;
// or
hp.LoggingLevel = (int)(HoneyPot.Logging.StdOut | HoneyPot.Logging.LogConnections);

To change the token at any time use:

hp.AbuseIPDB = null; // to disable reports
hp.AbuseIPDB = "token"; // to set a new token

To access reports use this:

hp.Report("IP addresss", $"{hp.Time()} Unauthorized access!", (int)HoneyPot.ReportType.Hacking);
// or
hp.Report(server.AcceptTcpClient(), $"{hp.Time()} Evil person!", (int)HoneyPot.ReportType.Scanning);

Different types of logging are allowed, too:

// Dependent logging (useful for TCP applications)
hp.LoggingLevel = (int)(HoneyPot.Logging.StdOut | HoneyPot.Logging.LogConnections);
TcpClient client = tcp.AcceptTcpClient();
string hostname = hp.GetHost(client);
int port = hp.GetPort(client);
hp.Connect(client); // adds connection log to main file
hp.Log(client, $"Is a bad guy!"); // adds a log to per-IP logger for this IP
hp.Disconnect(client); // adds a connection terminated log, terminates FileStream for log

// Independent logging (useful for web, UDP applications, or when you don't want to manually keep track of connected users)
hp.LoggingLevel = (int)HoneyPot.Logging.StdOut;
TcpClient client = tcp.AcceptTcpClient();
string hostname = hp.GetHost(client);
int port = hp.GetPort(client);
hp.Log($"Client {hostname}:{port} connected to 127.0.0.1:80");
hp.Log(client, "Is a bad guy!");
hp.Log($"Client {hostname}:{port} had disconnected.");

NLog

Since 1.1.0 we are using NLog, so you can configure how exactly it operates. HoneyLib doesn't have any logging presets by default, so make sure you configure NLog in your own projects!!!

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 478 7/6/2022
1.1.0 418 7/6/2022
1.0.2 414 6/13/2022
1.0.1 415 6/13/2022
1.0.0 409 6/13/2022