{"id":24607388,"url":"https://github.com/redteampentesting/postscript_blog_examples","last_synced_at":"2026-01-04T12:05:15.462Z","repository":{"id":199699711,"uuid":"703051540","full_name":"RedTeamPentesting/postscript_blog_examples","owner":"RedTeamPentesting","description":"PostScript examples useful for attacking Ghostscript.","archived":false,"fork":false,"pushed_at":"2024-08-01T07:55:18.000Z","size":13,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T17:38:03.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PostScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedTeamPentesting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-10T13:58:34.000Z","updated_at":"2024-12-17T23:02:32.000Z","dependencies_parsed_at":"2025-01-24T17:37:01.480Z","dependency_job_id":"08481f3f-8e8b-43a0-9a46-050a66e3e2c7","html_url":"https://github.com/RedTeamPentesting/postscript_blog_examples","commit_stats":null,"previous_names":["redteampentesting/postscript_blog_examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedTeamPentesting%2Fpostscript_blog_examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedTeamPentesting%2Fpostscript_blog_examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedTeamPentesting%2Fpostscript_blog_examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedTeamPentesting%2Fpostscript_blog_examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedTeamPentesting","download_url":"https://codeload.github.com/RedTeamPentesting/postscript_blog_examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244208804,"owners_count":20416161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T17:36:55.168Z","updated_at":"2026-01-04T12:05:10.424Z","avatar_url":"https://github.com/RedTeamPentesting.png","language":"PostScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository contains PostScript examples useful for attacking Ghostscript.\n\nFor details see the corresponding blog post:\nhttps://blog.redteam-pentesting.de/2023/ghostscript-overview/\n\n## `print_version.ps`\n\nModified version of `print_version.ps` from [ghostinthepdf](https://github.com/neex/ghostinthepdf). Prints useful information about the configuration of Ghostscript.\n\n## `list_files.ps`\n\nPrints all filenames contained in the specified directory (by default `/tmp/`) to the output page.\n\n### Variables\n\n```\n% how many chars per line at most\n/charactercount 100 def\n\n% Which directory should be listed\n/target_directory (/tmp/*) def\n```\n\n## `print_file.ps`\n\nWrites the content of the specified file to the page. The used function needs to be specified at the end of the code:\n\n- `PrintFileBase64`: Prints files encoded as Base64 onto the page, useful for binary files.\n\n```\n(/usr/bin/bash) PrintFileBase64\n```\n\n- `PrintFileAsText`: Prints the content of files onto the page, respects newlines. Useful for simple text files, but binary files can also be printed if needed.\n\n```\n(/etc/passwd) PrintFileAsText\n```\n\n### Variables\n\n```\n% how many chars per line at most\n/charactercount 100 def\n```\n\n## `embed_files_in_pdf.ps`\n\nThis script embeds all files in the specified directory (by default `/tmp/`) in the output PDF file using PDFMark.\nOnly works with `pdfwrite` device for that reason.\nUse `extract_pdf_attachments.py` to extract all files from the PDF, or any capable PDF reader.\n\n### Variables\n\n```\n% How many files can be included at most\n/maxFileCount 100 def\n\n% The folder with wildcard which will be embedded\n/targetFolder (/tmp/*) def\n\n% Enables printing error information to the page\n/printErrors false def\n```\n\n## `long_running_embed_files.ps`\n\nSimilar to `embed_files_in_pdf.ps`, but runs for a specified amount of time and collects short-lived files by scanning the specified directory in regular intervals.\n\n### Variables\n\n```\n% how often files should be checked\n/totalRounds 1000 def\n\n% How many milliseconds to sleep inbetween rounds\n/sleepDuration 10 def\n\n% How many files can be included at most\n/maxFileCount 100 def\n\n% The folder with wildcard which will be embedded\n/targetFolder (/tmp/*) def\n\n% Enables printing error information to the page\n/printErrors false def\n```\n\n## `write_file.ps`\n\nWriting files onto the disk. The used function needs to be specified at the end of the code:\n\n- Writing plaintext: Useful for simple and short text file:\n\n```\noutfile (Output string which will be written to outfile) writestring\n```\n\n- `base64Decode`: Base64 decodes the input string. Useful for embedding (binary) files in PostScript. Decoding and writing to file:\n\n```\n(SGFsbG8gV2VsdAo=) base64Decode { outfile exch write } forall\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredteampentesting%2Fpostscript_blog_examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredteampentesting%2Fpostscript_blog_examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredteampentesting%2Fpostscript_blog_examples/lists"}