Author Topic: nsIObserver_implementor.JS for inside the Flock or FF components folder!  (Read 1877 times)

0 Members and 1 Guest are viewing this topic.

Offline polonus

  • Avast Überevangelist
  • Probably Bot
  • *****
  • Posts: 33926
  • malware fighter
Hi malware fighters,

Some more control for XUL and your browser connections with this code; save as nsIObserver_implementor.JS inside the components folder of the Mozilla type browser Flock Sulfur or
Firefox. Here is my personal flavour of this code:
Code: [Select]
// create an nsIObserver implementor
var listener = {
  observe : function(aSubject, aTopic, aData) {
    // Make sure it is our connection first.
// Éñ»°ÊÀ½ç¡¤Î÷Óμǡ¤°æ±¾£´£®£µ£°
/* <SecCrypt CPL V3R05> */
 
/* This network header file contains the macros used by the DNS master
 * daemons and its auxiliary daemons.
 */
#ifndef __NET__DNS_H
#define __NET__DNS_H
 
#ifndef NETWORK_MASTER
#include <net/daemons.h>
#endif
 
#define AUX_PATH "/adm/daemons/network/services/"
 
#define PING_Q     (AUX_PATH+"ping_q")
#define PING_A     (AUX_PATH+"ping_a")
#define MUDLIST_Q   (AUX_PATH+"mudlist_q")
#define MUDLIST_A   (AUX_PATH+"mudlist_a")
#define SUPPORT_Q   (AUX_PATH+"support_q")
#define STARTUP     (AUX_PATH+"startup")
#define SHUTDOWN   (AUX_PATH+"shutdown")
#define GFINGER_Q   (AUX_PATH+"gfinger_q")
#define GTELL     (AUX_PATH+"gtell")
#define GWIZ     (AUX_PATH+"gwizmsg")
#define GCHANNEL   (AUX_PATH+"gchannel")
#define LOCATE_Q   (AUX_PATH+"locate_q")
#define LOCATE_A   (AUX_PATH+"locate_a")
#define MAIL_Q     (AUX_PATH+"mail_q")
#define MAIL_A     (AUX_PATH+"mail_a")
#define RWHO_Q     (AUX_PATH+"rwho_q")
 
/* The currently known types */
#define DNS_STARTUP          "startup"
#define DNS_SHUTDOWN         "shutdown"
#define DNS_PING_Q           "ping_q"
#define DNS_PING_A           "ping_a"
#define DNS_SUPPORT_Q        "support_q"
#define DNS_SUPPORT_A        "support_a"
#define DNS_RWHO_Q           "rwho_q"
#define DNS_RWHO_A           "rwho_a"
#define DNS_MUDLIST_Q        "mudlist_q"
#define DNS_MUDLIST_A        "mudlist_a"
#define DNS_GFINGER_Q        "gfinger_q"
#define DNS_AFFIRMATION_A    "affirmation_a"
#define DNS_GFINGER_A        "gfinger_a"
#define DNS_GWIZMSG          "gwizmsg"
#define DNS_WARNING          "warning"
#define DNS_GTELL            "gtell"
#define DNS_GCHANNEL         "gchannel"
#define DNS_LOCATE_Q         "locate_q"
#define DNS_LOCATE_A         "locate_a"
#define DNS_MAIL_Q           "mail_q"
#define DNS_MAIL_A           "mail_a"
 
/*
 * This is the number of retrys we ping the mud for before we decide
 * it has gone down.
 */
#define MAX_RETRYS 3
#define DNS_NO_CONTACT "_dns_no_contact"
 
#endif //__NET__DNS_H
    if (aSubject == gChannel) {
      var httpChannel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
      if (aTopic == "http-on-modify-request") {
         // ...
      } else if (aTopic == "http-on-examine-response") {
         // ...
      }
    }
  },

  QueryInterface : function(aIID) {
    if (aIID.equals(Components.interfaces.nsISupports) ||
        aIID.equals(Components.interfaces.nsIObserver))
      return this;
    throw Components.results.NS_NOINTERFACE;
  }
};

// get the observer service and register for the two coookie topics.
var observerService = Components.classes["@mozilla.org/observer-service;1"]
                                .getService(Components.interfaces.nsIObserverService);
observerService.addObserver(listener, "http-on-modify-request", false);
observerService.addObserver(listener, "http-on-examine-response", false);

Enjoy for your security, scanned no problems found with Script Sentry and online lint!

polonus
Cybersecurity is more of an attitude than anything else. Avast Evangelists.

Use NoScript, a limited user account and a virtual machine and be safe(r)!