Giter Site home page Giter Site logo

rrg's Introduction

RRG

CI status

RRG is a Rust rewrite of GRR (a remote live forensics framework).

It strives to evaluate how feasible it is to rewrite the client-side part of GRR (an agent service) without all the historical baggage that the current version has to carry. For example, it does not implement its own communication layer, but leverages Fleetspeak for that. It also tries to assess how many existing issues related to the Python codebase could be resolved by using a modern language with powerful type system and strong safety guarantees.

This project is not an official Google product, is under heavy development and should not be used for any production deployments. So far, it is nothing more than an experiment.

Development

Prerequisites

RRG is written in Rust and needs a Rust toolchain to be built. The recommended way of installing Rust is to use rustup.

Because RRG is only a component of a bigger system, to do anything useful with it you also need to setup Fleetspeak and GRR.

Building

RRG uses Cargo for everything, so building it is as easy as running:

$ cargo build

This will create a unoptimized executable target/debug/rrg.

To create release executable (note that this is much slower and is not suitable for quick iterations) run:

$ cargo build --release

This will create an optimized executable target/release/rrg.

Testing

To run all tests:

$ cargo test

To run tests only for a particular crate:

$ cargo test --package='ospect'

To run only a particular test:

$ cargo test --package='rrg' action::get_file_contents::tests::handle_empty_file

To verify that the code compiles on all supported platforms:

$ cargo check --tests --target='x86_64-unknown-linux-gnu' --target='x86_64-apple-darwin' --target='x86_64-pc-windows-gnu'

Note that this requires additional toolchains for cross-compilation to be installed.

It is also possible to use cross-compilation and tools like Wine to run tests on another operating system:

$ cargo test --target='x86_64-pc-windows-gnu' --package='rrg' --no-run
$ wine target/x86_64-pc-windows-gnu/debug/deps/rrg-bcf99adf861ea84a.exe

Structure

Directories

  • crates/ — All Rust crates that the project consists of live here.
  • docs/ — All non-code documentation and guides live here.
  • proto/ — All Protocol Buffers definitions describing RRG's API live here.

Crates

  • ospect — Tools for inspecting the operating system.
  • rrg — Implementation of all agent actions and the entry point.
  • rrg-proto — Code generated from Protocol Buffer definitions.

rrg's People

Contributors

alex65536 avatar alexjokel avatar fedya001 avatar katsiarynadzibrova avatar m0rc1pann avatar panhania avatar rainmustfall avatar realtimetodie avatar s-westphal avatar spawek avatar xtsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rrg's Issues

Implement the `TransferBuffer` action

RRG should support the TransferBuffer action. It accepts BufferReference as input and should respond with the same (which is awkward, but we need to follow all GRR oddities).

Note that unlike the ReadBuffer action, this method also sends data to a persistent session (or a "well-known flow" using the GRR nomenclature).

Migrate from `getmntinfo` to `getfsstat`

Currently, in the macOS implementation of ospect::fs::mounts function we use the getmntinfo function. However, it is not thread-safe and even though we try to harden against some of the issues that might arise from its usage, it is still theoretically not sound from the Rust perspective. A much better approach would be to use getfsstat that apparently does not have such issues.

`ospect::os::fqdn` does not work on macOS

Some change recently caused the tests for ospect::os::fqdn to fail. GitHub Actions run for 34441db (run) succeeded but the following 1a39af0 (run) failed. The commit does not touch this function at all.

When testing locally the low-level function used to implement this (getaddrinfo), the same error happens:

#include <limits.h>
#include <stdio.h>
#include <unistd.h>
#include <netdb.h>

int main(void)
{
    int err;

    long host_name_max = sysconf(_SC_HOST_NAME_MAX);
    char hostname[host_name_max + 1];
    
    err = gethostname(hostname, sizeof(hostname));
    if (err != 0) {
        fprintf(stderr, "failed to get hostname: %d", err);
        return 1;
    }

    printf("hostname: %s\n", hostname);

    struct addrinfo hints = {0};
    hints.ai_family = PF_UNSPEC;
    hints.ai_socktype = 0;
    hints.ai_protocol = 0;
    hints.ai_flags = AI_CANONNAME;

    struct addrinfo *info;

    err = getaddrinfo(hostname, NULL, &hints, &info);
    if (err != 0) {
        fprintf(stderr, "failed to get hostname information: %s\n", gai_strerror(err));
        return 1;
    }

    printf("fqdn: %s\n", info->ai_canonname);

    freeaddrinfo(info);

    return 0;
}

When running this code, the call to getaddrinfo fails with EAI_NONAME ("nodename nor servname provided, or not known"). This indicates that we call this function incorrectly (either nodename or servname must be provided but we are clearly doing so).

The run for commit 34441db was on macOS 12.6.9 whereas the run for commit 1a39af0 was on macOS 12.7. There is a chance that some system-level change was introduced that broke us.

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.