Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SiteMonitor


Jack_mcs

Recommended Posts

Hi Jack,

 

I have this neat contrib installed and it's working except for one thing;

 

as soon as i upload a new file anywhere and make the check to see if sitemonitor did pick it up, the page 'hangs'

 

when i delete the new file, it's working again...

 

I read the entire thread, and a did not see a similar problem.

 

 

Any idea's?

 

tia Peter.

Link to comment
Share on other sites

If you are trying to monitor too many files, that can happen. Try excluding some directories to see if that works.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

i now installed the contrib into my live shop (it's a different server with only my life shop, no test-shops..)

 

after excluding several directories -> problem remains.

 

- if i delete admin from the exclude_list, then sitemonitor has no problem in finding all 'new' files in admin after manual execution

 

however, in this case i can not delete and create the reference_file

 

- if i check Quarantine Files, then i get:

Found a new file named readme.txt

Fatal error: Call to undefined function tep_not_null() in /home/site/public_html/admin/includes/functions/sitemonitor_functions.php on line 87

 

apart from this, everything works like a charm:

 

delete files, size difference, time and permissions mismatches

Edited by peter222
Link to comment
Share on other sites

I don't have an answer for you but it looks like there is some sort of setup, or maybe a permissions problem, with the server since the SiteMonitor code isn't seeing a standard function.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

My site monitor was working fine. However, due to a new security alert found here:

 

http://www.oscommerce.com/forums/index.php?showtopic=340995

 

about changing the admin directory to a new secret name, when I did this I got the following error message when using Site Monitor:

 

Warning: opendir(/catalog/) [function.opendir]: failed to open dir: No such file or directory in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 168

 

Warning: readdir(): supplied argument is not a valid Directory resource in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 170

 

Warning: closedir(): supplied argument is not a valid Directory resource in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 182

 

Can you give me a detailed step list to fix these error messages? Thanks.

Link to comment
Share on other sites

My site monitor was working fine. However, due to a new security alert found here:

 

http://www.oscommerce.com/forums/index.php?showtopic=340995

 

about changing the admin directory to a new secret name, when I did this I got the following error message when using Site Monitor:

 

Warning: opendir(/catalog/) [function.opendir]: failed to open dir: No such file or directory in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 168

 

Warning: readdir(): supplied argument is not a valid Directory resource in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 170

 

Warning: closedir(): supplied argument is not a valid Directory resource in /home/43/dbasename/htdocs/my_domaindirectory/catalog/my_new_admin_name/includes/functions/sitemonitor_functions.php on line 182

 

Can you give me a detailed step list to fix these error messages? Thanks.

 

I kept working on it and found the configure.php file wasn't correct and fixed it. Never mind.

Link to comment
Share on other sites

Hi,

 

I am uisng the latest oscMAX version of oscommerce and have the latest version of SM and have been told by the creators of Max that SM should work fine.

 

I installed as per instructs but obvioulsy I am missing or misunderstood something. I did not do anything in the Update directory so maybe this this is it.

 

Anyway I uploaded all the files, didn't chmod anything, added code to the files but was stumped at Step 5.

 

I asume that in the shop admin there is supposed to be a SM box however I cannot see anything to do with SM.

 

I eneterd all my server info etc in the SM configure file however, was I supposed to initiate a php file eg http://mysite/admin/sitemonitor something.php to do this?

 

Thanks for the script. I've just been hacked on many sites and can't wait to get this happening.

 

oz :-)

Link to comment
Share on other sites

Hi Jack,

 

I've recently moved the whole site to a new server and I'm having peculiar problem. From the admin side, it all seems to be running fine but... when cron runs for a first time, it creates "sitemonitor_reference.php" outside the shop root and no email message is sent. On the second run of the cron, the sitemonitor_log.txt is created and message is sent just fine. The problem is that these two files cannot be altered or deleted from admin->sitemonitor->admin. Yes, I have /home/user/public_html/ as a start directory in sitemonitor_configure_setup.php. Any ideas? I guess I could just change the path to /home/user/ but that would monitor all other folders such as mail, .spamassasin etc, therefore I would rather keep those two files (sitemonitor_reference.php + sitemonitor_log.txt) in admin folder.

