Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added kape flag to separate out parsed data #15

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ With the following arguments meaning:
-o, --old Extract the old bitmap data found in the BMCache file.
-b, --bitmap Provide a collage bitmap aggregating all the tiles.
-w WIDTH, --width WIDTH Specify the number of tiles per line of the aggregated bitmap (default=64).
-k, --kape Use this option to split out the different inputs into separate folders
```
## Changelog
```
15/05/2023 3.03 Added KAPE output to split output into seperate folders
02/03/2023 3.02 Added destination folder existence check beforehand.
01/03/2023 3.01 Fixed old Bitmaps storage and export.
10/02/2022 3.00 Now performing tile decompression.
Expand Down
16 changes: 14 additions & 2 deletions bmc-tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,17 @@ def b_flush(self):
return True

if __name__ == "__main__":
prs = argparse.ArgumentParser(description="RDP Bitmap Cache parser (v. 3.02, 2023/03/02)")
prs = argparse.ArgumentParser(description="RDP Bitmap Cache parser (v. 3.03, 2023/05/15)")
prs.add_argument("-s", "--src", help="Specify the BMCache file or directory to process.", required=True)
prs.add_argument("-d", "--dest", help="Specify the directory where to store the extracted bitmaps.", required=True)
prs.add_argument("-c", "--count", help="Only extract the given number of bitmaps.", type=int, default=-1)
prs.add_argument("-v", "--verbose", help="Determine the amount of information displayed.", action="store_true", default=False)
prs.add_argument("-o", "--old", help="Extract the old bitmap data found in the BMCache file.", action="store_true", default=False)
prs.add_argument("-b", "--bitmap", help="Provide a big bitmap aggregating all the tiles.", action="store_true", default=False)
prs.add_argument("-w", "--width", help="Specify the number of tiles per line of the aggregated bitmap (default=64).", type=int, default=64)
prs.add_argument('-k', "--kape", help="Use this option to split out the different inputs into separate folders", action="store_true", default="False")
args = prs.parse_args(sys.argv[1:])

bmcc = BMCContainer(verbose=args.verbose, count=args.count, old=args.old, big=args.bitmap, width=args.width)
src_files = []
if not os.path.isdir(args.dest):
Expand All @@ -407,8 +409,18 @@ def b_flush(self):
sys.stdout.write("[+++] Processing a single file: '%s'.%s" % (args.src, os.linesep))
src_files.append(args.src)
for src in src_files:
sys.stdout.write("[+++] Processing a file: '%s'.%s" % (src, os.linesep))
if bmcc.b_import(src):
destination = args.dest
if (args.kape == True):
destination = src.replace("\\","_").replace("//","_").replace(":","_").replace("_AppData_Local_Microsoft_Terminal Server Client_Cache","")
destination = args.dest + "\\" + destination
if not os.path.exists(destination):
os.makedirs(destination)

bmcc.b_process()
bmcc.b_export(args.dest)
bmcc.b_export(destination)
bmcc.b_flush()


del bmcc