Shion
Legendário XPZ
Este anti inject é muito bom, basta adicionar na sua functions, e aplica-la nós códigos..
CÓDIGO
[hide]function clean($szValor)
{
CheckSQL( $szValor );
$check = $szValor;
$search = array('chr(', 'chr=', 'chr ', ' chr', 'wget ', ' wget', 'wget(',
'cmd=', ' cmd', 'cmd ', 'rush=', ' rush', 'rush ',
'union ', ' union', 'union(', 'union=', 'echr(', ' echr', 'echr ', 'echr=',
'esystem(', 'esystem ', 'cp ', ' cp', 'cp(', 'mdir ', ' mdir', 'mdir(',
'mcd ', 'mrd ', 'rm ', ' mcd', ' mrd', ' rm',
'mcd(', 'mrd(', 'rm(', 'mcd=', 'mrd=', 'mv ', 'rmdir ', 'mv(', 'rmdir(',
'chmod(', 'chmod ', ' chmod', 'chmod(', 'chmod=', 'chown ', 'chgrp ', 'chown(', 'chgrp(',
'locate ', 'grep ', 'locate(', 'grep(', 'diff ', 'kill ', 'kill(', 'killall',
'passwd ', ' passwd', 'passwd(', 'telnet ', 'vi(', 'vi ',
'insert into', 'select ', 'fopen', 'fwrite', ' like', 'like ',
'$_request', '$_get', '$request', '$get', '.system', 'HTTP_PHP', '&aim', ' getenv', 'getenv ',
'new_password', '&icq','/etc/password','/etc/shadow', '/etc/groups', '/etc/gshadow',
'HTTP_USER_AGENT', 'HTTP_HOST', '/bin/ps', 'wget ', 'uname\x20-a', '/usr/bin/id',
'/bin/echo', '/bin/kill', '/bin/', '/chgrp', '/chown', '/usr/bin', 'g\ \ ', 'bin/python',
'bin/tclsh', 'bin/nasm', 'perl ', 'traceroute ', 'ping ', '.pl', 'lsof ',
'/bin/mail', '.conf', 'motd ', 'HTTP/1.', '.inc.php', 'config.php', 'cgi-', '.eml',
'file\://', 'window.open', '<script>', 'javascript\://','img src', 'img src','.jsp','ftp.exe',
'xp_enumdsn', 'xp_availablemedia', 'xp_filelist', 'xp_cmdshell', 'nc.exe', '.htpasswd',
'servlet', '/etc/passwd', 'wwwacl', '~root', '~ftp', '.js', '.jsp', 'admin_', '.history',
'bash_history', '.bash_history', '~nobody', 'server-info', 'server-status', 'reboot ', 'halt ',
'powerdown ', '/home/ftp', '/home/www', 'secure_site, ok', 'chunked', 'org.apache', '/servlet/con',
'<script', 'UPDATE', 'SELECT', 'DROP', '/robot.txt' ,'/perl' ,'mod_gzip_status', 'db_mysql.inc', '.inc', 'select from',
'select from', 'drop ', 'getenv', 'http_', '_php', 'php_', 'phpinfo()', '<?php', '?>', 'sql=');
$szValor = str_replace($search, '', $szValor);
$szValor = preg_replace(sql_regcase("/(shutdown|'|GunzDB|backup|select|request|from|insert|delete|union|0x|cast|exec|varchar|insert into|delete from|update account|update login|update character|ugradeid|drop table|show tables|name|password|login|account|login|clan|0x|;|character|set|where|#|'|\*|--|\\\\)/"),"",$szValor);
$szValor = trim($szValor);
$szValor = strip_tags($szValor);
$szValor = addslashes($szValor);
$szValor = str_replace("'", "''", $szValor);
$szValor = stripcslashes($szValor);
$szValor = htmlspecialchars($szValor);
if( $check != $szValor )
{
$logf = fopen("./logs/injection.txt", "a ");
fprintf($logf, "%s (m_%s.php) - [AID=%s] - Data: %s IP: %s Valor: %s, Fixed: %s\r\n", $_SERVER[php_SELF],$_GET['do'], $_SESSION['AID'],date("d-m-Y h:i:s A"), $_SERVER['REMOTE_ADDR'], $check, $szValor );
fclose($logf);
alertbox("Caractere indevido! Por favor arrume!","index.php");
}
return( $szValor );
}[/hide]
CÓDIGO
[hide]function clean($szValor)
{
CheckSQL( $szValor );
$check = $szValor;
$search = array('chr(', 'chr=', 'chr ', ' chr', 'wget ', ' wget', 'wget(',
'cmd=', ' cmd', 'cmd ', 'rush=', ' rush', 'rush ',
'union ', ' union', 'union(', 'union=', 'echr(', ' echr', 'echr ', 'echr=',
'esystem(', 'esystem ', 'cp ', ' cp', 'cp(', 'mdir ', ' mdir', 'mdir(',
'mcd ', 'mrd ', 'rm ', ' mcd', ' mrd', ' rm',
'mcd(', 'mrd(', 'rm(', 'mcd=', 'mrd=', 'mv ', 'rmdir ', 'mv(', 'rmdir(',
'chmod(', 'chmod ', ' chmod', 'chmod(', 'chmod=', 'chown ', 'chgrp ', 'chown(', 'chgrp(',
'locate ', 'grep ', 'locate(', 'grep(', 'diff ', 'kill ', 'kill(', 'killall',
'passwd ', ' passwd', 'passwd(', 'telnet ', 'vi(', 'vi ',
'insert into', 'select ', 'fopen', 'fwrite', ' like', 'like ',
'$_request', '$_get', '$request', '$get', '.system', 'HTTP_PHP', '&aim', ' getenv', 'getenv ',
'new_password', '&icq','/etc/password','/etc/shadow', '/etc/groups', '/etc/gshadow',
'HTTP_USER_AGENT', 'HTTP_HOST', '/bin/ps', 'wget ', 'uname\x20-a', '/usr/bin/id',
'/bin/echo', '/bin/kill', '/bin/', '/chgrp', '/chown', '/usr/bin', 'g\ \ ', 'bin/python',
'bin/tclsh', 'bin/nasm', 'perl ', 'traceroute ', 'ping ', '.pl', 'lsof ',
'/bin/mail', '.conf', 'motd ', 'HTTP/1.', '.inc.php', 'config.php', 'cgi-', '.eml',
'file\://', 'window.open', '<script>', 'javascript\://','img src', 'img src','.jsp','ftp.exe',
'xp_enumdsn', 'xp_availablemedia', 'xp_filelist', 'xp_cmdshell', 'nc.exe', '.htpasswd',
'servlet', '/etc/passwd', 'wwwacl', '~root', '~ftp', '.js', '.jsp', 'admin_', '.history',
'bash_history', '.bash_history', '~nobody', 'server-info', 'server-status', 'reboot ', 'halt ',
'powerdown ', '/home/ftp', '/home/www', 'secure_site, ok', 'chunked', 'org.apache', '/servlet/con',
'<script', 'UPDATE', 'SELECT', 'DROP', '/robot.txt' ,'/perl' ,'mod_gzip_status', 'db_mysql.inc', '.inc', 'select from',
'select from', 'drop ', 'getenv', 'http_', '_php', 'php_', 'phpinfo()', '<?php', '?>', 'sql=');
$szValor = str_replace($search, '', $szValor);
$szValor = preg_replace(sql_regcase("/(shutdown|'|GunzDB|backup|select|request|from|insert|delete|union|0x|cast|exec|varchar|insert into|delete from|update account|update login|update character|ugradeid|drop table|show tables|name|password|login|account|login|clan|0x|;|character|set|where|#|'|\*|--|\\\\)/"),"",$szValor);
$szValor = trim($szValor);
$szValor = strip_tags($szValor);
$szValor = addslashes($szValor);
$szValor = str_replace("'", "''", $szValor);
$szValor = stripcslashes($szValor);
$szValor = htmlspecialchars($szValor);
if( $check != $szValor )
{
$logf = fopen("./logs/injection.txt", "a ");
fprintf($logf, "%s (m_%s.php) - [AID=%s] - Data: %s IP: %s Valor: %s, Fixed: %s\r\n", $_SERVER[php_SELF],$_GET['do'], $_SESSION['AID'],date("d-m-Y h:i:s A"), $_SERVER['REMOTE_ADDR'], $check, $szValor );
fclose($logf);
alertbox("Caractere indevido! Por favor arrume!","index.php");
}
return( $szValor );
}[/hide]
Editado por um moderador: