Sunday 2 November 2014

Tips to Check a website whether they are running Joomla CMS

Please be advised that the following article is an exact replica of How to Tell if a Website Is Running Joomla - O'Reilly Answers. It's more like a note for myself.

Have you had a sneaking suspicion that a site may be running Joomla, but you're not quite sure of it? In this excerpt from Severdia & Crowder's Using Joomla you'll learn some of the methods of determining if the site in question is indeed running Joomla.

There are several things you can do to see if a website is running Joomla. Unfortunately, some people will try to obscure certain things to make some of the methods mentioned not work, so we’ll share some of those tricks as well.

generator meta tag

The easiest method is to view the website’s source code. If you see the following line, you can be sure that you are looking at a Joomla website:

<meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />

 Note

To prevent your website from showing the contents of the generator meta tag, add the following to your template’s index.php file on the line after the check to see if _JEXEC is defined:

$this->setGenerator();
This will not completely remove the generator meta tag, but it will remove Joomla! 1.5-Open Source Content Management from displaying. We cannot completely remove the tag without a hack since the shell of this meta tag is hardcoded in the framework.

 

/administrator

It’s too easy, right? Just like you type /administrator at the end of your domain name URL in order to access the Administrator Backend, so do all other Joomla users.
If you see a Joomla Administrator login screen, you can confirm it’s a Joomla website.

 

Note

Unfortunately, there is no easy way to change the administrator directory. You can password protect the administrator folder, but if someone types /administrator and gets a password-protected folder, they will be able to conclude that you are likely running a Joomla website.

 

tp=1

We just discussed this feature in detail in the section called “View All of the Module Positions” in Chapter 9, Modules. Go to http://www..com/index.php?tp=1.
If you see module positions overlayed on the screen, the site is a Joomla website.

 

Note

For directions on preventing this check from working on your site, please refer to Chapter 20, Security.

Check for Default Joomla Template

By adding the template= parameter to the end of a Joomla URL, you can change the template for that page. If it works, the person is using a Joomla website.
Navigate to one of the following URLs:
  • http://www..com/index.php?template=rhuk_milkyway
  • http://www..com/index.php?template=beez
  • http://www..com/index.php?template=ja_purity

Note

For directions on preventing this check from working on your site, please refer to Chapter 20, Security.

View a Core XML File

Joomla uses XML files to install components, manage parameter types, and more. If we are able to pull up a core XML file, it can be assumed that the website we are viewing uses Joomla.
Go to http://www..com/administrator/components/com_content/content.xml.

Note

For directions on preventing this check from working on your site, please refer to Chapter 20, Security.

View the robots.txt File

Since all Joomla websites have a robots.txt file, this is an easy one to test.
Navigate to http://www..com/robots.txt.
If you see they do have a robots.txt file, compare it with the text below. If it matches, you are looking at a Joomla website:

1 User-agent: *
2 Disallow: /administrator/
3 Disallow: /cache/
4 Disallow: /components/
5 Disallow: /images/
6 Disallow: /includes/
7 Disallow: /installation/
8 Disallow: /language/
9 Disallow: /libraries/
10 Disallow: /media/
11 Disallow: /modules/
12 Disallow: /plugins/
13 Disallow: /templates/
14 Disallow: /tmp/
15 Disallow: /xmlrpc/

Note

To disable this on your website, delete your robots.txt file. Even though this sounds like an easy thing to do, we don’t recommend it. We think the benefits of having a robots.txt file outweigh the downsides of not having one. More information on robots.txt can be found in the section called “Blocking Search Engines”.

View Their configuration.php-dist File

Since all Joomla websites come with a configuration.php-dist file, this is another easy one to test. Navigate to http://www..com/configuration.php-dist.

Note

To disable this on your website, delete your configuration.php-dist file. After installation, this file is no longer needed, so there’s no harm in deleting it.

Adobe Reader XI: hand tool as default tool

I've started using Adobe Reader XI 5 weeks ago. In the last 10 days, I noticed that I had to choose the hand tool every time I opened a document. I checked Edit > Preferences. But no help. So, a fix has been looked for in the web. Finally, I found it. The following steps should be done in order to select the hand tool as a default one.

1. Run Regedit (the registry editor)

