AntiVirus Integration with VirusTotal and Rules

Some weeks ago VirusTotal.com relaunched their new website and redesigned service API. Finally also the VirusTotal API integration for Drupal got updated to make use of all the cool stuff API v2 introduced.

As some people had problems to make use of it's Rules integration I now want to give you a short example on how to use the VirusTotal API for common needs without writing a single line of code.

Starting point: Imagine we have a field called "Document" on our article content-type and we want to have it checked by VirusTotal. After saving the content, the attachment should automatically be sent to VT. It will be queued for scanning and as we have the lowest priority (manually submitted files have highest priority) we should at least wait 10 minutes before trying to pull the results. After the results could be fetched successfully and there was at least one finding, we want to send an email containing a link to the scan-report and the affected node.

Let's go

Awesomize your batch applications!

I really love creating modules that make use of Drupal's Batch API, but too often I got tired of some limitations. Particularly the dependence of batch jobs to a users session (by drupal_get_token()) took me some sleepless nights. But now; finally there is a module for that!

Better Batch builds a big wrapper around the original Batch API functionalities without hacking a single line of code (but I have to admit that it makes use of some crazy PHP voodoo sometimes) in order to improve it with all features I ever missed while creating new batch applications. It is a very early release (just 10 minutes before I began writing this post) and still needs some more testing and debugging.
So, check out the features and feel free to give it a try (also if you just want the cute unicorn-style in your progress bar).

  1. Okay, modifying the default style of the progress bar isn't one of the most wanted features, but maybe there are people like me who don't want to mess around with css ;-). Better Batch provides you 7 colorized bar animations (I just changed the color of the original, blue one) and gives you the option to change the inner style of the progress bar to a custom color (makes you able to create some retro black/white dos-bars) or to any custom image you got an URL of. At the moment the outer style (the part of the progress bar that has not been processed yet) can only be set to a custom color but if requested I'll also add some more options here.
  2. Session independence: As Batch API uses sessions to identify a batch job's owner once you re-login the batch is lost. This is now solved by using Better Batch's session independence feature. It uses the users id as owner identifier and refreshes your batch to your new session token.
  3. Unique non-concurrent batch jobs: This feature hashes a batch's input (it's operations and parameters) in order to identify equal not-finished or currently running batch jobs, stops building the current one and redirects you to the equal one. With this enabled you can simply leave a batch progress page and get back to it without remembering what the batch id was, simply by re-submitting the form from which you started it.
  4. The use of a batch's source URL as batch path helps getting rid of these ugly batch?op=start&id=6 things. The current implementation is highly experimental, depends on the url alias system, needs the unique batch jobs feature and the global batch jobs feature enabled. I really don't like this and probably rewrite it, but this is how it works for now:
    If you started a batch by submitting a form at examples/batch_example the batch will use examples/batch_example/batch as path for its progress page. Otherwise, if the batch was started by visiting a page like admin/reports/updates/check this path will temporarily used for the batch's progress page until it's finished.
  5. Global batch jobs: This feature was the biggest desire I had while using Drupal's Batch API: Allowing other users to watch the progress of a running batch, but still securely by knowing who's allowed to see the batch progress page. To reach this, Better Batch makes use of some strange cache and buffer functions to 'completely' unlink a batch from a users session. Batch progress pages can now be delivered to any user, but only the batch owner pushes the progress and access validation depends on the users right to access the batch's source page. Observers of a running batch will only get the most recent state of the job, so if the owner leaves the batch page without finishing it, the observers have to wait until he comes back. You can get rid of this limitation by using gielfeldt's genius Background Batch module (a submodule of Background Process) that keeps your batch's running fully independent from any user. It allows you to leave the batch page, come back later and it's probably already done!

By using Better Batch and Background Batch modules you are able to build batch applications that go far beyond content management to create the cool stuff a creative Drupaler dreams of. Just imagine the possibilities.. 

Work on improving the PA-process began

I'm really excited to see that the development on the project application process keeps rolling as jthorson started the Drupal.org ProjectApps Customizations sandbox yesterday. The project is about easing the workflow for the applicants as well as for the reviewers by customizing the current process to the recent developments.

Some intended features for the initial release are: forcing clear permissions on changing issue status and priority for applicants, automated rising of priorities, linking of project page with their issues and others. The feature I'm personally more looking forward to is the integration of automated reviews to drupal's testing infrastructure and providing a dedicated 'Application Status' dashboard showing all related information in one place. (You can find more detail information on the sandbox project page)

As this has just begun and there is still a lot of space for more or even better ideas, go ahead and create an issue! For sure also co-maintainers are needed to implement these features, if you are interested on this please contact jthorson or open up an issue, explaining how you want to help.

Automated project review goes online [update]

Some weeks ago klausi boosted the application review process enormous by his PAReview.sh script that detects frequent problems of the most project applications coder could not detect. It is still under development but already used for most applications and eases the reviewers job a lot. Also many applicants started reviewing their sandbox module before creating their pa-issue.

Unfortunately it's not very easy to set the testing environment up, especially on windows. So as there is still a lot of space in the main menu I decided to create a kind online service, where people can review their modules without setting it up locally.

This is what came out: A virtual server running cent-os with all PAReview stuff working, a little service script to execute what has to be done and a client module now installed at http://ventral.org/pareview.

It was a all-in-one-day project, written quick and dirty - but It's working and as there is interest I will continue further work on it.

Please go ahead and test it!

 

Update

After some days of down-time due to the massive usage of the service (that could not be handled by my small virtual machine) - it's back again!

  • The drupalshop maloon sponsored a new server, a very powerful one, big thanks for this!
  • I reworked the service sources and just started a project at http://drupal.org/sandbox/patrickd/1360798
  • The reworked scripts are very stable now, there should be no problem if multiple users submit their project
  • All results are now saved in nodes
  • Changes are saved by node revisions so the process can be tracked

Cheat Sheet Generator

As there is still a lot of space in the main menu and the site-logo (taken from http://qa.drupal.org/) signifies some kind of service I'm planning to integrate some online demonstrations of projects I'm currently working on.

The first one is the cheat sheet generator module (http://drupal.org/project/cheatsheet) that allows you to create handy cheat sheets for Drupal using doxygen XML output. Currently it can only generate an advanced list of all core API hooks (the hooklist at api.drupal.org isn't quite useful) but that functionality is enough to create cool stuff like the Drupal 7 Cheat Shirt.

The online demo of the Cheat Sheet Generator module is now available at http://ventral.org/cheatsheet.

If you whish another kind of Cheat Sheet, just go ahead and create an issue to let me know your ideas!

Pages

Subscribe to Front page feed