add textarea text dump in decode mode

This commit is contained in:
wphiphi 2022-01-04 13:37:50 +01:00 committed by GitHub
parent 6f5439d7a7
commit 3181e2bc6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -296,6 +296,24 @@ function getInfoBits(){
return result;
}
/***
*
* Create text format compatible with Strong Decoder based on qr_array values
* from https://github.com/saitouena/qrazybox/commit/b64a0580be81e0d091c544abae3fff5e246dc09c
***/
function dump_qr_array() {
let sz = qr_array.length;
dump_qr = "";
for(let i=0;i<sz;i++) {
let line = qr_array[i].map(x => x===1 ? 'X' : '_').join('');
console.log(line);
dump_qr += line + "\n"
}
return dump_qr;
}
/***
*
* generate QR code made from canvas based on qr_array values
@ -303,7 +321,7 @@ function getInfoBits(){
***/
function generateResult(){
var c = document.getElementById("qr-result");
var c = document.getElementById("qr-result-canvas");
var size = 17+(qr_version*4);
var ctx = c.getContext("2d");
@ -346,6 +364,12 @@ function generateResult(){
}
}
$("#qr-result-dump").attr('rows', qr_version*4 +17 );
$("#qr-result-dump").attr('cols', qr_version*4 +17 );
$("#qr-result-dump").css( 'font-family', 'Courier New');
$("#qr-result-dump").css("font-size", "7px");
$("#qr-result-dump").val( dump_qr_array() );
$("#qr-result").show();
$("#qr-table").hide();
$("#qr-overlay").hide();
@ -857,7 +881,7 @@ function bruteForceFormatInfo(){
qr_format_array = format_information_bits[i][j].split("").reverse();
saveInfoTable(qr_size);
generateResult();
var image = document.getElementById("qr-result").toDataURL();
var image = document.getElementById("qr-result-canvas").toDataURL();
if(i == 3 && j == 7){
decodeFromBase64(image, function(data){
brute_result.push(data);
@ -1590,7 +1614,7 @@ $(document).ready(function(){
$("#div-brute-force-loader").show();
bruteForceFormatInfo();
} else {
var image = document.getElementById("qr-result").toDataURL();
var image = document.getElementById("qr-result-canvas").toDataURL();
$("#decode-message").val("");
$("#div-decode").show();
decodeFromBase64(image, function(decodedData){