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.

Inactivity Checker

Discussion in 'cPanel Developers' started by JohnnyD1995, Apr 22, 2011.

  1. JohnnyD1995

    JohnnyD1995 Member

    Joined:
    Aug 18, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Would it be possible to have something like a cron script that i can run that checks /home for any instance of a file called WebLoversRemoveInstantly.php for instance and if the file exists.... suspend the account.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi JohnnyD1995,

    Yes that's possible.

    What I'd suggest doing is creating a script (Perl, Bash, PHP, whatever) that performs:

    1)`find` for that file.
    2) based on the absolute path of that file, you would know the user's home directory.
    - ie, '/home/dave/public_html/badHackScript.php' => '/home/dave' ...so who ever owns /home/dave
    3) this directory should belong to "dave", but you could verify that by doing a stat of the directory or you could do a recursive grep for the homedir attribute in the userdata directory /var/cpanel/userdata with a regex similar to `grep -rP 'homedir:\s*/home/dave\s*$' ./* 2>/dev/null`
    Code:
    root@004 [/var/cpanel]# grep -rP 'homedir:\s*/home/dave\s*$' ./* 2>/dev/null
    ./userdata/dave/afavaf.dave.com:homedir: /home/dave
    ./userdata/dave/where.dave.com:homedir: /home/dave
    ./userdata/dave/dave.com:homedir: /home/dave
    ./userdata/dave/extradave.dave.com:homedir: /home/dave
    ./userdata/dave/who.dave.com:homedir: /home/dave
    
    4) now you know for certain that "dave" is the owner (as that is the homedir listed in his file), you can now use our API to suspend the user: XML-API suspendacct

    if you have a remote accesshash, you can use either the Perl PublicAPI or PHP PublicAPI clients (or some other remote query API client) to easily make the request to suspend the account.

    Regards,
    -DavidN
     
  3. JohnnyD1995

    JohnnyD1995 Member

    Joined:
    Aug 18, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Yes this sounds exactly what I am looking for :)

    However sadly I am not good with coding as this should be relatively easy to do maybe someone would be willing to create it for me for.... $5? this is all the cash I have at the moment I am afraid.
     

Share This Page