GithubHelp home page GithubHelp logo

bubdm / loopbacknet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thexappy/loopbacknet

0.0 0.0 0.0 41 KB

Easy way to create and remove loopback network interfaces on Windows (.NET Framework)

C# 100.00%

loopbacknet's Introduction

LoopbackNET

Easy way to create and remove loopback network interfaces on Windows (.NET Framework)

Utilizes devcon and netsh.

Privileges

An important note about this library - To use devcon.exe it must be run as an elevated process. This is currently enforced by making a check in LoopbackNET that the current process is elevated when trying to create new loopbacks.

Usage

Create new unnamed/name interface:

LoopbackNET.Loopback.Create();
LoopbackNET.Loopback.Create("myLoopback");

If you want to remove the interface when you are done, keep the result:

LoopbackInterface iface = LoopbackNET.Loopback.Create();
... more code ...
iface.Remove();

Another option is to use the 'using' keyword since LoopbackInterface implements IDisposable:

using(LoopbackInterface iface = LoopbackNET.Loopback.Create())
{
  ... more code ...
}

Working with SharpPcap ( + Npcap )

While SharpPcap is not a requirement for this library, you might want to use your newly created loopback interface with a SharpPcap device object.

You can use the NetworkInterface ID of the created loopback to find the right device like so:

LoopbackInterface iface = LoopbackNET.Loopback.Create();
string interfaceId = iface.NetworkInterface.Id;
ICaptureDevice dev = SharpPcap.CaptureDeviceList.Instance.Single(device => device.Name.Contains(interfaceId));

loopbacknet's People

Contributors

thexappy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.