Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 132 additions & 125 deletions filesmugglingbuilder.html
Original file line number Diff line number Diff line change
@@ -1,138 +1,145 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>File Smuggling Builder</title>
<script type="text/javascript">
var file="";
var filebase64="";
<meta charset="UTF-8">
<title>File Smuggling Builder</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript">
var file = "";
var filebase64 = "";

function build() {
var fileobject = document.getElementById("fileid");
file=fileobject.files[0];
function build() {
var fileobject = document.getElementById("fileid");
file = fileobject.files[0];

var fileReader = new FileReader();
fileReader.onload = function(event) {
filebase64 = fileReader.result.replace('data:', '').replace(/^.+,/, '');
generatehtml();
}
fileReader.readAsDataURL(file);
}
var fileReader = new FileReader();
fileReader.onload = function (event) {
filebase64 = fileReader.result.replace('data:', '').replace(/^.+,/, '');
generatehtml();
}
fileReader.readAsDataURL(file);
}

function xor(input)
{
var result = "";
var password = document.getElementById("passwordid").value;
for(i=0; i<input.length; ++i){
result += String.fromCharCode(password.charCodeAt(i % password.length) ^ input.charCodeAt(i));
}
return result;
}
function xor(input) {
var result = "";
var password = document.getElementById("passwordid").value;
for (i = 0; i < input.length; ++i) {
result += String.fromCharCode(password.charCodeAt(i % password.length) ^ input.charCodeAt(i));
}
return result;
}

