Foren

Comparion between two Folders and Files Recursively

thumbnail
Manish Yadav, geändert vor 6 Jahren.

Comparion between two Folders and Files Recursively

Expert Beiträge: 493 Beitrittsdatum: 26.05.12 Neueste Beiträge
Hello All,
I’m developing portlet which should be able to compare two folders and files recursively. Portlet should handle below scenario [All Comparison should be recursively]
a) Comparison between local zip files.
b) Comparison between local zip file and Remote FTP folder Location
c) Comparison between two Different Remote FTP Folders & Files

Can anyone please let me know what approach I have to follow? I have found two ways to develop portlet.
a) Create portlet which will upload zip files to server and then unzip via Java API and then comparisons by java Function . For
FTP use apache commons-net.jar & commons-vfs.jar
b) Create portlet which will upload zip files to server and then Execute LINUX SHELL Script to perform Unzip and Comparison of folder via diff command and read output of shell script via Java API [Might be Shell scripts are faster than Java APIs ]

Please let me know which approach will be good in term of performace and whether I’m going in right direction
And If Possible please suggest some better approach to perform above scenarios
I have Linux as OS and Liferay 6.2 Server
thumbnail
David H Nebinger, geändert vor 6 Jahren.

RE: Comparion between two Folders and Files Recursively

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
I don't really like any of these options...

"Here, let me upload my zip file of all of my virus software with trojans and back doors... Trust me, it's clean..."









Come meet me at 2017 LSNA!
thumbnail
Manish Yadav, geändert vor 6 Jahren.

RE: Comparion between two Folders and Files Recursively

Expert Beiträge: 493 Beitrittsdatum: 26.05.12 Neueste Beiträge
Thanks David for very quick response.
Could you please suggest any best approach to perform task.
There is no any programming language or technology restriction.
Whether scanning of uploading file by antivirus will help to prevent from trojans & virus?
thumbnail
David H Nebinger, geändert vor 6 Jahren.

RE: Comparion between two Folders and Files Recursively

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
If I had to do this, I would be extremely cautious...

I would be doing an antivirus scan on the upload and, if at all possible, not persisting as a file in the filesystem anywhere; you don't want to accidentally leave an infected file lying around anywhere.

I would also wrap layers of security around its availability. Only trusted users can do the upload, ones that have undergone some sort of verification. And definitely no guest access whatsoever.

I'd have clearly defined limits on upload sizes. If the file(s) need to be processed in-memory to avoid file persistence and OS corruption, this will further constrain your upload capacity.

Speaking of which, you also want to have runtime limits to ensure that the number of folks uploading/comparing at one time can be throttled and managed; you don't want 1,000 people uploading 10 meg files as you will quickly clip through all available resources.

Even if you got this all squared away, I'd still like to see some way to "sandbox" the whole thing, some sort of disposable VM or container that would deal with the upload in complete isolation and one that could be discarded after the comparison was complete.

I'm sure this sounds super-paranoid, but I feel it is just a reflection of the world as it truly is. Fortunately hackers with the skillz to turn this into an attack vector are going to be few and far between, but they are out there.

Just look at Equifax and the general sh*tstorm raining down on them right now, and they never offered anyone the ability to upload a file at all.

It's a reality of the internet that we live on, and regardless of how useful this feature might seem, you will need to wrap this in so many layers of security just to protect your assets.










Come meet me at 2017 LSNA!
Lee Jordan, geändert vor 4 Jahren.

RE: Comparion between two Folders and Files Recursively

Expert Beiträge: 449 Beitrittsdatum: 26.05.15 Neueste Beiträge
I'm pretty concerned about the resurfacing of the EF story for Liferay, more so now than I was two years ago. The stylesheets won't load for me on the updated site. There's no ramifications, they continue on; stock is up and it was just luck that our information ended up in a nation state's hands and not an identify theft ring. Though add a trade war and a pandemic SARS outbreak and they could sell their databases. Uploading a zip file was the least of EF's concerns.

Furthermore, Equifax employed the username “admin” and the password “admin” to protect a portal used to manage credit disputes, a password that “is a surefire way to get hacked.”

https://www.forbes.com/sites/kateoflahertyuk/2019/10/20/equifax-lawsuit-reveals-terrible-security-practices-at-time-of-2017-breach/#1ee28c6a3d38



And here we are  there's no password strength indicator out of the box.