Compare commits

..

2 commits

Author SHA1 Message Date
gmarco
c776e0d0df Merge branch 'main' of https://forge.ablia.net/gmarco/cryptoform 2025-03-09 08:52:56 +01:00
gmarco
55f4b4f9d5 Initial commit 2025-03-09 08:50:22 +01:00
3 changed files with 159 additions and 0 deletions

12
includes/inc-bottom.php Normal file
View file

@ -0,0 +1,12 @@
<script>
function Copy(param) {
var copyText = document.getElementById(param);
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
navigator.clipboard.writeText(copyText.value);
// alert("Copied: " + copyText.value);
}
</script>
</body></html>

63
includes/inc-top.php Normal file
View file

@ -0,0 +1,63 @@
<!doctype html>
<html>
<head>
<?php $title="secure.estracom.it"; ?>
<title><?php echo $title ; ?></title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<style>
html, body {
display: flex;
justify-content: center;
font-family: Roboto, Arial, sans-serif;
font-size: 13px;
color: #dcdcdc;
background-color: #212121;
}
form {
border: 5px solid #f1f1f1;
}
input[type=text], input[type=password] {
width: 100%;
padding: 16px 8px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
color: white;
padding: 14px 0;
margin: 10px 0;
border: none;
cursor: grabbing;
}
h1 {
text-align:center;
fone-size:18;
}
button:hover {
opacity: 0.8;
}
.formcontainer {
text-align: left;
margin: 24px 50px 12px;
}
.container {
padding: 16px 0;
text-align:left;
}
span.psw {
float: right;
padding-top: 0;
padding-right: 15px;
}
/* Change styles for span on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
</style>
</head>
<body>

84
index.php Normal file
View file

@ -0,0 +1,84 @@
<?php
// https://www.w3docs.com/tools/editor/6252
include "includes/inc-top.php";
if (!isset($_REQUEST["step"])){
?>
<form action=<?php echo $_SERVER['PHP_SELF']; ?> method='post'>
<h1><? echo $title; ?></h1>
<div class=formcontainer>
<hr/>
<div class=container>
<label for=string><strong>String</strong></label>
<input type=text value="<?php echo $_REQUEST['webstring'] ?? null; ?>" placeholder='Enter String' name=string required>
<label for=psw><strong>Password</strong></label>
<input type=password value="<?php echo $_REQUEST['webpwd'] ?? null; ?>" placeholder='Enter Password' name=psw required>
</div>
<div align=center>
<button type=reset style='width: 32%; background-color: #008CBA'>Reset</button>
<button type=submit name=action value=decode style='width: 32%; background-color: #4CAF50'>Decode</button>
<button type=submit name=action value=encode style='width: 32%; background-color: #FF0000'>Encode</button>
</div>
<input type=hidden name=step value=1>
</form>
<?php
} else {
if ($_POST['action'] == 'decode') {
$param="-d";
} else {
$param="-e";
}
$output = shell_exec("echo " .$_REQUEST['string']."| openssl enc ".$param." -base64 -aes-128-ctr -nosalt -pbkdf2 -k ".$_REQUEST['psw']);
// root@webphp:/usr/home/web/default/decrypt# echo 12345678901 | openssl enc -e -base64 -aes-128-ctr -nosalt -pbkdf2 -k pippo
// root@webphp:/usr/home/web/default/decrypt# echo HU+9XYiA+jjK1esx | openssl enc -d -base64 -aes-128-ctr -nosalt -pbkdf2 -k pippo
?>
<form action=<?php echo $_SERVER['PHP_SELF']; ?> method='post'>
<h1><? echo $title; ?></h1>
<div class=formcontainer>
<hr/>
<div class=container>
<label for=string><strong>String</strong></label>
<input type=text id="string" value="<?php echo $output; ?>" readonly>
<label for=psw><strong>Password</strong></label>
<input type=text id="pwd" value=<?php echo $_REQUEST['psw']; ?> readonly>
</div>
<div align=center>
<button type=submit style='width: 32%; background-color: #008CBA'>Restart</button>
<button type=button onclick="Copy('string')" style='width: 32%; background-color: #4CAF50'>Copy String</button>
<button type=button onclick="Copy('pwd')" style='width: 32%; background-color: #FF0000'>Copy Password</button>
</div>
</form>
<?php
if ($param == "-e") {
echo "&nbsp;<p>".
"<strong>Summary:</strong>".
"<p>".
"<table border=0 align=left width=100%>".
"<tr><td width=25%>Original string</td><td>".$_REQUEST['string']."</td></tr>".
"<tr><td width=25%>Encoded string</td><td>".$output."</td></tr>".
"<tr><td width=25%>Password</td><td>".$_REQUEST['psw']."</td></tr>".
"</table>".
"<p>&nbsp;<p>".
"<strong>Generated Links:</strong>".
"<p>".
"<a href=".$_SERVER['HTTP_REFERER']."?webstring=$output>".$_SERVER['HTTP_REFERER']."?webstring=$output</a>".
"<br>".
"<a href=".$_SERVER['HTTP_REFERER']."?webpwd=$_REQUEST[psw]>".$_SERVER['HTTP_REFERER']."?webpwd=$_REQUEST[psw]</a>";
}
}
include "includes/inc-bottom.php";