function generatehtml(){
let htmlstring = "<!DOCTYPE html>\n" +
"<html>\n" +
"<meta charset='UTF-8'>\n"+
"<title>" + file.name + "<\/title>\n"+
"<body style='font-family: Arial, Helvetica, sans-serif'>\n"+
"<script>\n"+
"function b64toarray(base64) {\n"+
" var bin_string = window.atob(base64);\n"+
" var len = bin_string.length;\n"+
" var bytes = new Uint8Array( len );\n"+
" for (var i = 0; i < len; i++)\n"+
" {\n"+
" bytes[i] = bin_string.charCodeAt(i);\n"+
" }\n"+
" return bytes.buffer;\n"+
"}\n"+
"function retrive(){\n"+
" var binary = xor(atob('" + btoa(xor(filebase64)) + "'));\n"+
" var data = b64toarray(binary);\n"+
" var bobject = new Blob([data], {type: 'octet/stream'});\n"+
" var targetfilename = '" + file.name + "';\n"+
" var hiddenobject = document.createElement(String.fromCharCode(97));\n"+
" document.body.appendChild(hiddenobject);\n"+
" hiddenobject.style = 'display: none';\n"+
" var url = window.URL.createObjectURL(bobject);\n"+
" hiddenobject.href = url;\n"+
" eval('hiddenobject' + String.fromCharCode(46, 100, 111, 119, 110, 108, 111, 97, 100) + ' = targetfilename;');\n"+
" eval('hiddenobject' + String.fromCharCode(46, 99, 108, 105, 99, 107, 40, 41) + ';');\n"+
" window.URL.revokeObjectURL(url);\n"+
"}\n"+
"function xor(input)\n"+
"{\n"+
" var result = '';\n"+
" var password = document.getElementById('passwordid').value;\n"+
" for(i=0; i<input.length; ++i){\n"+
" result += String.fromCharCode(password.charCodeAt(i % password.length) ^ input.charCodeAt(i));\n"+
" }\n"+
" return result;\n"+
"}\n"+
"<\/script>\n"+
"<table border=0 style='background: #1abc9c'>\n"+
"<tr>\n"+
" <td>\n"+
" File: " + file.name + "\n"+
" <br>\n"+
" Size: " + file.size.toLocaleString() + " bytes\n"+
" <br>\n"+
" Message: " + document.getElementById("textid").value + "\n"+
" <br>\n"+
" <input type=password id=passwordid placeholder=password>\n"+
" <br>\n"+
" <button onclick=retrive()>Retrieve File<\/button>\n"+
" <\/td>\n"+
"<\/tr>\n"+
"<\/table>\n"+
"<br>\n"+
"<br>\n"+
"<br>\n"+
"<small>Generated by <a href=https://github.com/eddiechu/File-Smuggling target=_blank>https://github.com/eddiechu/File-Smuggling<\/a><\/small>\n"+
"<\/body>\n"+
"<\/html>\n";
function generatehtml() {
let htmlstring = "<!DOCTYPE html>\n" +
"<html>\n" +
"<meta charset='UTF-8'>\n" +
"<title>" + file.name + "<\/title>\n" +
"<body style='font-family: Arial, Helvetica, sans-serif'>\n" +
"<script>\n" +
"function b64toarray(base64) {\n" +
" var bin_string = window.atob(base64);\n" +
" var len = bin_string.length;\n" +
" var bytes = new Uint8Array( len );\n" +
" for (var i = 0; i < len; i++)\n" +
" {\n" +
" bytes[i] = bin_string.charCodeAt(i);\n" +
" }\n" +
" return bytes.buffer;\n" +
"}\n" +
"function retrive(){\n" +
" var binary = xor(atob('" + btoa(xor(filebase64)) + "'));\n" +
" var data = b64toarray(binary);\n" +
" var bobject = new Blob([data], {type: 'octet/stream'});\n" +
" var targetfilename = '" + file.name + "';\n" +
" var hiddenobject = document.createElement(String.fromCharCode(97));\n" +
" document.body.appendChild(hiddenobject);\n" +
" hiddenobject.style = 'display: none';\n" +
" var url = window.URL.createObjectURL(bobject);\n" +
" hiddenobject.href = url;\n" +
" eval('hiddenobject' + String.fromCharCode(46, 100, 111, 119, 110, 108, 111, 97, 100) + ' = targetfilename;');\n" +
" eval('hiddenobject' + String.fromCharCode(46, 99, 108, 105, 99, 107, 40, 41) + ';');\n" +
" window.URL.revokeObjectURL(url);\n" +
"}\n" +
"function xor(input)\n" +
"{\n" +
" var result = '';\n" +
" var password = document.getElementById('passwordid').value;\n" +
" for(i=0; i<input.length; ++i){\n" +
" result += String.fromCharCode(password.charCodeAt(i % password.length) ^ input.charCodeAt(i));\n" +
" }\n" +
" return result;\n" +
"}\n" +
"<\/script>\n" +
"<table border=0 style='background: #1abc9c'>\n" +
"<tr>\n" +
" <td>\n" +
" File: " + file.name + "\n" +
" <br>\n" +
" Size: " + file.size.toLocaleString() + " bytes\n" +
" <br>\n" +
" Message: " + document.getElementById("textid").value + "\n" +
" <br>\n" +
" <input type=password id=passwordid placeholder=password>\n" +
" <br>\n" +
" <button onclick=retrive()>Retrieve File<\/button>\n" +
" <\/td>\n" +
"<\/tr>\n" +
"<\/table>\n" +
"<br>\n" +
"<br>\n" +
"<br>\n" +
"<small>Generated by <a href=https://github.com/eddiechu/File-Smuggling target=_blank>https://github.com/eddiechu/File-Smuggling<\/a><\/small>\n" +
"<\/body>\n" +
"<\/html>\n";

var targetfilename = file.name + ".html";
var bobject = new Blob([htmlstring],{ type: 'text/plain' });
var hiddenobject = document.createElement(String.fromCharCode(97));
document.body.appendChild(hiddenobject);
hiddenobject.style = 'display: none';
var url = window.URL.createObjectURL(bobject);
hiddenobject.href = url;
eval('hiddenobject' + String.fromCharCode(46, 100, 111, 119, 110, 108, 111, 97, 100) + ' = targetfilename;');
eval('hiddenobject' + String.fromCharCode(46, 99, 108, 105, 99, 107, 40, 41) + ';');
window.URL.revokeObjectURL(url);
alert(file.name + " is converted and downloaded as " + file.name + ".html");
}
var targetfilename = file.name + ".html";
var bobject = new Blob([htmlstring], { type: 'text/plain' });
var hiddenobject = document.createElement(String.fromCharCode(97));
document.body.appendChild(hiddenobject);
hiddenobject.style = 'display: none';
var url = window.URL.createObjectURL(bobject);
hiddenobject.href = url;
eval('hiddenobject' + String.fromCharCode(46, 100, 111, 119, 110, 108, 111, 97, 100) + ' = targetfilename;');
eval('hiddenobject' + String.fromCharCode(46, 99, 108, 105, 99, 107, 40, 41) + ';');
window.URL.revokeObjectURL(url);
alert(file.name + " is converted and downloaded as " + file.name + ".html");
}


