-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
PNG_CTF
Showing
15 changed files
with
371 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
body { | ||
background-color: #212121; | ||
margin: 10px; | ||
overflow: hidden; | ||
} | ||
|
||
#box { | ||
position: relative; | ||
margin: 0 auto; | ||
border: 1px solid #ccc; | ||
padding: 0px; | ||
border-radius: 4px; | ||
width: 250px; | ||
height: 42px; | ||
} | ||
|
||
#form { | ||
height: 40px; | ||
background-color: #fff; | ||
overflow: hidden | ||
} | ||
|
||
#user_in { | ||
font-size: 14px; | ||
color: #54e325; | ||
border-width: 0; | ||
background: transparent; | ||
line-height: 15px | ||
} | ||
|
||
#box input[type="text"], | ||
#box input[type="number"] { | ||
width: 90%; | ||
padding: 12px 0 5px 0; | ||
color: #6ff347; | ||
outline: none; | ||
} | ||
|
||
#submit-button { | ||
position: absolute; | ||
top: 1px; | ||
right: 1px; | ||
bottom: 1px; | ||
|
||
height: 40px; | ||
width: 80px; | ||
color: #fff; | ||
text-align: center; | ||
border-width: 0; | ||
background-color: #36ba01; | ||
cursor: pointer; | ||
text-transform: uppercase; | ||
border-radius: 3px; | ||
outline: 0; | ||
} | ||
|
||
#submit-button:hover { | ||
background: #00ff2b | ||
} | ||
|
||
|
||
.container { | ||
display: flex; | ||
justify-content: center; | ||
/* Center horizontally */ | ||
align-items: center; | ||
/* Center vertically */ | ||
height: 100vh; | ||
/* Adjust as needed */ | ||
} | ||
|
||
img { | ||
max-width: 100%; | ||
max-height: 100%; | ||
position:absolute; | ||
z-index: 2; | ||
} | ||
|
||
canvas { | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: 80px; | ||
left: 0px; | ||
z-index: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- | ||
Inspired by John Johnson's CTF | ||
Engineered the reverse engineered the javascript code. | ||
--> | ||
<html> | ||
|
||
<head> | ||
<link rel="stylesheet" href="css/main.css"> | ||
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" | ||
integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"> | ||
</script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/101/three.min.js" | ||
integrity="sha512-MzluaiqTHieej9sKOtlT5D5uog5n278iCAX/sr8Ms271OkiKptg1RZgRXRjhQ+v4yO3LcffdeeQfiUfMpduqeA==" | ||
crossorigin="anonymous" referrerpolicy="no-referrer"></script> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/[email protected]/tsparticles.confetti.bundle.min.js"></script> | ||
|
||
<script src="js/flag.js"></script> | ||
<!--<script src="js/flag_small.js"></script>--> | ||
<script src="js/particles.js"></script> | ||
<script src="js/effects.js"></script> | ||
<script src="js/ctf.js"></script> | ||
|
||
<body> | ||
|
||
<center> | ||
<div id="box"> | ||
<form id="ctf_form" action="#i_pass_butter" | ||
onsubmit="assemble_png(document.getElementById('user_in').value)"> | ||
<input id="user_in" type="text"> | ||
<!-- <input id="user_in" type="number" maxlength="16"> --> | ||
<button id='submit-button' type='submit' title="Submit the Key"><span>🗝️</span></button> | ||
|
||
</form> | ||
</div> | ||
|
||
<div class="container"> | ||
<img id="image" src="" /> | ||
</div> | ||
</center> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
var bytes = []; | ||
|
||
// TODO: API | ||
if (resp) { | ||
bytes = Array.from(resp.split(" "), x => Number(x)); | ||
} | ||
else { | ||
$.get("bytes", function (resp) { | ||
bytes = Array.from(resp.split(" "), x => Number(x)); | ||
}); | ||
} | ||
|
||
|
||
function assemble_png(u_in) { | ||
var LEN = 16; | ||
var key = "0000000000000000"; | ||
var shifter; | ||
|
||
if (u_in == "particles") { | ||
run(); | ||
return; | ||
} | ||
|
||
if (u_in.length == LEN) { | ||
key = u_in; | ||
} | ||
|
||
var result = []; | ||
for (var i = 0; i < LEN; i++) { | ||
shifter = key.charCodeAt(i) - 48; | ||
for (var j = 0; j < (bytes.length / LEN); j++) { | ||
result[(j * LEN) + i] = bytes[(((j + shifter) * LEN) % bytes.length) + i] | ||
} | ||
} | ||
while (result[result.length - 1] == 0) { | ||
result = result.slice(0, result.length - 1); | ||
} | ||
document.getElementById("image").src = "data:image/png;base64," | ||
+ btoa(String.fromCharCode.apply(null, new Uint8Array(result))); | ||
return false; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
function congratulations() { | ||
const defaults = { | ||
spread: 360, | ||
ticks: 100, | ||
gravity: 0, | ||
decay: 0.94, | ||
startVelocity: 30, | ||
}; | ||
|
||
function shoot() { | ||
confetti({ | ||
...defaults, | ||
particleCount: 30, | ||
scalar: 1.2, | ||
shapes: ["circle", "square"], | ||
colors: ["#a864fd", "#29cdff", "#78ff44", "#ff718d", "#fdff6a"], | ||
}); | ||
|
||
confetti({ | ||
...defaults, | ||
particleCount: 60, | ||
scalar: 2, | ||
shapes: ["emoji"], | ||
shapeOptions: { | ||
emoji: { | ||
value: ["🐱💻", "🌈", "🖖", "💎", "👩💻", "⚡", "🚀"], | ||
}, | ||
}, | ||
}); | ||
} | ||
|
||
setTimeout(shoot, 0); | ||
setTimeout(shoot, 100); | ||
setTimeout(shoot, 200); | ||
} | ||
|
||
|
||
window.addEventListener('load', function () { | ||
var img = document.getElementById('image'); | ||
|
||
img.onload = function () { | ||
console.log('Image loaded successfully.'); | ||
congratulations(); | ||
assets = ["https://wind010.github.io/ctf_soundboard/assets/3.wav", "assets/wub.mp3"] | ||
var audio = new Audio(assets[Math.floor(Math.random() * assets.length)]); | ||
audio.play(); | ||
}; | ||
|
||
img.onerror = function () { | ||
console.log('Error loading image.'); | ||
assets = ["assets/error.mp3", "assets/deny.mp3"] | ||
var audio = new Audio(assets[Math.floor(Math.random() * assets.length)]); | ||
audio.play(); | ||
}; | ||
}) | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
function run() { | ||
//threejs - demo - https://threejs.org/examples/?q=particles#webgl_points_billboards | ||
//var container = document.createElement('div'); | ||
//document.body.appendChild(container); | ||
|
||
var container = document.getElementsByTagName('body')[0] | ||
|
||
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 3000) | ||
camera.position.z = 1000; // Pull this back to 2000 to see what is actually going on | ||
|
||
var scene = new THREE.Scene(); | ||
scene.fog = new THREE.FogExp2(0x41ac17, 0.0020); // color of fog - objects are all white | ||
var geometry = new THREE.Geometry(); | ||
|
||
for (i = 0; i < 20000; i++) // Total objects within each particle object | ||
{ //-1000 is for centering on screen, span would be -1000 to 1000 | ||
var vertex = new THREE.Vector3(); | ||
vertex.x = Math.random() * 2000 - 1000; | ||
vertex.y = Math.random() * 2000 - 1000; | ||
vertex.z = Math.random() * 2000 - 1000; | ||
geometry.vertices.push(vertex); | ||
} | ||
|
||
for (i = 0; i < getRandomNumber(1, 10); i++) { | ||
var material = new THREE.PointsMaterial({ size: getRandomNumber() }); | ||
var particles = new THREE.Points(geometry, material); | ||
particles.rotation.x = getRandomNumber(); | ||
particles.rotation.y = getRandomNumber(); | ||
particles.rotation.z = getRandomNumber(); | ||
scene.add(particles); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////// | ||
|
||
var renderer = new THREE.WebGLRenderer(); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
container.appendChild(renderer.domElement); | ||
|
||
renderer.render(scene, camera); | ||
render(); | ||
|
||
function render() { | ||
camera.position.z = generateSmoothNumber() // Zoom in and out via sine wave logic. | ||
requestAnimationFrame(render); | ||
for (i = 0; i < scene.children.length; i++) { | ||
var object = scene.children[i]; | ||
if (object instanceof THREE.Points) { | ||
object.rotation.y += .0033; | ||
} | ||
} | ||
renderer.render(scene, camera); | ||
} | ||
} | ||
|
||
function getRandomNumber(min=1, max=10) { | ||
// Generate a random decimal number between 0 and 1 | ||
var randomNumber = Math.random(); | ||
|
||
// Scale the random number to be between min and max | ||
var scaledNumber = Math.floor(randomNumber * (max - min + 1)) + min; | ||
|
||
return scaledNumber; | ||
} | ||
|
||
|
||
function generateSmoothNumber(min= 100, max=2500) { | ||
// Get the current timestamp in milliseconds | ||
const timestamp = new Date().getTime(); | ||
|
||
// Calculate a value between 0 and 1 based on sine function | ||
const value = Math.sin(timestamp / 10000); // Adjust the divisor to control the smoothness | ||
|
||
// Map the value from the range [-1, 1] to the range [min, max] | ||
const smoothNumber = value * (max - min) / 2 + (max + min) / 2; | ||
|
||
return smoothNumber; | ||
} | ||
|
||
|
||
window.addEventListener('load', function () { | ||
//run(); | ||
}); | ||
|
||
window.addEventListener('resize', onWindowResize, false); | ||
function onWindowResize() { | ||
if (typeof camera === 'undefined') { | ||
return; | ||
} | ||
camera.aspect = window.innerWidth / window.innerHeight; | ||
camera.updateProjectionMatrix(); | ||
|
||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Some future PTO | ||
|
||
TODO: | ||
* API to provide generated bytes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Docker project generated files to ignore | ||
# if you want to ignore files created by your editor/tools, | ||
# please consider a global .gitignore https://help.github.com/articles/ignoring-files | ||
.vagrant* | ||
bin | ||
docker/docker | ||
.*.swp | ||
a.out | ||
*.orig | ||
build_src | ||
.flymake* | ||
.idea | ||
.DS_Store | ||
docs/_build | ||
docs/_static | ||
docs/_templates | ||
.gopath/ | ||
.dotcloud | ||
*.test | ||
bundles/ | ||
.hg/ | ||
.git/ | ||
vendor/pkg/ | ||
pyenv | ||
Vagrantfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Use the Alpine Linux base image | ||
FROM alpine:latest | ||
|
||
# Install sshpass | ||
RUN apk --no-cache add openssh-client sshpass --no-check-certificate | ||
|
||
# CMD to keep the container running | ||
CMD ["tail", "-f", "/dev/null"] |