Skip to content

Commit 97b9710

Browse files
authored
Merge pull request #2 from qtc-de/dev
Prepare v1.1.0 Release
2 parents f5c80a4 + db91a6d commit 97b9710

File tree

21 files changed

+182
-114
lines changed

21 files changed

+182
-114
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## v1.1.0 - July 17, 2024
10+
11+
### Added
12+
13+
* Add offset property to `RpcMethod`
14+
* Add offset property to `SecurityCallback`
15+
16+
### Changed
17+
18+
* Fix type errors caused by newer v versions
19+
* Fix incorrect attr syntax in newer v versions
20+
* Fix incorrect address of security callbacks
21+
* Rename `base` property of `RpcMethod` to `addr`
22+
* Rename `base` property of `SecurityCallback` to `addr`
23+
24+
925
## v1.0.1 - Sep 24, 2023
1026

1127
### Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[![](https://github.com/qtc-de/rpv/actions/workflows/build-examples.yml/badge.svg?branch=main)](https://github.com/qtc-de/rpv/actions/workflows/build-examples.yml)
77
[![](https://github.com/qtc-de/rpv/actions/workflows/build-examples.yml/badge.svg?branch=dev)](https://github.com/qtc-de/rpv/actions/workflows/build-examples.yml)
8-
[![](https://img.shields.io/badge/version-1.0.1-blue)](https://github.com/qtc-de/rpv/releases)
8+
[![](https://img.shields.io/badge/version-1.1.0-blue)](https://github.com/qtc-de/rpv/releases)
99
[![](https://img.shields.io/badge/programming%20language-v-blue)](https://vlang.io/)
1010
[![](https://img.shields.io/badge/license-GPL%20v3.0-blue)](https://github.com/qtc-de/rpv/blob/master/LICENSE)
1111
[![](https://img.shields.io/badge/docs-fa6b05)](https://qtc-de.github.io/rpv)
@@ -29,7 +29,7 @@ Assuming that *v* [is installed](https://github.com/vlang/v#installing-v-from-so
2929
installing *rpv* can be done using the following command:
3030

3131
```console
32-
[user@host ~]$ v install qtc_de.rpv
32+
[user@host ~]$ v install qtc-de.rpv
3333
```
3434

3535
After installation, *rpv* can be used to analyze *RPC* servers and

alternate/default-x64.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub const compatible_rpc_versions = [
8282
// of v, the '[if x64]' attribute is ignored for structs, but will be
8383
// available in future. Up to this point, we need to keep the x64 and x86
8484
// struct definitions in separate files.
85-
[if x64]
85+
@[if x64]
8686
pub struct RpcInterface {
8787
pub:
8888
p_rpc_server &RpcServer = unsafe { nil }
@@ -123,7 +123,7 @@ pub:
123123
// of v, the '[if x64]' attribute is ignored for structs, but will be
124124
// available in future. Up to this point, we need to keep the x64 and x86
125125
// struct definitions in separate files.
126-
[if x64]
126+
@[if x64]
127127
pub struct RpcServer {
128128
pub:
129129
mutex Mutex
@@ -167,7 +167,7 @@ pub:
167167
// of v, the '[if x64]' attribute is ignored for structs, but will be
168168
// available in future. Up to this point, we need to keep the x64 and x86
169169
// struct definitions in separate files.
170-
[if x64]
170+
@[if x64]
171171
pub struct RpcAddress {
172172
pub:
173173
vtable voidptr

alternate/default-x86.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub const compatible_rpc_versions = [
8282
// of v, the '[if x86]' attribute is ignored for structs, but will be
8383
// available in future. Up to this point, we need to keep the x64 and x86
8484
// struct definitions in separate files.
85-
[if x86]
85+
@[if x86]
8686
pub struct RpcInterface {
8787
pub:
8888
p_rpc_server &RpcServer = unsafe { nil }
@@ -119,7 +119,7 @@ pub:
119119
// of v, the '[if x86]' attribute is ignored for structs, but will be
120120
// available in future. Up to this point, we need to keep the x64 and x86
121121
// struct definitions in separate files.
122-
[if x86]
122+
@[if x86]
123123
pub struct RpcServer {
124124
pub:
125125
mutex Mutex
@@ -158,7 +158,7 @@ pub:
158158
// of v, the '[if x86]' attribute is ignored for structs, but will be
159159
// available in future. Up to this point, we need to keep the x64 and x86
160160
// struct definitions in separate files.
161-
[if x86]
161+
@[if x86]
162162
pub struct RpcAddress {
163163
pub:
164164
vtable voidptr

examples/details.v

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ fn main()
5454

5555
println('[+] Security Callback:')
5656

57-
if intf.sec_callback.base != 0
57+
if intf.sec_callback.addr != 0
5858
{
5959
println('[+]\t Registred : True')
60-
println('[+]\t Base Address: 0x${intf.sec_callback.base}')
60+
println('[+]\t Address : 0x${intf.sec_callback.addr}')
61+
println('[+]\t Offset : 0x${intf.sec_callback.offset.hex()}')
6162

6263
if intf.sec_callback.location.path != ''
6364
{
64-
println('[+]\t Location : 0x${intf.sec_callback.location.path}')
65+
println('[+]\t Location : ${intf.sec_callback.location.path}')
6566
}
6667
}
6768

@@ -74,7 +75,7 @@ fn main()
7475

7576
for method in intf.methods
7677
{
77-
println('[+]\t ${method.name} (base: 0x${method.base})')
78+
println('[+]\t ${method.name} (addr: 0x${method.addr}, offset: 0x${method.offset.hex()})')
7879
}
7980

8081
return

examples/list.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ fn main()
2525
println('[+] Path : ${info.path}')
2626

2727
println('[+] RPC Endpoints:')
28+
2829
for endpoint in info.rpc_info.server_info.endpoints
2930
{
3031
println('[+]\t ${endpoint.protocol} - ${endpoint.name}')
3132
}
3233

3334
println('[+] RPC Interfaces:')
35+
3436
for intf in info.rpc_info.interface_infos
3537
{
3638
if intf.methods.len > 0

internals/rpc-common.v

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub:
8686

8787
// C.RPC_IF_ID represents an ID of an RPC interface. This is basically an GUID
8888
// but also contains a major and minor version.
89-
[typedef]
89+
@[typedef]
9090
pub struct C.RPC_IF_ID {
9191
Uuid C.GUID
9292
VersMajor u16
@@ -103,7 +103,7 @@ pub fn (this C.RPC_IF_ID) equals(other C.RPC_IF_ID) bool
103103
// C.RPC_DISPATCH_TABLE contains information on the defined RPC methods of an
104104
// RPC interface. rpv uses it to determine the method count, that can be obtained
105105
// from the DispatchTableCount property.
106-
[typedef]
106+
@[typedef]
107107
pub struct C.RPC_DISPATCH_TABLE {
108108
DispatchTableCount u32
109109
DispatchTable voidptr
@@ -116,7 +116,7 @@ pub struct C.RPC_DISPATCH_TABLE {
116116
// formatting of these methods. This is used in conjunction with the FmtStringOffset
117117
// property, which contains the offset of the different methods within the ProcString,
118118
// to decompile RPC methods.
119-
[typedef]
119+
@[typedef]
120120
pub struct C.MIDL_SERVER_INFO {
121121
pStubDesc &C.MIDL_STUB_DESC = unsafe { nil }
122122
DispatchTable &voidptr = unsafe { nil }
@@ -133,7 +133,7 @@ pub struct C.MIDL_SERVER_INFO {
133133
// by the RPC methods of the corresponding interface. rpv uses this information to decompile
134134
// RPC methods. Moreover, Reserved5 is required for parsing NDR expressions. Actually the
135135
// member is named pExprInfo by Microsoft, but within the mingw libraries it is Reserved5.
136-
[typedef]
136+
@[typedef]
137137
pub struct C.MIDL_STUB_DESC {
138138
RpcInterfaceInformation voidptr = unsafe { nil }
139139
pfnAllocate voidptr = unsafe { nil }
@@ -151,13 +151,13 @@ pub struct C.MIDL_STUB_DESC {
151151
MIDLVersion u32
152152
CommFaultOffsets &C.COMM_FAULT_OFFSETS = unsafe { nil }
153153
// New fields for version 3.0+
154-
aUserMarshalQuadruple &C.USER_MARSHAL_ROUTINE_QUADRUPLE = unsafe { nil }
154+
aUserMarshalQuadruple voidptr = unsafe { nil }
155155
// Notify routines - added for NT5, MIDL 5.0
156-
NotifyRoutineTable &C.NDR_NOTIFY_ROUTINE = unsafe { nil }
156+
NotifyRoutineTable voidptr = unsafe { nil }
157157
// Reserved for future use.
158158
mFlags &u32 = unsafe { nil }
159159
// International support routines - added for 64bit post NT5
160-
CsRoutineTables &C.NDR_CS_ROUTINES = unsafe { nil }
160+
CsRoutineTables voidptr = unsafe { nil }
161161
Reserved4 voidptr = unsafe { nil }
162162
Reserved5 voidptr = unsafe { nil } // mIDA: expr_table - RpcView: pExprInfo
163163
// Fields up to now present in win2000 release.
@@ -173,7 +173,7 @@ pub struct NDR_EXPR_DESC {
173173

174174
// C.MIDL_SYNTAX_INFO is a struct that is used within internal RPC struct definitions.
175175
// It is currently not used by rpv.
176-
[typedef]
176+
@[typedef]
177177
pub struct C.MIDL_SYNTAX_INFO {
178178
TransferSyntax C.RPC_SYNTAX_IDENTIFIER
179179
DispatchTable &C.RPC_DISPATCH_TABLE
@@ -186,47 +186,47 @@ pub struct C.MIDL_SYNTAX_INFO {
186186

187187
// C.MIDL_INTERFACE_METHOD_PROPERTIES is a struct that is used within internal RPC struct definitions.
188188
// It is currently not used by rpv.
189-
[typedef]
189+
@[typedef]
190190
pub struct C.MIDL_INTERFACE_METHOD_PROPERTIES {
191191
MethodCount u16
192192
MethodProperties &C.MIDL_METHOD_PROPERTY_MAP
193193
}
194194

195195
// C.MIDL_METHOD_PROPERTY_MAP is a struct that is used within internal RPC struct definitions.
196196
// It is currently not used by rpv.
197-
[typedef]
197+
@[typedef]
198198
pub struct C.MIDL_METHOD_PROPERTY_MAP {
199199
count u32
200200
Properties &C.MIDL_METHOD_PROPERTY
201201
}
202202

203203
// C.MIDL_METHOD_PROPERTY is a struct that is used within internal RPC struct definitions.
204204
// It is currently not used by rpv.
205-
[typedef]
205+
@[typedef]
206206
pub struct C.MIDL_METHOD_PROPERTY {
207207
Id u32
208208
value usize
209209
}
210210

211211
// C.UUID_VECTOR is a struct that is used within internal RPC struct definitions.
212212
// It is currently not used by rpv.
213-
[typedef]
213+
@[typedef]
214214
pub struct C.UUID_VECTOR {
215215
Count u32
216216
Uuid [1]&C.GUID
217217
}
218218

219219
// C.RPC_SYNTAX_IDENTIFIER is a struct that is used within internal RPC struct definitions.
220220
// It is currently not used by rpv.
221-
[typedef]
221+
@[typedef]
222222
pub struct C.RPC_SYNTAX_IDENTIFIER {
223223
SyntaxGUID C.GUID
224224
SyntaxVersion C.RPC_VERSION
225225
}
226226

227227
// C.RPC_VERSION is a struct that is used within internal RPC struct definitions.
228228
// It is currently not used by rpv.
229-
[typedef]
229+
@[typedef]
230230
pub struct C.RPC_VERSION {
231231
MajorVersion u16
232232
MinorVersion u16

internals/rpc-internal-structs.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub const compatible_rpc_versions = [
8282
// of v, the '[if x64]' attribute is ignored for structs, but will be
8383
// available in future. Up to this point, we need to keep the x64 and x86
8484
// struct definitions in separate files.
85-
[if x64]
85+
@[if x64]
8686
pub struct RpcInterface {
8787
pub:
8888
p_rpc_server &RpcServer = unsafe { nil }
@@ -123,7 +123,7 @@ pub:
123123
// of v, the '[if x64]' attribute is ignored for structs, but will be
124124
// available in future. Up to this point, we need to keep the x64 and x86
125125
// struct definitions in separate files.
126-
[if x64]
126+
@[if x64]
127127
pub struct RpcServer {
128128
pub:
129129
mutex Mutex
@@ -167,7 +167,7 @@ pub:
167167
// of v, the '[if x64]' attribute is ignored for structs, but will be
168168
// available in future. Up to this point, we need to keep the x64 and x86
169169
// struct definitions in separate files.
170-
[if x64]
170+
@[if x64]
171171
pub struct RpcAddress {
172172
pub:
173173
vtable voidptr

ndr/context.v

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ pub struct NdrContext {
1717
type_cache &TypeCache
1818
}
1919

20+
// newNdrContext creates a new NdrContext. The main reason why we have a constructor
21+
// here is to leave the struct fields access modifiers untouched. In newer v releases,
22+
// initializing private struct fields seems only possible using a constructor.
23+
pub fn NdrContext.new(handle win.HANDLE, stub_desc C.MIDL_STUB_DESC, flags NdrInterpreterOptFlags2, mut cache &TypeCache) NdrContext
24+
{
25+
return NdrContext {
26+
process_handle: handle
27+
stub_desc: stub_desc
28+
flags: flags
29+
type_cache: cache
30+
}
31+
}
32+
2033
// read attempts to read the type <T> from process memory at the specified
2134
// address. If successfully, a newly created <T> type is returned. How many
2235
// bytes to read is determined by the structure size of <T>. Notice that

ndr/flags.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module ndr
33
// NdrFlags contains additional information for NDR data.
44
// Especially the has_return value is important for rpv,
55
// as it indicates whether a method returns a value.
6-
[flag]
6+
@[flag]
77
pub enum NdrFlags as u8
88
{
99
server_must_size
@@ -19,7 +19,7 @@ pub enum NdrFlags as u8
1919
// NdrInterpreterOptFlags2 contains additional information
2020
// on how to interpret NDR data. rpv needs this struct to
2121
// determine how specific NDR types need to be parsed.
22-
[flag]
22+
@[flag]
2323
pub enum NdrInterpreterOptFlags2 as u8
2424
{
2525
has_new_corr_desc

0 commit comments

Comments
 (0)