2. Go to key HKEY_USERS\\Software\Adobe\Acrobat Reader\10.0\Selection , where refers to the user you want to change (it will look something like this: S-1-5-21-1030456098-1922302732-3321231120-1000)3. The "Selection" key contains the following values:
"bShowKeyboardSelectionCursor"=dword:00000001
"iColumnSelectHalo"=dword:00000000
"bHandSelects"=dword:00000000
"bImagesFirst"=dword:00000000
"iSnapshotResolution"=dword:00000048
"bUseFixedSnapshotResolution"=dword:00000000
"aDefaultSelect"="Select"

4. Delete all values except for the "aDefaultSelect"

5. Change the data in "aDefaultSelect" from "Select" to "Hand"

6. That's it!


Credits: kpapani from http://acrobatusers.com/forum/general-acrobat-topics/default-text-selection-tool/

There is another fix that claimed to be working in that page too.

Edit > Preferences > Accessibility > Other accessibility options
Clear check boxes of "Always display the keyboard selection cursor".

I could not try it as my check box is already cleared from applying the registry fix. However, it would be a nicer work if we do not have to work with registry.

How to Install multiple instances of cygwin in Windows XP?

When I was doing my research, I wanted to install two instances of cygwin to ease the job. I found some tips in a website and modified them to suite my needs. Though I do not remember the original idea's link, I would like to share the mine.

Step 1. Install the first instance of cygwin in a partition.

Step 2. The installation makes the following registry entries.


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]
"cygdrive prefix"="/cygdrive"
"cygdrive flags"=dword:00000022

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/]
"native"="C:\\hide-cygwin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin]
"native"="C:\\hide-cygwin/bin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib]
"native"="C:\\hide-cygwin/lib"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options]

3. Export the registry tree of HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions. If help is needed with exporting registry, refer to this link.

4. Then copy cygwin installation folder to another location (partition), and make a copy of the exported registry file. Open the copied registry file and change the contents to reflect the partition change.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin]

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2]
"cygdrive prefix"="/cygdrive"
"cygdrive flags"=dword:00000022

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/]
"native"="D:\\cyg2win"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin]
"native"="D:\\cyg2win/bin"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib]
"native"="D:\\cyg2win/lib"
"flags"=dword:0000000a

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options]

5. Now I have 2 exported registry files. And I am going to create 2 shortcuts to bash binary file like this, C:\hide-cygwin\bin\bash.exe --login -i. And another shortcut pointing to D:\cyg2win\bin\bash.exe --login -i.

6. Finally, the cygwin instances can be run successfully. When one of them is about to run, the related registry file needs to be applied. Otherwise, bash would have problems.


How to configure DHCP in CentOS to use 

Check current IP configration of eth0. It is seen that IP address has not been assigned.

ifconfig eth0

Then, the contents of eth0 configuration file is viewed using 'cat' command.

cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="00:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="no"

vi is used to modify the configuration to be like this.

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"

Cons in NS-2 Wireless Trace Format Takes More Space

I tried NS-2 wireless trace format as I needed to test python scripts which does not work on old wireless format. The same tcl file is used to generate new trace. 

When then old format is used, trace file size is 6,113 KB. It becomes 14,801 KB in the case of new trace. It is more than 2 times. It is probably the best to use the old format if the resource is limited. I did not do a proper research as I did was create a tcl file, use both trace files, compare sizes.

When a wireless simulation is run, the trace format of it is set to old wireless format by default. If there is a need to use the new wireless format, it should be specified in the .tcl file. The following code is to use the new trace format in wireless scenarios.

Trick for Installing ns 2.34 in Ubuntu 10.04

Ubuntu 10.04 or Lucid Lynx has newer gcc version which gcc 4.4.3. It is not compatible with otcl. It needs gcc 4.3 to be compiled successfully. So, modifying makefile.in in otcl-1.13 folder solved my problem.
Change the code in Makefile.in
From this
CC = @CC@
to this
CC = gcc-4.3

Hope it helps for otcl problems in installing ns 2.34 on Ubuntu 10.04.

How to Plott NS2 Trace

I saw a nice tutorial on plotting ns2 trace files using a program named gnuplot.

