Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need Stript allows upto 5 downloads per zip file, then no more downloads for 24 hours - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Need Stript allows upto 5 downloads per zip file, then no more downloads for 24 hours

2

Comments

  • sibapersibaper Member
    edited October 2017

    @painfreepc said:

    restricting ip's will not help, they come back later with a new IP

    With that statement, I thing you dont know what you're talking about.

    Listen to what people said here.

    Remember you asking for help here, no one will write the completed script for you, you act like a boss here.

    Thanked by 1Websec
  • TDDTDD Member

    If multiple connection is the issue, just lock them to X at a time.

    iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above X -j DROP

    "Freedom of information" sites tend to make good money on ads and subversive means of getting visitors to generate traffic for them. If you can't afford to hit up fiverr for this, you should consider a new profession.

  • vishalpatelzvishalpatelz Member
    edited October 2017

    @painfreepc said:

    @jetchirag said:

    @painfreepc said:

    @vishalpatelz said:
    Simple is that I can give you the logic but if you want pure code then learn first.

    Create random string assign to user add one more var like limitation number,

    If everything goes through simple allow file download.

    I am a cook, when friends ask how to make a certain dish.

    I should tell them to go to culinary school..

    In your case, if a friend asks how to cook certain disk, do you prepare and send it to them. No, right?

    He gave you recipes, use it.

    I have prepared food for friends,

    vishalpatelz did not give me a recipe, he give me a cookbook.

    I am not gonna spoonfeed but have a look at.

  • @TDD said:
    If multiple connection is the issue, just lock them to X at a time.

    iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above X -j DROP

    "Freedom of information" sites tend to make good money on ads and subversive means of getting visitors to generate traffic for them. If you can't afford to hit up fiverr for this, you should consider a new profession.

    It's not a profession, it's just a hobby,
    may come as a shock but some people do things for the enjoyment and to help others.

    will look at iptables as a possible solution

  • pbgbenpbgben Member, Host Rep
    edited October 2017

    @painfreepc If all you want is to top the crawlers / attempts at maxing your connections via script, there are a few ways, two that I think of,

    Have a DB to log downloads by IP (This will end with your DB being fucked like a corner bitch on a Friday night)

    Use random links for downloads (Read tokens) This can be done simply with a date stamp, or if they hate you enough you'll have to salt it.

    You want a recipe, or pay me $50USD worth of JarCoin.

    • PHP file in a directory, used to handle downloads EG /downloads/
    • Secret Directory to keep files (This should be outside web root but a random name is ok)
    • htaccess to redirect the $filename.zip?key=$token to your download.php (This way you can control what that file does)
    • code on the download page, a url thats generated to be url.zip?key=timestamp
    • download.php takes the key and filename as an input, verifies the key in an if statement, and then does some header magic to present itself as a download.

    I am a self-taught dev, with no shits given to security, so you can take your loans and stick them in my bum.

    Thanked by 1vpsGOD
  • painfreepcpainfreepc Member
    edited October 2017

    @pbgben said:
    @painfreepc If all you want is to top the crawlers / attempts at maxing your connections via script, there are a few ways, two that I think of,

    Have a DB to log downloads by IP (This will end with your DB being fucked like a corner bitch on a Friday night)

    Use random links for downloads (Read tokens) This can be done simply with a date stamp, or if they hate you enough you'll have to salt it.

    You want a recipe, or pay me $50USD worth of JarCoin.

    • PHP file in a directory, used to handle downloads EG /downloads/
    • Secret Directory to keep files (This should be outside web root but a random name is ok)
    • htaccess to redirect the $filename.zip?key=$token to your download.php (This way you can control what that file does)
    • code on the download page, a url thats generated to be url.zip?key=timestamp
    • download.php takes the key and filename as an input, verifies the key in an if statement, and then does some header magic to present itself as a download.

    I am a self-taught dev, with no shits given to security, so you can take your loans and stick them in my bum.

    WOW, someone offering real help, funny shit, i read all the bullshit from others above,

    i never said not even once, that i would not pay.

    the script i link to in my opening post works,
    only problem is, i wish to allow client to to download upto 5 zips
    and then disallow downloads for 24 hours..

  • Don't get it, i am lost,

    LET has a Discussions going about how to watch Netflixs where it's not allowed per account, but that's ok - i ask for help and i am called out for piracy,

    WSS is a smart ass to almost everyone, but i am called a douche..

  • mfsmfs Banned, Member

    TDD said: iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above X -j DROP

    heading directly to iptables to handle possibly legit website traffic with a harsh DROP via (not recent, not hashlimit, but) connlimit is considered impolite; nginx and apache can tweak rate, limits and UA too

    then again OP's site seems to be just a directory listing, before stripting in PHP he better check those iptables docs in depth, then install firehol

  • RizRiz Member

    @painfreepc said:
    Don't get it, i am lost,

    LET has a Discussions going about how to watch Netflixs where it's not allowed per account, but that's ok - i ask for help and i am called out for piracy,

    WSS is a smart ass to almost everyone, but i am called a douche..

    You expect free work and lend no hand in contributing. Now you're throwing a pity party.

    Most of the logic has already been laid our for you. Run with the idea and add it to your PHP script. If you don't want to limit by IP, then find a unique way of labeling each 'user'.

    Thanked by 1netomx
  • NeoonNeoon Community Contributor, Veteran
    edited October 2017

    Well you can go full retard, Nginx -> LUA -> PHP and return a 500 if you reached 10 downloads.

    It does not matter then what file you access, you can block everything on that vhost.

    I used that for one experiment, its not that efficient but works:

    https://pastebin.com/AkAQRYQi

  • painfreepcpainfreepc Member
    edited October 2017

    @Riz said:
    You expect free work and lend no hand in contributing. Now you're throwing a pity party.

    Most of the logic has already been laid our for you. Run with the idea and add it to your PHP script. If you don't want to limit by IP, then find a unique way of labeling each 'user'.

    lets try again, may be you sleep in class, I NEVER SAID I DID NOT WANT TO PAY,

    AND I NEVER SAID DON"T LIMIT BY IP,

    when client start app they download 100's of images to fill the app's GUI,
    that client's IP (app) Downloading a few 100 small images at once is not the problem,

    the problem is some A-Hole downloading 1000's of the same image and/or zip files all day long..

  • @painfreepc said:

    the script i link to in my opening post works,
    only problem is, i wish to allow client to to download upto 5 zips
    and then disallow downloads for 24 hours..

    then this probably really is the best way to do what you aim for. redirect requests for the zip-files to a php script which handles the downloads and counts the hits per IP. it most likely won't work flawlessly and it easy to circumvent by just changing IP address, but it maybe a start at all.

    I think you should more clearly point out, that you are looking for someone who adapts that given approach and only takes care of the small changes needed to achieve your desired behaviour. also it may help to give a budget you are willing to pay ;-)

    probably work of far less than an hour given you can directly provide the required access or credentials. even easier if you have that initially suggested script and db already in place...

  • @painfreepc said:
    I NEVER SAID I DID NOT WANT TO PAY,

    Well, you never offered to pay anything either. It's quite common when someone asks for a job to be done to offer $X.
    You didn't offer anything.

    If you want to prove me wrong, make an offer to those people who tried to help you.

    And stop bitching about everyone being an asshole. You deserved it.

    Thanked by 2sibaper maverickp
  • Let's to the point,
    How much you willing to pay?

  • $7

  • @painfreepc said:
    the problem is some A-Hole downloading 1000's of the same image and/or zip files all day long..

    Is he even doing that? Your log just showed a bunch of 206 responses. Those are different from 200.

    Thanked by 1Falzo
  • Looks like you need a sysadmin.

    Hint: He's not downloading the same file thousands of times.... he's probably using a download manager for multiple parallel requests... you can limit that with nginx rate limiting:
    https://www.nginx.com/blog/rate-limiting-nginx/ (or apache equivalent. but screw apache)

  • Why wouldn't you just use fail2ban if majority of people are not abusing the system. For the onesie twosie people that are abusing, let fail2ban do it's thing.

  • FalzoFalzo Member
    edited October 2017

    @mksh said:

    @painfreepc said:
    the problem is some A-Hole downloading 1000's of the same image and/or zip files all day long..

    Is he even doing that? Your log just showed a bunch of 206 responses. Those are different from 200.

    .

    Jonchun said: He's not downloading the same file thousands of times.... he's probably using a download manager for multiple parallel requests...

    that's probably a point where a simple redirect to a php script will bring you into trouble or at least ban the IP very fast and even a single download may fail...

  • FlamesRunnerFlamesRunner Member
    edited October 2017

    @painfreepc

    $30 PP and I'll have it done before the day ends.

    The download manager gig can be solved with a one minute grace period per download.

  • @painfreepc said:

    @hzr said:
    shit i'd do the whole thing for you professionaly with configuration settings and all at my standard hourly rate after work, but you're probably not willing to pay more than lowend rates.

    you may be surprised at what i would pay,

    even though you have been an A-HOLE to me,

    i have Mother f#$kers using download managers to request many of the same 1/2 MB to 2 MB zips files over and over, it's getting close to costing me BW money..
    @FlamesRunner said:
    @painfreepc

    $30 PP and I'll have it done before the day ends.

    The download manager gig can be solved with a one minute grace period per download.

    that's what I am doing with the script I am linking to in my opening post..

  • @painfreepc said:

    @painfreepc said:

    @hzr said:
    shit i'd do the whole thing for you professionaly with configuration settings and all at my standard hourly rate after work, but you're probably not willing to pay more than lowend rates.

    you may be surprised at what i would pay,

    even though you have been an A-HOLE to me,

    i have Mother f#$kers using download managers to request many of the same 1/2 MB to 2 MB zips files over and over, it's getting close to costing me BW money..
    @FlamesRunner said:
    @painfreepc

    $30 PP and I'll have it done before the day ends.

    The download manager gig can be solved with a one minute grace period per download.

    that's what I am doing with the script I am linking to in my opening post..

    I'm aware. $30 to modify it to your needs.

    Thanked by 5Falzo deank WSS Riz bugrakoc
  • WSSWSS Member

    @painfreepc said:
    WSS is a smart ass to almost everyone, but i am called a douche..

    I'm funny and sometimes actually useful. That's the difference between us.

    Thanked by 2Riz bugrakoc
  • painfreepcpainfreepc Member
    edited October 2017

    @WSS said:

    @painfreepc said:
    WSS is a smart ass to almost everyone, but i am called a douche..

    I'm funny and sometimes actually useful. That's the difference between us.

    No Funny..

  • msg7086msg7086 Member
    edited October 2017

    It could be expensive to do such "hobbies".

    Like we fansubbers have to spend hundreds of dollars to keep the hobby running. We non-profit website admins have to spend hundreds of dollars to keep the server running.

    You are expected to pay a lot -- your time, effort, money, pride, everything, or maybe it's better to hand those over to someone who wills to handle them and can handle them easier.

    Which means, I'd expect you to be competent to manage the website.

    Just my 0.02.

  • @msg7086 said:
    It could be expensive to do such "hobbies".

    Like we fansubbers have to spend hundreds of dollars to keep the hobby running. We non-profit website admins have to spend hundreds of dollars to keep the server running.

    You are expected to pay a lot -- your time, effort, money, pride, everything, or maybe it's better to hand those over to someone who wills to handle them and can handle them easier.

    Which means, I'd expect you to be competent to manage the website.

    Just my 0.02.

    it's my server, it's my money, it's my passion and hobby,
    I am not part of a team..

  • @painfreepc

    And because it would have no use to others if I wrote it for free and released it on GitHub, I am asking for a fee to compensate for my time.

  • pbgbenpbgben Member, Host Rep
    edited October 2017

    @painfreepc said:

    @pbgben said:
    @painfreepc If all you want is to top the crawlers / attempts at maxing your connections via script, there are a few ways, two that I think of,

    Have a DB to log downloads by IP (This will end with your DB being fucked like a corner bitch on a Friday night)

    Use random links for downloads (Read tokens) This can be done simply with a date stamp, or if they hate you enough you'll have to salt it.

    You want a recipe, or pay me $50USD worth of JarCoin.

    • PHP file in a directory, used to handle downloads EG /downloads/
    • Secret Directory to keep files (This should be outside web root but a random name is ok)
    • htaccess to redirect the $filename.zip?key=$token to your download.php (This way you can control what that file does)
    • code on the download page, a url thats generated to be url.zip?key=timestamp
    • download.php takes the key and filename as an input, verifies the key in an if statement, and then does some header magic to present itself as a download.

    I am a self-taught dev, with no shits given to security, so you can take your loans and stick them in my bum.

    WOW, someone offering real help, funny shit, i read all the bullshit from others above,

    i never said not even once, that i would not pay.

    the script i link to in my opening post works,
    only problem is, i wish to allow client to to download upto 5 zips
    and then disallow downloads for 24 hours..

    A quick read shows it is doing a time check,

    $last_xs = mysql_result($res, 0, 'last_time')+3600;
    

    That line is for 60min so I guess just times it by 24 (86400)

    I'll have to check it more to get the 5 limit

    Edit:

    You'll have to change a bunch of stuff,

    • Check if downloads < 5
    • Add 1 to the downloads DB and download file

    • If downloads >= 5, check if last_download was more then 86400 seconds ago

    • Set downloads to 1 and download file
  • TDDTDD Member

    @pbgben said:
    You'll have to change a bunch of stuff,

    • Check if downloads < 5
    • Add 1 to the downloads DB and download file

    • If downloads >= 5, check if last_download was more then 86400 seconds ago

    • Set downloads to 1 and download file

    Not to mention that it uses readfile(). There are many things that could be improved, but other than the actual code to handle it, it's fully functional.

    Personally, I'd use a rewrite for, say, /download/foo/blah masked with a JS post form to keep anything trivial from going through, and a direct get request being ignored/blocked by the limit directive of the server. Of course, it'd still do all of the above, but it'd block all generic forms of spidering/fusking.

  • @FlamesRunner said:
    @painfreepc

    And because it would have no use to others if I wrote it for free and released it on GitHub, I am asking for a fee to compensate for my time.

    he want it for free :) so what he said earlier "I want to paid" just a bullshit

    he avoid all people asking to paid

Sign In or Register to comment.