Jump to content

Shell security


Manixat

Recommended Posts

Hello, I'm concerned about the security of this code because I am not really familiar with shell and OS stuff. I needed to add this function because filter_var wasn't enough to filter bullshit emails out like [email protected]. I need to verify domain existence and I grabbed a hold of this function from eHow, which is a pretty trustworthy site, but I need to be 100% sure before using it. Are there any possible issues with this function:

function checkDomainAvailability($domain) {
    if(preg_match('/[;\&\|\>\<]/', $domain)) exit; //Could be a hack attempt
    exec("whois " . escapeshellarg($domain), $output); //:CAREFUL:
    $result = implode("\n", $output);
    return (strpos($result, 'No match') !== false);
}

Thank you in advance!

 

EDIT: I just noticed that this won't  work on windows. Is there any cross-OS command I can use?

Link to comment
https://forums.phpfreaks.com/topic/278928-shell-security/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.