Preventing simultaneous downloads of same file from same user - apache

I'm looking into making an apache module that would prevent any user from downloading the exact same large file multiple times.
This is the logic I have in mind:
- Get IP address and if it's not in database, store it and allow download
If IP address exists, then:
- If current requested file matches previously requested file, show error
- Upon completion of download, remove IP address from database.
I plan to capture the end of the download via an output filter (or should I use the log_transaction hook?).
The problem with this idea is that hackers could change their IP address at any time and therefore two different IP addresses could download one copy of the exact same file simultaneously.
How do I rectify this whole situation so that no multiple downloads of the exact same file run simultaneously for multiple IP addresses that belong to hackers?
If anyone has a solution, can you provide some very basic pseudo code so I can update my apache module accordingly?

Related

Query or search an IP address in Maxmind GeoIP2 DB files

We have created certain unit tests with hardcoded IP addresses to validate logic of which after updating the GepIP2 DB said tests no longer pass. The reason is because the metadata in the DB files of the hardcoded IP addresses can be updated regularly.
We were thinking to replace the hardcoded IP addresses to other dynamically retrieved from the GeoIP2 DB files by somehow reading the files. However, we haven't found a way to do so. The API offered by the libraries are about lookups, not querying.
Is there any way to query or search IP addresses with certain metadata in the MaxMind GepIP2 DB files? Perhaps is there a way to inspect these DB files somehow?

Getting the same file name from two BizTalk send ports

In BizTalk 2016, we are planning something where there is a set of send ports. One going to our backup. The other is going to archive. The backup send port is already created. Its file name has to be “ExampleText%MessageID%.xml” without quotes. Unfortunately, this won’t give us the exact name in both file locations, because %MessageID% is a randomized generated information.
We are going to make a code to compare if the file name of each file in the backup is the same as in the archive folder to check to see if everything is there. Is there any way that we can go this route of using two send ports and getting the exact name in both locations?
Along with that, we have another set where the backup send port has to have the file name “%SourceFileName%_%datetime%” without quotes. My fear is that one send port will be delayed where the %datetime% is different. My boss wants to go this direction instead of creating an automated script to move files over. Any advice would be very helpful.
You need to set the desired filename before it hits the Send Ports via the BTS.ReceivedFileName property and then you can use the %SourceFileName% macro on both ports.
You can either set this property in an Orchestration, or you need to set it in a pipeline component in the Receive Location. I would tend to use the BRE Pipeline Framework for this, but you can write your own custom component.

Fetching machine details remotely from large group of computers

I'm trying to remotely collect few details (machine name, user name,MAC address, Serial number, OS version etc) from the large group of computers.
I have come up with different ways.
Method 1:
Deploy a script on all the machines, script will fetch the details from machine and write in to a shared excel file present in the network file share.
Challenges:
The target environment doesn't have network share folders enabled.
Challenge in concurrent updating the excel from multiple machines at the same time.
Method 2:
Deploy a script on all the machines, which will run fetch the required details and send an email to particular email address with all the required details in subject line.
After all the email are received, admin can copy those emails and copy to excel, so it copies the subject line of the emails in excel rows. Later admin can delimit and seperate the column for desired report.
Challenges:
This method tried and working fine. But challenge is no.of charecters in the email subject is limitted to 256 hence can't fetch more details.
I would like to request whether anyone has any inputs or other possible methods to achieve the target.
Thank you

Apache Flume - send only new file contents

I am a very new user to Flume, please treat me as an absolute noob. I am having a minor issue configuring Flume for a particular use case and was hoping you could assist. Note that I am not using HDFS, which is why this question is different from others you may have seen on forums.
I have two Virtual Machines (VMs) connected to each other through an internal network on Oracle Virtual Box. My goal is to have one VM watch a particular directory that will only ever have one file in it. When the file is changed, I wish for Flume to only send only the new lines/data. I want the other VM to receive this data and update/concatenate the data to a single file in a particular directory on it.
So far, I have this process very close to working. Whenever changes are made in VM1, they are updated on VM2. However, the entire file on VM1 is sent to VM2 every time, not the new lines. For example, if I wrote “Test1” and then a while later underneath wrote “Test2” to the file on VM1, on VM2 the output would be:
Test1
Test1
Test2
What I want to see is:
Test1
Test2
I am not sure how to implement this, and am sending this email after thoroughly examining the Flume user guide documentation and most relevant articles on stackoverflow/stackexchange. For your reference, below are the current configurations(they are working in the manner I mentioned above).
VM1 configuration
VM2 configuration
I realize another solution would be to keep the configuration on VM1 and overwrite the file on VM2 everytime new contents are detected. However, I am also unsure how to implement this.
Any assistance you could provide is greatly appreciated!
Use TailDir source provided in Flume.It periodically writes last position read in position file and its more reliable than exec source as even in case of agent crashes or stops for some reason it will start reading from last position saved in the position file.
agent1.sources.src1.type = TAILDIR
agent1.sources.src1.channels = ch1
agent1.sources.src1.filegroups =f1
agent1.sources.src1.filegroups.f1= //path to log file
agent1.sources.src1.maxBackoffSleep = 10000
Set maxBackoffSleep value as per your need it means how much max time agent should wait before polling for changes in log file , when it didnt find any changes in last attempt made.

VB.Net - Get name of computer that is running a local file

Is it possible to retrieve the name (or IP address, whichever) of a computer that is accessing a file on my shared folders via workgroup? If so, what would I need to retrieve it? Filename? File directory?
I am using vb.net 2005.
The short answer is NO.
But, if you are on the computer that has the share, you can go into Administrative Tools>>Computer Management>>System Tools>>Shared Folders>>Open Files and and you might get some information about what files and who. But this is not reliable because only certain files apply locking and they will only show up here if locked from another computer. Too often windows will tell you the file is locked but you will not see the information in here.