</script>
</script>
</head>
<body style="font-family: Arial, Helvetica, sans-serif">
<h3>File Smuggling Builder v1.0</h3>
<table border=0 style="background: #1abc9c">
<tr>
<td>Choose file: </td>
<td><input type="file" id="fileid"></td>
</tr>
<tr>
<td>Set open password: </td>
<td><input type="password" id="passwordid"></td>
</tr>
<tr>
<td>Message: </td>
<td><input type="text" id="textid" oninput="this.size = this.value.length"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><button onclick="build()">Build Embedded HTML file</button></td>
</tr>
</table>
<br>
<br>
<br>
<small>Please download the original and latest version from <a href=https://github.com/eddiechu/File-Smuggling target=_blank>https://github.com/eddiechu/File-Smuggling</a></small>
<br>

<body>
<!-- <h1>File Smuggling Builder v1.0</h1> -->
<div class="main">
<h1>File Smuggling Builder v1.0</h1>
<table>
<!-- table border=0 style="background: #1abc9c" -->
<tr class="row">
<td>Choose File: </td>
<td><input type="file" id="fileid"></td>
</tr>
<tr class="row">
<td>Set Open Password: </td>
<td><input class="text-input" type="password" id="passwordid"></td>
</tr>
<tr class="row">
<td>Message: </td>
<td><input class="text-input" type="text" id="textid" oninput="this.size = this.value.length"></td>
</tr>
</table>
<button onclick="build()">Build Embedded HTML file</button>
</div>
<br>
<br>
<br>
<p>
Please download the original and latest version from <a href=https://github.com/eddiechu/File-Smuggling
target=_blank>https://github.com/eddiechu/File-Smuggling</a>
</p>
<br>

</body>
</html>

</html>
89 changes: 89 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

html{
font-size: 62.5%; /* Now 1rem = 10px */
font-family: "Poppins", sans-serif;
}

body{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-image: url('https://cdn.pixabay.com/photo/2022/07/10/20/18/binary-7313703_1280.jpg');
background-size: cover;
background-position: center;
}

h1{
padding-top: 2rem;
font-size: 4rem;
text-align: center;
color: rgb(255, 0, 0);
}

.main{
backdrop-filter: blur(8px);
width: 60rem;
height: auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 2rem 0;
border-radius: 2rem;
box-shadow: 0px 0px 500px 0px rgb(30, 179, 8);
}

table{
width: 60rem;
height: 20rem;
}

td{
font-size: 2rem;
padding-left: 1.5rem;
padding-bottom: 0rem;
color: white;
}

.text-input{
width: 30rem;
height: 4rem;
border: none;
outline: none;
border-radius: 3rem;
font-size: 2rem;
padding-left: 1rem;
}

button{
width: 30rem;
height: 5rem;
border-radius: 3rem;
border: none;
outline: none;
margin: 3rem 0;
font-size: 1.5rem;
font-weight: bold;
cursor: pointer;
}

button:hover{
background-color: black;
color: white;
}

p{
background-color: red;
padding: 0 1rem;
color: white;
font-size: 2rem;
text-align: center;
}