Giter Site home page Giter Site logo

remote-utils's Introduction

remote-utils

    // Example of usage
    #[test]
    fn test_mem_read() -> anyhow::Result<(), anyhow::Error>
    {
        let proc = Process::local()?;
        let num: u64 = 123456789;
        let num_addr = std::ptr::addr_of!(num) as u64;
        let mem_value = proc.read_memory(num_addr, std::mem::size_of::<u64>())?;
        let raw_mem = mem_value.into_boxed_slice();
        let box_mem = unsafe { Box::from_raw(Box::into_raw(raw_mem) as *mut [u8; 8]) };
        let unbox = *box_mem;
        let read_value = u64::from_le_bytes(unbox);
        assert_eq!(read_value, num);
        Ok(())
    }

    #[test]
    fn test_mem_write() -> anyhow::Result<(), anyhow::Error>
    {
        let proc = Process::local()?;
        let num: u64 = 123456789;
        let num_addr = std::ptr::addr_of!(num) as u64;
        let new_num: u64 = 987654321;
        let new_num_vec = new_num.to_le_bytes().to_vec();
        proc.write_memory(num_addr, &new_num_vec)?;
        assert_eq!(num, new_num);
        Ok(())
    }

    #[test]
    #[cfg(target_os = "windows")]
    fn test_get_library() -> anyhow::Result<(), anyhow::Error>
    {
        let proc = Process::local()?;
        let found_library = proc.get_shared_library("ntdll.dll")?;
        assert_eq!(found_library.cached_name.is_some(), true);
        assert_eq!(found_library.cached_name.unwrap(), "ntdll.dll");
        Ok(())
    }

    #[test]
    #[cfg(target_os = "linux")]
    fn test_get_library() -> anyhow::Result<(), anyhow::Error>
    {
        let proc = Process::local()?;
        proc.get_shared_library("libc.so")?;
        Ok(())
    }

remote-utils's People

Contributors

keyboardsmoke avatar

Watchers

James Cloos avatar  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.