Absinthe Original Liquor Store

Link to comment
Share on other sites

I don't know what that could be. Your host is really the one that should look at a problem like that. It could be that the cron job needs a direct path so you might want to try that first. Try changing the command to something like

cd /home/username/public_html/admin/; /usr/local/bin/php -c /home/username/public_html/php.ini -q /home/username/public_html/admin/sitemonitor.php

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I kept working on it and found the configure.php file wasn't correct and fixed it. Never mind.

Do you mean the sitemonitor_configure.php file?

 

I found that I had to put the values in the file before it was uploaded.

 

Also, I now get two emails.

Link to comment
Share on other sites

cd /home/username/public_html/admin/; /usr/local/bin/php -c /home/username/public_html/php.ini -q /home/username/public_html/admin/sitemonitor.php

That was easy! ;)

 

Thank you very much Jack, I wonder why all other cron jobs work without the direct path (I have about 13 jobs running atm). It must be server related.

 

Leslie: do you have this > /dev/null at the end of your cron job?

Absinthe Original Liquor Store

Link to comment
Share on other sites

That was easy! ;)

 

Thank you very much Jack, I wonder why all other cron jobs work without the direct path (I have about 13 jobs running atm). It must be server related.

 

Leslie: do you have this > /dev/null at the end of your cron job?

Hi Alex

 

No, I do not use cron jobs.

Link to comment
Share on other sites

Hi! Thanks for a great contribution. Need a little help. I have this working great on my base shop, but when I try ti use it on a different shop that utilizes a great deal of 'symbolic links', I get a string of errors for each linked directory.

 

Like this: Warning: is_dir() [function.is-dir.html]: Stat failed for /home/catalog/public_html/manuals/manuals (errno=13 - Permission denied) in /home/catalog/public_html/admin/includes/functions/sitemonitor_functions.php on line 174

 

I tried excluding the linked directories without success. Has anyone come across a 'work-around' for this? Thanks again!

Tony Mazz

Link to comment
Share on other sites

A new version has been uploaded containing these changes:

 

- Changed empty call to tep_not_null in sitemonitor_configure_setup.php to fix update problem with the configure settings

- Added code to exclude checking .xml files

- Added code to check for hacked files

 

For this last change, the code checks for known, hacker-type code. That code is also legitimately used in other parts of the shop, although usually only in contributions. So if any files show up in the hacked list, be sure to manually check them before deleting them. The code for this new option is set to not check images since they slow down the searchand are not as likely to be edited by a hacker, though it happens. To keep it simple, I didn't add an option to control that but I will if it becomes an issue. Also, this option require php 5 to work. You can upload the changes to your server if it is still using php 4 but the hacker code checker won't work. If anyone knows of any hacker-type code I missed, please let me know so it can be added to the next version.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack

 

Ive just tried the new version but have come across an issue when running the hack check

 

Its exhausting memory

 

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 44515328 bytes) in /home/user/public_html/admin/includes/functions/sitemonitor_functions.php on line 100

 

this is on a shared server with 4Gb ram with a php.ini setting of a max of 128Mb per process

 

I can see a lot of people having issues with this as i would think most shared servers run with a lot lower memory limit

Link to comment
Share on other sites

I tested it on several shops before uploading without any issues. My guess is that there is some large file on your server that is causnig the problem. Please try this. Find this line of code in admin/includes/functions/sitemonitor_functions.php, at line 100

if (($page = file_get_contents($file)) !== FALSE)

Add this line right before it

echo 'Checking page '.$file.'<br>';

Then run it again. It should print out a list of all files being checked. The last one displayed before the failure is the one most likely causing the problem. Check the size of that file on the server to see if it is very large or maybe if there is something about it that might cause a problem, like an invalid name.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

A new version has been uploaded containing these changes:

 

-Jack

Hi Jack

 

I followed the update instructions, but I get

 

Parse error: syntax error, unexpected ')', expecting '(' in /xxpath edited outxxx/includes/functions/sitemonitor_functions.php on line 86

 

 

 