http://alkautsarpens.wordpress.com/2008/05/15/visualize-trace-file-data-with-gnuplot/

Internet and normal people

This internet connection is killing me. Mostly, I can surf the Internet or download files at ease. Though, it is disrupted and I am disconnected occasionally. When it happens, I have got nothing to do but repairing the connection several times. Yeah, several times. I mean it. Never a single repair restores the connection. I have been looking for the solution. I have tried setting a fixed IP for the connection, using OpenDNS servers as my primary and secondary servers instead of the router. None of these helped. I even doubted that it has got problems with the router. It is quite a nuisance.

It kept annoying me. I started to do some more research. While I was disconnected, I can mostly ping the default gateway. But not to the other side of the router. Completely out of the blue, I got the idea that there might be another 192.168.1.1 (default gateway's ip address) sitting in the network. I even scanned the network using Angry IP scanner aka ipscan-3.0-beta4. But no interesting information. So, I browsed the Internet and found out interesting things about arp command. ARP stands for Address Resolution Protocol. In every PC's network protocol stack, ARP maintains a cache of IP address-to-media access control address mappings for future use.

When I viewed the IP to MAC address list in my PC, one MAC address is belonged to the ip address of the default gateway. At that time, I was enjoying the Internet. It's been a while and the problem came up. Then I checked the arp cache, and there was another MAC address associated with 192.168.1.1. I was not able to connect to websites at all. According to the previous experience, I repaired the connection until I got the connection back. When the connection was restored, the MAC address again became the first one.

I continued playing with the commands, arp -a and arp -d. It was confirmed that the second MAC address was the main source of the problem. Anyway that connection is shared among the tenants of the building and I have no idea which crazy bastard has that IP address. So, I have to tackle it from my part. I waited another day making sure that the first MAC address owns. And I put a static arp record at the startup linking the first MAC address to the IP address, 192.168.1.1
(The command is arp -s 192.168.1.1 xx-xx-xx-xx-xx-xx). And since then, the problem never come back.

The reason that let me connect sometimes and that barred is because of the ARP lifetime. This following explanation is from MS Technet about ARP cache.

ARP cache

To minimize the number of broadcasts, ARP maintains a cache of IP address-to-media access control address mappings for future use. The ARP cache can contain both dynamic and static entries. Dynamic entries are added and removed automatically over time. Static entries remain in the cache until the computer is restarted.

Each dynamic ARP cache entry has a potential lifetime of 10 minutes. New entries added to the cache are timestamped. If an entry is not reused within 2 minutes of being added, it expires and is removed from the ARP cache. If an entry is used, it receives two more minutes of lifetime. If an entry keeps getting used, it receives an additional two minutes of lifetime up to a maximum lifetime of 10 minutes.

WiMAX module for the ns-2 simulator

Another interest.
I have to go back to ns-2.28 to run WiMax simulation. Though, the first try is a mess. Installing ns-allinone-2.28 is a piece of cake. 
Just needed to apply a patch to nam-1.11. nam is working fine before updating the package with WiMax modules. 
After the update, it freezes even with the simple tcl programs. Gotta try more. May be it is because of Windows. It may work in Fedora. 

nam-1.11 patch

Just this line.

Manual Edit:
At line 73 of agent.h under nam-1.11 folder, change NULL to 0.

from this, double &corner_x, double &corner_y) const = NULL;
to this, double &corner_x, double &corner_y) const = 0;

Patch file:
http://www.isi.edu/nsnam/dist/nam-1.11.patch

How to create Flooding Attack in NS2 AODV ?

What is mean by Flooding Attack? Short Note :
         Malicious Node will create a more no of  RREQ  to a node, which is even doesn't exist in the network topology. This is how malicious node,  start to flood the request in the network. The purpose of this attack is to consume the network bandwidth and to exhaust the network resources all the time.
