All Projects → ravahn → Machina

ravahn / Machina

Licence: gpl-3.0
Network capture library for realtime TCP/IP decoding from a windows application. Includes an extension library to support FFXIV data capture.

Projects that are alternatives of or similar to Machina

Txeh
Go library and CLI utilty for /etc/hosts management.
Stars: ✭ 181 (+77.45%)
Mutual labels:  utility, network
Fwd
🚂 The little forwarder that could
Stars: ✭ 203 (+99.02%)
Mutual labels:  utility, network
Pothosblocks
A collection of core processing blocks
Stars: ✭ 7 (-93.14%)
Mutual labels:  utility, network
Sharedchamber
Android Secure SharedPreferences Using Facebook Conceal Encryption
Stars: ✭ 96 (-5.88%)
Mutual labels:  decryption
Gameviewlayouter
A utility script that layouts game views with multiple displays.
Stars: ✭ 97 (-4.9%)
Mutual labels:  utility
Graph sampling
Graph Sampling is a python package containing various approaches which samples the original graph according to different sample sizes.
Stars: ✭ 99 (-2.94%)
Mutual labels:  network
Async Ray
Provide async/await callbacks for every, find, findIndex, filter, forEach, map, reduce, reduceRight and some methods in Array.
Stars: ✭ 102 (+0%)
Mutual labels:  utility
Beluganos
The new network OS designed for white-box switches based on open API.
Stars: ✭ 95 (-6.86%)
Mutual labels:  network
Mercury
Simple Android app that sends pre-configured commands to remote servers via SSH.
Stars: ✭ 100 (-1.96%)
Mutual labels:  utility
Date And Time
A Minimalist DateTime utility for Node.js and the browser
Stars: ✭ 99 (-2.94%)
Mutual labels:  utility
Solarnetwork
Elegant network abstraction layer in Swift.
Stars: ✭ 99 (-2.94%)
Mutual labels:  network
Netfil
A kernel network manager with monitoring and limiting capabilities for macOS. #nsacyber
Stars: ✭ 97 (-4.9%)
Mutual labels:  network
Jsonabc
Sorts JSON object alphabetically. It supports nested objects, arrays and collections. Works offline and beautifies JSON object too.
Stars: ✭ 100 (-1.96%)
Mutual labels:  utility
Ffw
A fuzzing framework for network servers
Stars: ✭ 97 (-4.9%)
Mutual labels:  network
Brightid
Reference mobile app for BrightID
Stars: ✭ 101 (-0.98%)
Mutual labels:  network
Telegram Messages Dump
Command-line tool to dump message history of a Telegram chat.
Stars: ✭ 96 (-5.88%)
Mutual labels:  utility
Npm Quick Run
Quickly run NPM script by prefix without typing the full name
Stars: ✭ 97 (-4.9%)
Mutual labels:  utility
Netconan
netconan - a Network Configuration Anonymizer
Stars: ✭ 98 (-3.92%)
Mutual labels:  network
Kobackupdec
Huawei backup decryptor
Stars: ✭ 94 (-7.84%)
Mutual labels:  decryption
Iglance
Free system monitor for OSX and macOS. See all system information at a glance in the menu bar.
Stars: ✭ 1,358 (+1231.37%)
Mutual labels:  network

Machina

Machina is a library that allows developers to read network data from the windows networking subsystem and reassemble it into usable information.

It supports the following features:

  • Simple raw socket for data capture or optional WinPcap driver support
  • IP Fragmentation reassembly
  • TCP stream reassembly, including retransmits

Because it is accessing network data, it does require running under elevated security privleges on the local machine. It also requires configuring access through the local firewall, or disabling it completely, in order to read data.

In order to simplify use of this library, the TCPNetworkMonitor class was added to poll the network data for a specific process and raise an event when new data arrives. Use of this class can be found in the TCPNetworkMonitorTests class, but here is some sample code:

public static void Main(string[] args)
{
    TCPNetworkMonitor monitor = new TCPNetworkMonitor();
    monitor.WindowName = "FINAL FANTASY XIV";
    monitor.MonitorType = TCPNetworkMonitor.NetworkMonitorType.RawSocket;
    monitor.DataReceived = (string connection, byte[] data) => DataReceived(connection, data);
    monitor.Start();
    // Run for 10 seconds
    System.Threading.Thread.Sleep(10000);
    monitor.Stop();
}
private static void DataReceived(string connection, byte[] data)
{
    // Process Data
}

The import elements in the above code are:

  1. Configure the monitor class with the correct window name or process ID
  2. Hook the monitor up to a data received event
  3. Start the monitor - this kicks off a long-running Task
  4. Process the data in the DataReceived() event handler
  5. Stop the monitor before exiting the process, to prevent unmanaged resources from leaking. This mostly affects WinPCap.

Prior to the above, be sure to either disable windows firewall, or add a rule for any exceutable using the above code to work through it. And, the code must be executed as a local administrator. To debug the above code, you will need to start Visual Studio using the 'Run as Administrator' option in Windows.

The public property UseSocketFilter, when set to true, will apply socket and winpcap filters on both source and target IP Addresses for the connections being monitored. Note that this means that each connection to a new remote IP must be detected and listener started before data will be received. It is likely that some network data will be lost between when the process initiates the connection, and when the Machina library begins to listen. It should only be used if the initial data sent on the connection is not critical. However, it has the benefit of significantly reducing the potential for data loss when there is excessive local network traffic.

Machina.FFXIV

Machina.FFXIV is an extension to the Machina library that decodes Final Fantasy XIV network data and makes it available to programs. It uses the Machina library to locate the game traffic and decode the TCP/IP layer, and then decodes / decompresses the game data into individual game messages. It processes both incoming and outgoing messages.

public static void Main(string[] args)
{
    FFXIVNetworkMonitor monitor = new FFXIVNetworkMonitor();
    monitor.MessageReceived = (string connection, long epoch, byte[] message) => MessageReceived(connection, epoch, message);
    monitor.Start();
    // Run for 10 seconds
    System.Threading.Thread.Sleep(10000);
    monitor.Stop();
}
private static void MessageReceived(string connection, long epoch, byte[] message)
{
    // Process Message
}

An optional Process ID and network monitor type can be specified as properties, to configure per the end-user's machine requirements.

An optional property UseSocketFilter can be set, which is passed through to the TCPNetworkMonitor's property with the same name. This is generally fine for FFXIV, since the TCP connection does not frequently change.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].