The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Any requests?

Discussion in 'cPanel Developers' started by shaun, Sep 12, 2003.

  1. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    As some of you might know, i write scripts some times to take care of certian things. Any requests for a night when i get in a coding mood? just list them here.

    for those of you who dont know, you can check some of them out here.

    http://www.cplicensing.net/extras/

    cPanel.net Support Ticket Number:
     
  2. GOT

    GOT Get Proactive!

    Joined:
    Apr 8, 2003
    Messages:
    900
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Norfolk, VA
    cPanel Access Level:
    DataCenter Provider
    Search and replace script.

    Basically, an advanced bash search adn replace program would be great. Ask for a search string, and for a replacement string, or to delete the string or to delete the line that contains that string.

    Ability to recursively search is a must. Like

    /home/*/.spamassassin/user_prefs

    That kind of thing would be tremendous.

    Thanks for the things that you do!

    cPanel.net Support Ticket Number:
     
  3. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Check out this script - http://www.cgiware.com/downloads/swap.txt

    cPanel.net Support Ticket Number:
     
  4. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    A script that searches for hidden files and directories alerting when new ones are found.

    Have it know about normal hidden files, This script below (which we find is a pretty good start) could be the basis.


    #!/bin/sh
    /usr/bin/find / -name ".*" -print -xdev |grep -v .htaccess |grep -v .neomail |grep -v .bash_profile|grep -v .spamassassin|grep -v .e
    xists|grep -v .csvignore (cat <<EOF
    This is an automated report of possible existent hidden files on the server
    SERVERNAME, generated by the find utility command.

    New detected HIDDEN files under the / directory include:
    EOF
    cat
    ) | /bin/mail -s "Content of hidden file audit report" mail@domain.com

    cPanel.net Support Ticket Number:
     
  5. GOT

    GOT Get Proactive!

    Joined:
    Apr 8, 2003
    Messages:
    900
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Norfolk, VA
    cPanel Access Level:
    DataCenter Provider
    That scripts is a really good start, though I would like to see the ability to delete any line that conatins the specified text and to simply delete the specified text.

    cPanel.net Support Ticket Number:
     
  6. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    Maybe i'm not understanding what you want but whats wrong with the bash command replace?

    replace oldtext newtext -- files

    example: replace 1.1.1.1 2.2.2.2 -- *

    cPanel.net Support Ticket Number:
     
  7. GOT

    GOT Get Proactive!

    Joined:
    Apr 8, 2003
    Messages:
    900
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Norfolk, VA
    cPanel Access Level:
    DataCenter Provider
    I checked the man page for replace, and I did not see a switch for deleting lines containing a particular text.

    Also, the ability to search on key cpanel info would be nice too. I know we could do that with ensim, but not sure if that info is available to bash.

    In any case, if it is not interesting, then disregard... Was just a suggestion! :)

    cPanel.net Support Ticket Number:
     
  8. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    How about a script to increment all serial numbers by one after mass dns changes have been made?

    cPanel.net Support Ticket Number:
     
  9. DHL

    DHL Well-Known Member

    Joined:
    Mar 8, 2002
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    replace 'remove this line' '' -- *

    :)

    cPanel.net Support Ticket Number:
     
  10. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Hey Shaun;

    How about a script that does the log stats for cPanel's access_log in /usr/local/cpanel/logs?

    sort of a

    for i in /var/cpanel/users do ' grep $i /usr/local/cpanel/logs/access_log >/home/$i/tmp/cp_access

    Or some such.

    cPanel.net Support Ticket Number:
     
  11. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    dgbaker: your looking for a script to verify that no old logs for terminated users exist?

    cPanel.net Support Ticket Number:
     
  12. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Nope, looking to be able to track for each cpanel login id listed in the cpanel access_log to history of from where, when, etc..

    Ideally to be able to give webalizer stats or such on cpanel access.

    cPanel.net Support Ticket Number:
     
  13. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    David may not be, but I sure am! :D

    I have found, depending if Reseller or Hosting account, files similar to below get left behind and must be manually removed.

    /etc/proftpd/xxx_logs

    /usr/local/frontpage/www.xx.com:80.cnf
    /usr/local/apache/domlogs/ftp.xxx-ftp_log.offset
    /usr/local/apache/domlogs/ftp.xxx-ftp_log.offsetftpbytes

    /var/cpanel/bandwidth/xxx-all.rrd
    /var/cpanel/bandwidth/xx-http.rrd
    /var/cpanel/bandwidth/xxx-ftp.rrd
    /var/cpanel/bandwidth/xxx-pop3.rrd
    /var/cpanel/bandwidth/xxx-smtp.rrd
    /var/cpanel/bandwidth/xxx
    /var/cpanel/packages/xxx
    /var/cpanel/dips/xxx
    /var/cpanel/mainips/xxx
    /var/cpanel/suspended/xxx
    /var/cpanel/xxx.accts

    Although an eMail outlining this has not been sent to DarkOrb, it's mostly because I don't have very cancellations -- so to me, it's not that big of a deal. Down the road it may be handy as more Servers are being aquired and, others may appreciate it now.

    cPanel.net Support Ticket Number:
     
  14. ckizer

    ckizer Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    129
    Likes Received:
    0
    Trophy Points:
    16
    I noticed your script to restrict bandadmin. Can you tell me what people are typing on my server to view it without being authenticated?

    Are they using something like:

    http://mydomain.com/bandadmin/stat?

    How does that work?

    I'll use your script to fix it but i'm curious as to what people are doing to see my bandadmin

    cPanel.net Support Ticket Number:
     
  15. southnet

    southnet Member

    Joined:
    Oct 8, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Yeah,

    here's one.

    I am trying to isolate upload traffic (including php/web scripting) for each account on Cpanel (NOT by IP, but by account)

    I have had three people sell me half baked attempts that don't work - if you can help out it would be greatly appreciated :)
     
  16. Moonfire

    Moonfire Member

    Joined:
    Aug 10, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I need a script that adds number lines on the part that you edit your files, I find it really frustrating having to transfer the code into Dreamweaver.
     
  17. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you are using the x3 theme, go to File manager and navigate to the file. Select the file then click Code Editor. That will display the contents of the files with the appropriate line numbers.
     

Share This Page