Skip to content

Instantly share code, notes, and snippets.

@thatsprettyfaroutman
Created June 15, 2015 20:24
Show Gist options
  • Save thatsprettyfaroutman/44d01305dbd0fcdb095c to your computer and use it in GitHub Desktop.
Save thatsprettyfaroutman/44d01305dbd0fcdb095c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Drawfulextract</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
// dumpcap -i 3 -f "tcp port 38202" -a filesize:1000 -n -w test.pcapng
// Modify in wireshark
$(function () {
$.ajax({
url : 'test.json',
dataType : 'text'
})
.then(extractImages)
.then(showImages);
function extractImages(res) {
var d = $.Deferred();
var bits = res.match(/"drawing":"(.*)"/gi);
var urls = bits.map(function (item) {
item = item.split('drawing":"')[1];
item = item.split('"')[0];
return 'data:image/jpeg;base64,' + item;
});
d.resolve(urls);
return d.promise();
}
function showImages(urls) {
urls.map(function (url) {
var img = $('<img/>');
img.attr('src', url);
$('body').append(img);
});
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment