Page 1 of 8

[Queue-Script] PasswordDetector - stop dl of protected .rar

Posted: 17 Aug 2014, 02:16
by JVM
PasswordDetector is a queue script that checks for passwords inside of every .rar file of a NZB downloaded. This means that it can detect password protected NZB's very early before downloading is complete, allowing the NZB to be automatically deleted or paused. Detecting early saves data, time, resources, etc.

Settings
Once NZB found password protected, PasswordDetector can either:
  • mark bad the NZB, where the download is aborted, marked as bad and processed by duplicate handling (if active). All pp-scripts are executed as well. If option DeleteCleanupDisk is active in NZBGet the downloaded files are deleted, which deletes the NZB and informs post processing scripts, e.g. call another NZB; or
  • pause the NZB, awaiting user action, e.g. so a password can be defined later. If a NZB found password protected and allowed to resume, password detection is skipped to allow the download to complete.
It's also possible to enable/disable detection for passwords as required:
  • if NZBGet finds a password in NZB metatag, detection is skipped automatically;
  • if the user manually adds a password for a given NZB via the web ui (Postprocess), detection is skipped;
  • if the user manually enables/disables PasswordDetector for a given NZB via the web ui (Postprocess);
  • earlier scripts can define password (e.g. [Scan-Script] pfftn) and PasswordDetector cancels detection;
  • detect only for certain categories, via the CategoryX.PostScript option (CATEGORIES settings page); or
  • detect for all downloads by default, via the QueueScript option (EXTENSION SCRIPTS settings page)
Requirements
  • NZBGet v14 r1094+
  • Python 2.x; may not work with Python 3.x.
Other notes
  • May have a noticeable effect on performance during downloads
  • It is based off another queue script, FakeDetector. They are both independent; you need both to detect for fakes and passwords.
  • Tested on a 256MB Model B Raspberry Pi running Raspbain
Authors
This script is written by a joined force of forum members including:
  • Clinton Hall;
  • JVM;
  • hugbug;
  • get39678;
  • prinz2311;
To install
  • Copy to NZBGet's scripts folder;
  • choose the script in option QueueScript and/or PostScript;
  • configure and save script options;
Current
Old

[/size]

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 07:30
by TRaSH
hmm,
this would be nice to have as default in nzbget,
i know sab had a option when a rar was password protected and you didn't provide a password it would pause the download.

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 09:43
by hugbug
Great work!

An idea: add action "Pause and EMail". But don't add all email config options to the script, instead use the options saved for Email.py:

Code: Select all

host = os.environ['NZBPO_EMAIL_PY_SERVER']

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 10:59
by JVM
TRaSH wrote:hmm,
this would be nice to have as default in nzbget,
i know sab had a option when a rar was password protected and you didn't provide a password it would pause the download.
I was thinking about that, at the moment it will keep pausing a download every time it sees a passworded rar, not sure how to disable checking once a password is specified or if a user chooses to continue... apart from removing the script from the default queue script setting.

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 11:04
by JVM
hugbug wrote:Great work!

An idea: add action "Pause and EMail". But don't add all email config options to the script, instead use the options saved for Email.py:

Code: Select all

host = os.environ['NZBPO_EMAIL_PY_SERVER']
That was on the back of my mind, but I was thinking to boarding it out to every notification script here by having a setting like on the extension scripts page. Like a PostOueue option where you could list the default scripts after PasswordDetector was done?

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 13:09
by hugbug
JVM wrote:at the moment it will keep pausing a download every time it sees a passworded rar, not sure how to disable checking once a password is specified or if a user chooses to continue... apart from removing the script from the default queue script setting.
Once a protected rar is detect - set a post-processing parameter for the nzb:

Code: Select all

print('[NZB] NZBPR_PASSWORDDETECTOR_HASPASSWORD=yes')
Then at the beginning of the script check if the parameter is set:

Code: Select all

if os.environ.get('NZBPR_PASSWORDDETECTOR_HASPASSWORD')=='yes':
      sys.exit(POSTPROCESS_SUCCESS)

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 13:58
by JVM
Cheers hugbug, once password found, password detection stops as desired. Updated file in OP.

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 18:36
by get39678
I am currently giving these a go but I am wondering to try to reduce the overhead of starting the scripts and looking in the archive files multiple times is is feasible to combine the PasswordDetector and FakeDetector and have options to enable and disable each as required on a single options screen?

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 17 Aug 2014, 21:04
by picardtux
thank you for this extension,
I'll be happy to test it ;-)

Re: [Queue-Script] PasswordDetector - stop dl of protected .

Posted: 18 Aug 2014, 13:42
by JVM
get39678 wrote:I am currently giving these a go but I am wondering to try to reduce the overhead of starting the scripts and looking in the archive files multiple times is is feasible to combine the PasswordDetector and FakeDetector and have options to enable and disable each as required on a single options screen?
Yes it's feasible but I might leave them separate for now and see if any issues arise. Something more efficient again would be implementing the scripts in bash or similar. Hugbug is looking into an interval between calls of queue scripts.

I'm curious what sort of processing times do you and others get? Easy way to find out is searching "detector" in the Messages tab. Any impact of download speed?