Skip to content

Commit de752fd

Browse files
committed
Updated quick start guide
1 parent ae3645d commit de752fd

File tree

1 file changed

+206
-44
lines changed

1 file changed

+206
-44
lines changed

src/quick_start.md

Lines changed: 206 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,245 @@
11
# Quick start guide
22

3-
## 1. Binary Installation
3+
Here you can find quick-start guides to run memflow on [Windows](#windows) and [Linux](#linux).
44

5-
// TODO: provide linux/mac packages (aur, homebrew) and windows binaries
5+
## Linux
66

7-
Currently, only source installation is available, so please follow the next section.
7+
### 1. Installing memflowup
88

9-
## 2. Compiling from Source
9+
Please make sure that rustup and cargo are properly installed on your system and cargo has at least version 1.70.0. You can verify the version via:
10+
```
11+
> cargo --version
12+
cargo 1.74.1 (ecb9851af 2023-10-18)
13+
```
14+
In case your cargo/rust version is outdated you can instruct `rustup` to update your toolchain:
15+
```
16+
> rustup update
17+
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
18+
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
19+
info: checking for self-update
20+
21+
stable-x86_64-pc-windows-msvc unchanged - rustc 1.74.1 (a28077b28 2023-12-04)
22+
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.76.0-nightly (a96d57bdb 2023-12-15)
23+
24+
info: cleaning up downloads & tmp directories
25+
```
26+
27+
After setting up cargo properly you can install memflowup via our install script:
28+
```
29+
> curl --proto '=https' --tlsv1.2 -sSf https://sh.memflow.io | bash
30+
```
31+
32+
Alternatively you can install memflowup via cargo:
33+
```
34+
> cargo install memflowup --force --version "=0.1.0-beta11"
35+
...
36+
Installed package `memflowup v0.1.0-beta11` (executable `memflowup.exe`)
37+
```
1038

11-
### 2.0. Prerequisites
39+
#### Note
40+
memflowup should __not__ be installed or ran as root or via sudo. By default rust installs cargo and all binaries installed via cargo on a per-user basis. This means running the installation as root will result in memflowup being placed in `/root/` (because it is the root user's home directory) and will also only be accessible from the root user.
1241

13-
memflow is written entirely in [Rust](https://www.rust-lang.org/). It is therefore required to have a Rust toolchain installed. memflow is verified to compile on the stable toolchain of Rust 1.45.1.
42+
### 2. Installing plugins
1443

15-
More information on how to install Rust can be obtained from the [rustup project website](https://rustup.rs/).
44+
When running `memflowup` for the first time it is recommended to use the interactive mode and install memflow from the 0.2.0-beta branch (development).
1645

17-
### 2.1. Connectors
46+
Installing packages system-wide will place all plugins in `/usr/local/lib/memflow`.\
47+
Installing packages per user will place all plugins in `$HOME/.local/lib/memflow`.
1848

19-
Recommended way to manage multiple connectors is through the [memflowup](https://github.com/memflow/memflowup) utility. It requires [Python 3](https://www.python.org/).
49+
You might also want to build all packages from source for now.
2050

21-
#### 2.1.1. Linux / macOS in one line
51+
memflow will later automatically look in both of those directories (and the current working directory) for plugins.
2252

23-
```bash
24-
$ curl -L https://raw.githubusercontent.com/memflow/memflowup/master/memflowup.py | python3
53+
Please make sure to __not__ run memflow as root (see the [note](#note) above)
2554
```
55+
> memflowup interactive
56+
do you want to build packages from source? [y/N]: y
57+
Running in interactive mode. You can always re-run memflowup to install additional packages, or to different paths.
58+
do you want to install the initial packages system-wide? [Y/n]: n
59+
which channel do you want to use? [stable/DEVELOPMENT]: development
60+
Available packages in dev channel:
61+
0. memflow-win32 - CorePlugin
62+
1. memflow-native - CorePlugin
63+
2. memflow-qemu - CorePlugin
64+
3. memflow-coredump - CorePlugin
65+
4. memflow-pcileech - CorePlugin
66+
67+
Type packages to install by number, name, or type * for all:
68+
*
69+
70+
...
71+
Initial setup done!
72+
```
73+
74+
It is always possible to re-run interactive mode and redo the initial setup.
75+
76+
### 2. Updating plugins
77+
78+
To update all the installed plugins simply run `memflowup update`:
79+
```
80+
> memflow update --help
81+
Updates all installed packages
82+
83+
Usage: memflowup update [OPTIONS]
84+
85+
Options:
86+
--ignore-user-index
87+
--ignore-upstream-index
88+
--ignore-builtin-index
89+
-s, --system Enables system-wide installation for all users
90+
-d, --dev
91+
-h, --help Print help
92+
```
93+
94+
In case you installed the plugins like in the example above you can simply use the development branch and install them non system-wide:
95+
```
96+
> memflowup update -d
97+
```
98+
99+
### 3. Verify your installation and run an example
100+
101+
To test if everything is working properly the easiest method is to simply
102+
use one of the [examples](https://github.com/memflow/memflow/tree/0.2.0-beta11/memflow/examples) provided in memflow.
26103

27-
#### 2.1.2. With Git
104+
To run the examples simply check out the memflow repo with the appropiate version:
105+
```
106+
> git clone --depth 1 --branch 0.2.0-beta11 https://github.com/memflow/memflow
107+
> cd memflow
108+
```
28109

29-
Clone and run the script:
110+
You can safely ignore the warning about the 'detached HEAD' state. This happens because we are checking out a specific tag in the memflow repo.
30111

31-
```bash
32-
$ git clone https://github.com/memflow/memflowup.git
33-
$ cd memflowup
34-
$ python3 memflowup.py
112+
And run one of the examples:
113+
```
114+
> cargo run --example process_list -- --os native
35115
```
116+
This examples runs the process_list example (which just lists all processes on the system) using the [`memflow-native`](https://github.com/memflow/memflow-native) plugin. This plugin simply proxies your local OS calls to memflow (as in using [process_vm_readv](https://man7.org/linux/man-pages/man2/process_vm_readv.2.html) and [process_vm_writev](https://man7.org/linux/man-pages/man2/process_vm_writev.2.html)).
36117

37-
Update installed connectors:
118+
If everything went well you should see a list of all open processes:
119+
```
120+
> cargo run --example process_list -- --os native
121+
PID SYS ARCH PROC ARCH NAME
38122
39-
```bash
40-
$ python3 memflowup.py update
123+
...
41124
```
42125

43-
### 2.2. CLI
44126

45-
#### 2.2.1 Client
127+
## Windows
128+
129+
### 1. Installing memflowup
130+
Please make sure that rustup and cargo are properly installed on your system and cargo has at least version 1.70.0. You can verify the version via:
131+
```
132+
> cargo --version
133+
cargo 1.74.1 (ecb9851af 2023-10-18)
134+
```
135+
In case your cargo/rust version is outdated you can instruct `rustup` to update your toolchain:
136+
```
137+
> rustup update
138+
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
139+
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
140+
info: checking for self-update
141+
142+
stable-x86_64-pc-windows-msvc unchanged - rustc 1.74.1 (a28077b28 2023-12-04)
143+
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.76.0-nightly (a96d57bdb 2023-12-15)
46144
47-
Install the client:
145+
info: cleaning up downloads & tmp directories
146+
```
48147

49-
```bash
50-
$ cargo install --git https://github.com/memflow/memflow-cli/ memflow-cli
148+
After setting up cargo properly you can install memflowup via cargo:
149+
```
150+
> cargo install memflowup --force --version "=0.1.0-beta11"
151+
...
152+
Installed package `memflowup v0.1.0-beta11` (executable `memflowup.exe`)
51153
```
52154

53-
(If running local daemon) By default, memflow socket is only accessible to the memflow group, create it, and add your user:
155+
### 2. Installing plugins
156+
157+
When running `memflowup` for the first time it is recommended to use the interactive mode and install memflow from the 0.2.0-beta branch (development).
54158

55-
```bash
56-
$ sudo groupadd memflow
57-
$ sudo usermod -aG memflow (username)
159+
Installing packages system-wide will place all plugins in `%ProgramFiles%\memflow\`.\
160+
Installing packages per user will place all plugins in `%UserProfile%\Documents\memflow\`.
161+
162+
You might also want to build all packages from source for now.
163+
164+
memflow will later automatically look in both of those directories (and the current working directory) for plugins.
165+
```
166+
> memflowup interactive
167+
do you want to build packages from source? [y/N]: y
168+
Running in interactive mode. You can always re-run memflowup to install additional packages, or to different paths.
169+
do you want to install the initial packages system-wide? [Y/n]: n
170+
which channel do you want to use? [stable/DEVELOPMENT]: development
171+
Available packages in dev channel:
172+
0. memflow-win32 - CorePlugin
173+
1. memflow-native - CorePlugin
174+
2. memflow-qemu - CorePlugin
175+
3. memflow-coredump - CorePlugin
176+
4. memflow-pcileech - CorePlugin
177+
178+
Type packages to install by number, name, or type * for all:
179+
*
180+
181+
...
182+
Initial setup done!
58183
```
59184

60-
You will need to logout for the group changes to be applied
61-
#### 2.2.2 Daemon
185+
It is always possible to re-run interactive mode and redo the initial setup.
62186

63-
Daemon is currently only supported on Unix systems.
187+
### 2. Updating plugins
64188

65-
Install the daemon and create initial config:
189+
To update all the installed plugins simply run `memflowup update`:
190+
```
191+
> memflow update --help
192+
Updates all installed packages
193+
194+
Usage: memflowup.exe update [OPTIONS]
195+
196+
Options:
197+
--ignore-user-index
198+
--ignore-upstream-index
199+
--ignore-builtin-index
200+
-s, --system Enables system-wide installation for all users
201+
-d, --dev
202+
-h, --help Print help
203+
```
66204

67-
```bash
68-
$ cargo install --git https://github.com/memflow/memflow-cli/ memflow-daemon
69-
$ sudo mkdir -p /etc/memflow/
70-
$ curl -L https://raw.githubusercontent.com/memflow/memflow-cli/master/daemon.conf | sudo tee /etc/memflow/daemon.conf
205+
In case you installed the plugins like in the example above you can simply use the development branch and install them non system-wide:
206+
```
207+
> memflowup update -d
71208
```
72209

73-
## 3. Running in Docker
210+
### 3. Verify your installation and run an example
74211

75-
// TODO: implement + describe docker setup
212+
To test if everything is working properly the easiest method is to simply
213+
use one of the [examples](https://github.com/memflow/memflow/tree/0.2.0-beta11/memflow/examples) provided in memflow.
76214

77-
## 4. The command-line interface
215+
To run the examples simply check out the memflow repo with the appropiate version:
216+
```
217+
> git clone --depth 1 --branch 0.2.0-beta11 https://github.com/memflow/memflow
218+
> cd memflow
219+
```
78220

79-
// TODO: show cli usage
221+
You can safely ignore the warning about the 'detached HEAD' state. This happens because we are checking out a specific tag in the memflow repo.
222+
In case you are missing git you can install it from [here](https://git-scm.com/download/win).
80223

81-
## 5. Working with the library
224+
And run one of the examples:
225+
```
226+
> cargo run --example process_list -- --os native
227+
```
228+
This examples runs the process_list example (which just lists all processes on the system) using the [`memflow-native`](https://github.com/memflow/memflow-native) plugin. This plugin simply proxies your local OS calls to memflow (as in using [ReadProcessMemory](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-readprocessmemory) and [WriteProcessMemory](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-writeprocessmemory)).
82229

83-
// TODO: write and explain examples
230+
If everything went well you should see a list of all open processes:
231+
```
232+
> cargo run --example process_list -- --os native
233+
PID SYS ARCH PROC ARCH NAME
234+
0 x86_64 x86_64 [System Process] () (Alive)
235+
4 x86_64 x86_64 System () (Alive)
236+
300 x86_64 x86_64 Secure System () (Alive)
237+
348 x86_64 x86_64 Registry () (Alive)
238+
952 x86_64 x86_64 smss.exe () (Alive)
239+
1316 x86_64 x86_64 csrss.exe () (Alive)
240+
1412 x86_64 x86_64 wininit.exe () (Alive)
241+
1420 x86_64 x86_64 csrss.exe () (Alive)
242+
1484 x86_64 x86_64 services.exe () (Alive)
243+
244+
...
245+
```

0 commit comments

Comments
 (0)