Skip to content

Commit

Permalink
Fix: fix definition screen bug
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Mar 9, 2020
1 parent 83a5222 commit db01152
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ python setup.py install
## Activate recorder on client machine

To activate recorder set this two registry keys on client
* HKLM\SOFTWARE\Microsoft\Terminal Server Client\EnableRecording set to one
* HKLM\SOFTWARE\Microsoft\Terminal Server Client\RecordingPath set to output filename
* HKLM\SOFTWARE\Microsoft\Terminal Server Client\EnableRecording DWORD set to one
* HKLM\SOFTWARE\Microsoft\Terminal Server Client\RecordingPath STRING set to output filename

## Parse cacdec stream

Expand Down
13 changes: 7 additions & 6 deletions cacdec/cacdec.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,17 @@ def build_from_stream(stream, output_folder):
width = cacdec_stream.objects[0].info.width
height = cacdec_stream.objects[0].info.height
codec = progressive_context_new(False)
progressive_create_surface_context(codec, 0, 640, 480)
progressive_create_surface_context(codec, 0, width, height)

screen = bytes(width*height*4)
index = 0
for i in cacdec_stream.objects:
if i.type == 4:
progressive_decompress(codec, i.info.width, i.info.height, i.info.dst_step, i.data, screen)
file_path = "%s/windows.%s.data"%(output_folder, index)
res = progressive_decompress(codec, i.info.width, i.info.height, i.info.dst_step, i.data, screen)
if res != 1:
print("[!] Error during progressive decompression")
continue
file_path = "%s/windows.%s.bmp"%(output_folder, index)
print("[+] writing frame of size %s %s into raw file data %s" % (width, height, file_path))

screen_output = b''
Expand All @@ -114,8 +117,6 @@ def build_from_stream(stream, output_folder):
for j in range(0, width):
line += curent_line[j*4:(j+1)*4][::-1]
screen_output += line

with open(file_path, "wb") as f:
f.write(b"BM"+pack("<L", len(screen_output)+0x36)+b"\x00\x00\x00\x00\x32\x00\x00\x00\x28\x00\x00\x00"+pack("<L", width)+pack("<L", height)+b"\x01\x00\x20\x00\x00\x00\x00\x00"+pack("<L", len(screen_output))+b"\x00"*12+screen_output)
write_bmp(file_path, width, height, screen_output)
index += 1

Binary file added example/record.cacdec
Binary file not shown.

0 comments on commit db01152

Please sign in to comment.