Skip to content

Instantly share code, notes, and snippets.

@z448
Last active December 5, 2016 02:00
Show Gist options
  • Save z448/d51beb0141a4a6111e0a5d21fa501daa to your computer and use it in GitHub Desktop.
Save z448/d51beb0141a4a6111e0a5d21fa501daa to your computer and use it in GitHub Desktop.
read contents of iOS pasteboard
#!/usr/local/bin/perl
use 5.010;
use strict;
use warnings;
use Mac::PropertyList;
my $data;
{
local $/;
open(my $fh,"<",'/private/var/mobile/Library/Caches/com.apple.UIKit.pboard/pasteboardDB');
$data = <$fh>;
close $fh;
}
sub read_pasteboard {
my $plist = Mac::PropertyList::parse_plist( $data );
for(@{$plist}){
my $s = $_->as_perl;
unless($s eq 1){
if($s->{name} eq 'com.apple.UIKit.pboard.general'){
for(@{$s->{items}->{mobile}}){
say $_->{'public.utf8-plain-text'};
}
}
}
}
}
read_pasteboard();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment