Skip to content

Instantly share code, notes, and snippets.



Last active Sep 3, 2020
What would you like to do?
Read a file and output it as a string that can be pasted as binar payload
# Reads a file one byte a time and prints it out prepended by "\x".
# Example:
# $ xxd a
# 00000000: ffe4 ..
# $ ./ a
# \xff\xe4
use strict;
use warnings;
my $file = $ARGV[0];
print("# Payload:\n\n");
my $payload_length = 0;
open my $fh, '<:raw', $file;
while(my $bytes_read = read $fh, my $bytes, 1) {
printf("\\x%02x", ord($bytes));
print("# Length: $payload_length bytes.\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.