Author Topic: Events [request]  (Read 1020 times)

0 Members and 1 Guest are viewing this topic.

Offline Oxyandy

  • Occasional poster
  • *
  • Posts: 27
    • View Profile
Events [request]
« on: May 28, 2013, 02:03:17 AM »
Hi all,
I have been doing some reading and learnt a lot, but now need a bit of advise..

I want to make use of scripts as much as possible, but have a little way to go on syntax etc
Oh, plus what available options I can make use of..

Task One  {SOLVED 80%} No need to BAN, DTA for FF now gets nothing -see next post
I want to BAN, yes BAN -
I do have a warning and polite request, not to use DownloadThemAll (DTA) for FireFox (FF) on my files page.
So if my request is denied then BAN is appropriate :)
I will try clear those bans every 24 hrs (manually but an auto way would be nice)

Ok so what I have worked out DTA for FF sends the same > User-Agent: as FF, so that wont work.
But we have this in the get request
Code: [Select]
> Want-Digest: SHA512;q=0.9, SHA256;q=0.7, SHA, SHA1;q=0.5, MD5;q=0.3
So,
Code: [Select]
[request]
{.if|{.{.header|Want-Digest.}=SHA512;q=0.9, SHA256;q=0.7, SHA, SHA1;q=0.5, MD5;q=0.3.}|{:{.{.disconnect.}:}.}.}

Seems to work, but the files are small and testing from my own PC through proxy to HFS (to reduce speed) between .disconnect. and DTA's " > Range: bytes=606227- " request, I can still download everything :(

These don't work
Code: [Select]
{.if|{.{.header|Want-Digest.}=SHA512.}|{:{.ban.}:}.}

{.if|{.pos|SHA512|{.header|Want-Digest.}.}|{:{.ban.}:}.}

{.if|{.{.header|Want-Digest.}=SHA512;q=0.9, SHA256;q=0.7, SHA, SHA1;q=0.5, MD5;q=0.3.}|{:{.redirect|DTA_BAN.htm.}:}.}.}

{.if|{.pos|bytes=|{.header|Range.}.}|{:{.redirect|DTA_BAN.htm.}:}.}

This works (no need for BAN - nobody, nothing will load) of course, just as an example.
:including for others that stumble upon this post.
Code: [Select]
[connected]
{.disconnect.}

Questions
1. Can I have multiple rules under [request] ?
Code: [Select]
[request]
rule 1
rule 2
rule 3
No, I guess not, add new rule under [request] like so
Code: [Select]
[request]
rule 1
[+request]
rule 2
[+request]
rule 3

I tried {.ban.} but according to macros-log.html that isn't working

2. Can I use [request] to run a local batch file ?
Yes, I can, and doing this was a great way to actually SEE the events triggered !
Code: [Select]
.exec|G:\Desktop\you_are_here_3.bat.
Task Two (to do) {SOLVED}
Execute a local batch file (which I currently run through window scheduled tasks) upon upload event
(yes, I know read, read, read)
to be continued....

This works, file will be moved after upload.
Beware if file already exists in C:\_INCOMING, it will be replaced.
Code: [Select]
[upload completed]
{.move|%item-resource%|C:\_INCOMING\%item-name%.}

Execute a local batch file, too easy.
Code: [Select]
[+upload completed]
{.exec|G:\Desktop\you_are_here_4.bat.}

Thanks !
PS. now using current #284


« Last Edit: May 28, 2013, 11:10:59 AM by Oxyandy »

Offline Oxyandy

  • Occasional poster
  • *
  • Posts: 27
    • View Profile
Re: Events [request]
« Reply #1 on: May 28, 2013, 11:16:51 AM »
I have edited the post above, to include some detail on what works..

Ok, well it seems I have solved "Task One 80%" & "Task Two - very easy"  8)
Very happy with the results. Opens up what I do already to some fantastic opportunities !

1. Can I redirect to a page ? DTA_STOP.htm ?
Oh yes, I can but if sends DTA into a frenzy almost like a DDoS attack !!
But, it seems to do one good thing, it changes the names of the requested file to DTA_STOP.htm
(Which could be named Download Them All is Banned.htm) They get the Msg that way ;)

If I add dupe [+request] rules, one first for .redirect|DTA_BAN.htm. the second for .disconnect.
No more DDoS attack, but the logs don't show a request for DTA_BAN.htm anymore,
but because DTA never gets a file downloaded, it doesn't give up, a solution, but not a complete one.
I want it download SOMETHING, so it does stop trying. Ideas ?
Well maybe not DOWNLOAD anything, but .disconnect. only leaves DTA in an unknown state.
Can I send a server Response so it stops ? Like 403 - Deny ?

2. So, what can be substituted for {.disconnect.} ?
I know .exec, .redirect - anyway, is there a complete list somewhere ?
There are 'some' on the Wiki

3. Can some of you please share some "real" script examples please ?

4. How can I make use of "Debug - Run Script" ?

5. Can I use [request] to save whole Header to a .txt file ?
? ? ? ? ? ? ? ? ? ? ? ? ? ??

6. I have tried adding comments to hfs.events with //  . The rules are still working, so it is ignoring them :(
Is there anything I can use ?
Yes, answering my own question again.

{.comment|###############.}
{.comment|# My Text Goes Here #.}
{.comment|###############.}
Or
{.comment|
###############
# My Text Goes Here #
###############
.}

Thanks again !
« Last Edit: June 05, 2013, 05:02:41 PM by Oxyandy »

Offline Oxyandy

  • Occasional poster
  • *
  • Posts: 27
    • View Profile
Re: Events [request]
« Reply #2 on: May 29, 2013, 01:21:38 AM »
To get DTA to stop trying to Download the files - I need HFS to send a proper server code.
It seems {.disconnect.} leaves the download requested in DTA in a "Temporarily Not Available" state.
So DTA tries over & over again to get the file/s :(

I downloaded the file DTA_STOP.htm directly with DTA, with "No Download" set for the file in HFS
DTA sees the server response 403 and stops the download. Good

I have tried making the download (for the files I want to block) redirect to the "No Download" flagged file with .redirect|DTA_STOP.htm.
But DTA just doesn't give up = DTA tries over & over again

How can I send a server response ? {.server response|403.} would be awesome
Or {.disconnect|403.}


EDIT: Best solution I have now, redirect the request to " download_them_all_is_banned.htm "
1. It gets the point across, all the files they requested change name to download_them_all_is_banned.htm
2. It stops them using DTA on my site.
3. It makes for a much cleaner server log !!!!!!
4. It simplifies the rules.



But as you see above the downloads, will try again, but I give this fix 90%
(Still love it if someone can answer my questions, please)

FINAL EDIT: I found 'alone' there is a 100% way to send a 403 server response, but I like my msg method better
« Last Edit: June 04, 2013, 07:22:52 AM by Oxyandy »

Offline Oxyandy

  • Occasional poster
  • *
  • Posts: 27
    • View Profile
Re: Events [request]
« Reply #3 on: June 05, 2013, 04:51:20 PM »
[Solved] 100%



I have my message, and I get instant 403 Server response DTA stops

Yay!