Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added some extra screenshot functionality. #3

Merged
merged 3 commits into from

2 participants

@kosborn

Not fully developed, need to throw together an interface to access stored screenshots.

Currently using HTLM sql database, looks ike the limit is high enough, I was able to store at least 150 records =~ 50MB. Couldn't find the hard coded limit in chrome, but if it becomes an issue, we can write a 'dump all' or whatever version. Could add JSZip functionality to download all at once ;)

kosborn and others added some commits
@kosborn kosborn 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)
52f8668
@kosborn kosborn messed up the beef hook block on last commit.
should consider changing that.
69b3714
Kos Added a rudimentary way to view saved screenshots.
Performance issues = bad idea bears...
29d6f80
@kosborn

I'm certain there are methods in JQuery to create elements a bit nicer than I did at line #881

@koto koto merged commit af503b6 into from
@koto
Owner

I converted from webSQL (it's deprecated) to indexed db (support in both FF and Chrome). Check my branch for updates. Didn't test in in Chrome yet.

@kosborn

good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 1, 2012
  1. @kosborn

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

    kosborn authored
    …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)
  2. @kosborn

    messed up the beef hook block on last commit.

    kosborn authored
    should consider changing that.
Commits on Apr 7, 2012
  1. Added a rudimentary way to view saved screenshots.

    Kos authored
    Performance issues = bad idea bears...
This page is out of date. Refresh to see the latest.
Showing with 65 additions and 0 deletions.
  1. +65 −0 console.html
View
65 console.html
@@ -59,6 +59,7 @@
background-color: #0088CC !important;
color: #FFFFFF !important;
}
+#screenshots-saved-images {max-height: 400px; overflow-y: auto; border: 3px solid #000000;}
.modal {
display:none;
}
@@ -67,6 +68,10 @@
width: 800px;
margin: 0 0 0 -400px; /* -1 * (width / 2) */
}
+.screenshot-modal {
+ width: 1000px;
+ margin: -400px 0 0 -500px; /* -1 * (width / 2) */
+}
.mono {
font-family: Menlo, Monaco, "Courier New", monospace;
white-space: pre;
@@ -87,6 +92,7 @@
<li><a href="#about-modal" data-toggle=modal>About</a></li>
<li><a href="#readme-modal" data-toggle=modal>Readme</a></li>
<li><a href="#hook-modal" data-toggle=modal>Hook code</a></li>
+ <li><a href="#saved-screenshots-modal" id=saved-screenshots-load data-toggle=modal>Saved Screenshots</a></li>
</ul>
<a class="brand" href="#">XSS ChEF - Chrome Extension Exploitation Framework</a>
</div>
@@ -333,6 +339,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">
@@ -405,6 +416,17 @@
</div>
</div>
+<div class="modal screenshot-modal" id="saved-screenshots-modal">
+ <div class="modal-header">
+ <a class="close" data-dismiss="modal">&times;</a>
+ <h3>Saved Screenshots</h3>
+ </div>
+ <div class="modal-body">
+ <div id=saved-screenshots style="text-align:center">
+ </div>
+ </div>
+</div>
+
<div id="alert" class="alert alert-info span3">
<a class="close" data-dismiss="alert">&times;</a>
<span id="alert-msg"></span>
@@ -417,6 +439,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
@@ -837,6 +865,43 @@
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'))
+ });
+
+ $('#saved-screenshots-load').click(function() {
+ shot=[]
+ $('#saved-screenshots').html('')
+ db.transaction(function (x) {
+ x.executeSql('select * from list;', [],function(tx,r){
+ var len = r.rows.length;
+ for (i = 0; i < len; i++) {
+ shot[i]=r.rows.item(i);
+ d=document;
+ span=d.createElement('span');
+ img=d.createElement('img');
+ anchor=d.createElement('a');
+ img.setAttribute('id','screenshots-saved-images');
+ img.setAttribute('width','400px');
+ img.setAttribute('heigt','400px');
+ img.src=shot[i]['image'];
+ img.setAttribute('onclick','window.open("'+shot[i]['image']+'")');
+ span.appendChild(img);
+ $('#saved-screenshots').append(span)
+ }
+ })
+ });
+ });
+
$(document).on('click', '#links a', function() {
var cmd = "location.href = " + JSON.stringify(this.href);
sendCmd('eval', cmd, {id: currentTab});
Something went wrong with that request. Please try again.