Steps :
     >  In aodv.h,
                           i)    #define FLOOD_INTERVAL  0.09  
                           ii)   Add this, after BroadcastTimer class
                                 class FloodTimer : public Handler 
                                 {
                                  public:
                                           FloodTimer(AODV* a):    agent(a){}
                                             void     handle(Event*);
                                 private:
                                           AODV     *agent;
                                           Event     intr;
                                 };
          
                          iii)   class AODV: public Agent 
                                 {
                                               ...........
                                               ...........
                                               friend class FloodTimer;
                                                ...........
                                    Protected:
                                                ............
                                                /*
                                                 * Packet TX Routines
                                                 */
                                                void FloodRREQ(nsaddr_t dst);
                                                ............
                                                nsaddr_t        index;                  // IP Address of this node
                                                u_int32_t       seqno;                  // Sequence Number
                                                int             bid;                           // Broadcast ID
                                                bool flooder;
                                              
                                                /*
                                                 * Timers
                                                 */
                                                 FloodTimer ftimer;
                                                 ............
                                   };
     >  In aodv.cc,
                            i)    int AODV::command(int argc, const char*const* argv)
                                {
                                          if(argc == 2)
                                          {
            Tcl& tcl = Tcl::instance();

                if(strncasecmp(argv[1], "id", 2) == 0)
                                                   {
                tcl.resultf("%d", index);
                 return TCL_OK;
                                                   }
     
                      if(strcmp(argv[1], "flooder") == 0) 
                                                    {
                flooder = true;
                return TCL_OK;
                 }

                 if(strncasecmp(argv[1], "start", 2) == 0)
                {
                                                            ........
               ftimer.handle((Event*) 0);
                 ........
                                                    }
                                                    ........
                                             }
               ..........
                                      }

                       ii) Add  ftimer(this)  and  flooder = false,

                                AODV::AODV(nsaddr_t id) : Agent(PT_AODV),
                             btimer(this), htimer(this), ntimer(this),
                             rtimer(this), lrtimer(this), ftimer(this), rqueue()
                               {
                                         ........
                                          flooder=false;
                                        ........
                               }

                        iii) In Timers, add FloodTimer()

                                 void FloodTimer::handle(Event*) 
                                  {
                                          if (agent->flooder==true) 
                                        {
                                            agent->FloodRREQ(99);
                                            // index will be a attacker, flood attacker !
                                        }
                                          Scheduler::instance().schedule(this, &intr, FLOOD_INTERVAL);
                                   }  

                                iv) After void AODV::SendRequest(nsaddr_t dst) function add this,

                                       void AODV::FloodRREQ(nsaddr_t dst)
                                       {
                                        Packet *p = Packet::alloc();
                                        struct hdr_cmn *ch = HDR_CMN(p);
                                         struct hdr_ip *ih = HDR_IP(p);
                                        struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
                                        aodv_rt_entry *rt = rtable.rt_lookup(dst);

                                        printf("\n***** 'in FloodRREQ' at  node::%d*****\n",index);
                                        // rtable.rt_display(index);
                                         // Fill out the RREQ packet
                                         // ch->uid() = 0;
                                         ch->ptype() = PT_AODV;
                                         ch->size() = IP_HDR_LEN + rq->size();
                                         ch->iface() = -2;
                                         ch->error() = 0;
                                         ch->addr_type() = NS_AF_NONE;
                                         ch->prev_hop_ = index;
 
                                         ih->saddr() = index;
                                         ih->daddr() = IP_BROADCAST;
                                        ih->sport() = RT_PORT;
                                         ih->dport() = RT_PORT;
                                         ih->ttl_ = NETWORK_DIAMETER;
                                         rq->rq_type = AODVTYPE_RREQ;
                                         rq->rq_hop_count = 1;
                                         rq->rq_bcast_id = bid++;
                                         rq->rq_dst = dst;
                                         static int flood=0,num=0;
                                         if(flood==0)
                                        {
                                          num=(rt ? rt->rt_seqno : 0);
                                          flood=1;
                                        }
                                         rq->rq_dst_seqno = num; 
                                         rq->rq_src = index;
                                         seqno += 2;
                                         assert ((seqno%2) == 0);
                                        rq->rq_src_seqno = seqno;
                                         rq->rq_timestamp = CURRENT_TIME;
                                        num=num+2;
                                        Scheduler::instance().schedule(target_, p, 0.);
                                       }

     >  In tcl file
                             i)  At the end, add this code to make a node as flooder
                                            $ns at 0.0 "[$node_(0) set ragent_] flooder"

Now, node 0 will create a RREQ to node 99 ( which doesn't exist in the network ) for every 0.09 seconds.