I am still using php 4, but I thought that

 

This last option required php 5 to run. The code

is setup to skip image files to allow it to run on all servers.

 

meant that only the last option could not be used.

Link to comment
Share on other sites

Hi Jack, Thanks for the contribution. I've installed v1.8. Installation went o.k.. Under Site Monitor results it shows:

 

NEW FILES:

No new files found...

 

DELETED FILES:

No deleted files found...

 

SIZE MISMATCH:

(66) Difference found: New-> count.php Original-> 11437

(67) Difference found: New-> count_edit.php Original-> 12034

(68) Difference found: New-> count_history.php Original-> 7549

 

From line 66 down to line 1150.

 

1152) TIME MISMATCH:

1153) Time Mismatch on count.php Last Changed on

1154) Time Mismatch on count_edit.php Last Changed on

1155) Time Mismatch on count_history.php Last Changed on

 

Down to line 2050.

 

PERMISSIONS MISMATCH:

permissions Mismatch on count.php Currently set to "0" was set to "666"

permissions Mismatch on count_edit.php Currently set to "0" was set to "666"

permissions Mismatch on count_history.php Currently set to "0" was set to "666"

 

Down to line 3284

 

All permissions are set to 666.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sitemonitor ran on September 25, 2009, 4:50 am

Total mismatches found were 3214

Total files being monitored is 1098

 

Results with alternate configuration:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sitemonitor ran on September 26, 2009, 5:04 am

Total mismatches found were 1098

Total files being monitored is 1098

 

 

 

This is on localhost. .

Unsure of proper configuration.

 

Always Email: unchecked

Quarantine Files: unchecked

Verbose: checked

Log File: checked

Log File Size 100000

Delete Reference file: blank

To: [email protected]

From: user@localhost

Start Directory: ../

Admin Directory: http://localhost//renamed admin/

Admin Username: none

Admin Password: none

Exclude Selector:

Exclude List:"renamed admin/quarantine", "admin/quarantine", "cgi-bin","admin"

 

Any suggestion greatly appreciated. Thanks.

Edited by ddsavage2000
Link to comment
Share on other sites

Hi Jack

 

I followed the update instructions, but I get

 

Parse error: syntax error, unexpected ')', expecting '(' in /xxpath edited outxxx/includes/functions/sitemonitor_functions.php on line 86

 

 

 

I am still using php 4, but I thought that

 

This last option required php 5 to run. The code

is setup to skip image files to allow it to run on all servers.

 

meant that only the last option could not be used.

I hadn't checked it before under php 4 but you are correct. The php parser can't get past the php 5 code. You'll need to re-upload the same files you replaced with this version with those from the previous until I change the code for this option.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Start Directory: ../

Admin Directory: http://localhost//renamed admin/

Admin Username: none

Admin Password: none

Exclude Selector:

Exclude List:"renamed admin/quarantine", "admin/quarantine", "cgi-bin","admin"

 

Any suggestion greatly appreciated. Thanks.

Start Directory: - should be the full path to the shop, probably http://localhost//renamed.

 

Admin Directory: - should be blank.

 

Admin Username: none - - should be blank.

 

Admin Password: none - should be blank.

 

Exclude Selector:

Exclude List:"renamed admin/quarantine", "admin/quarantine", "cgi-bin","admin"

 

Has an invalid location - "renamed admin/quarantine"

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I tested it on several shops before uploading without any issues. My guess is that there is some large file on your server that is causnig the problem. Please try this. Find this line of code in admin/includes/functions/sitemonitor_functions.php, at line 100
if (($page = file_get_contents($file)) !== FALSE)

Add this line right before it

echo 'Checking page '.$file.'<br>';

Then run it again. It should print out a list of all files being checked. The last one displayed before the failure is the one most likely causing the problem. Check the size of that file on the server to see if it is very large or maybe if there is something about it that might cause a problem, like an invalid name.

 

Jack

 

Bingo!

 

A 45Mb core dump file in a folder was causing the issue

 

Thanks Jack

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...