Re: [PHP] Regular Expressions

2007-11-06 Thread Ezequiel Gutesman
True, but you'll have to change the rexex not to match, 'ń' or
'ã for example (unless you want it)

Thiago Ferreira wrote:
> you could do it without any function
>  
> $line = "Hola que tal con á con acento y eñe \n";
> 
> echo preg_replace('/&([aeioun])(acute|tilde);/i','\1',$line);
> 
> ?>
> 
> On Nov 6, 2007 2:44 PM, Ezequiel Gutesman <[EMAIL PROTECTED]>
> wrote:
> 
>> Maybe this helps
>>
>> >
>>
>>  $line = preg_replace_callback(
>>'/(á|é|í|ó|ú|ñ)/',
>>create_function(
>>// single quotes are essential here,
>>// or alternative escape all $ as \$
>>'$matches',
>>'switch($matches[0]){
>>case \'á\': return \'a\';
>>case \'é\': return \'e\';
>>case \'í\': return \'i\';
>>case \'ó\': return \'o\';
>>case \'ú\': return \'u\';
>>case \'ñ\': return \'n\';
>>}'
>>),
>>$line
>>);
>>
>> echo $line;
>> ?>
>>
>> if you want to use this functionality several times:
>>
>> >
>> function myReplace($chr)
>> {
>>switch($chr[0]){
>>case 'á': return 'a';
>>case 'é': return 'e';
>>case 'í': return 'i';
>>case 'ó': return 'o';
>>case 'ú': return 'u';
>>case 'ñ': return 'n';
>>}
>> }
>>
>>
>> $line = "Hola que tal con á con acento y eñe ";
>>
>>  $line = preg_replace_callback(
>>'/(á|é|í|ó|ú|ñ)/',
>>'myReplace',
>>$line
>>);
>> echo $line;
>> ?>
>>
>> hope this helps. Note that these are pcre (Perl Compatible RegEx).
>>
>>
>>
>> Alberto García Gómez wrote:
>>> I'm a mess in regular expressions and I make this code:
>>>
>>> $link = ereg_replace('ñ','n',$link);
>>> $link = ereg_replace('á','a',$link);
>>> $link = ereg_replace('é','e',$link);
>>> $link = ereg_replace('í','i',$link);
>>> $link = ereg_replace('ó','o',$link);
>>> $link = ereg_replace('ú','u',$link);
>>>
>>> I ask if is a way to make those lines into a single one but working as
>> well as this piece. I'm thinking in increase those lines so will be
>> wonderful if I can optimize the code.
>>>
>>>
>>> Este correo ha sido enviado desde el Politécnico de Informática "Carlos
>> Marx" de Matanzas.
>>> "La gran batalla se librará en el campo de las ideas"
>>>
>> --
>> Ezequiel Gutesman
>> Researcher
>> Corelabs
>> Core Security Technologies
>> http://www.coresecurity.com/corelabs
>>
>> PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 

-- 
Ezequiel Gutesman
Researcher
Corelabs
Core Security Technologies
http://www.coresecurity.com/corelabs

PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Regular Expressions

2007-11-06 Thread Ezequiel Gutesman
Maybe this helps



if you want to use this functionality several times:



hope this helps. Note that these are pcre (Perl Compatible RegEx).



Alberto García Gómez wrote:
> I'm a mess in regular expressions and I make this code:
> 
> $link = ereg_replace('ñ','n',$link); 
> $link = ereg_replace('á','a',$link);
> $link = ereg_replace('é','e',$link); 
> $link = ereg_replace('í','i',$link);
> $link = ereg_replace('ó','o',$link); 
> $link = ereg_replace('ú','u',$link);
> 
> I ask if is a way to make those lines into a single one but working as well 
> as this piece. I'm thinking in increase those lines so will be wonderful if I 
> can optimize the code.
> 
> 
> 
> Este correo ha sido enviado desde el Politécnico de Informática "Carlos Marx" 
> de Matanzas.
> "La gran batalla se librará en el campo de las ideas"
> 

-- 
Ezequiel Gutesman
Researcher
Corelabs
Core Security Technologies
http://www.coresecurity.com/corelabs

PGP Figerprint: 01E4 0E4F 83F8 2D5D 8050 0449 7156 1DF6 C2B3 34AE

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Announcement: Releasing CORE GRASP for PHP. An open source, dynamic web application protection system.

2007-08-22 Thread Ezequiel Gutesman
The correct URL is

http://grasp.coresecurity.com


Ezequiel Gutesman wrote:
> CORE GRASP for PHP is a web-application protection software aimed at
> detecting and blocking injection vulnerabilities and privacy violations.
> As mentioned during its presentation at Black Hat USA 2007, GRASP is
> being released as open source under the Apache 2.0 license and can be
> obtained from http://gasp.coresecurity.com/.
>
> The present implementation protects PHP 5.2.3 against SQL-injection
> attacks for the MySQL engine, it can be installed with almost the same
> effort as the PHP engine, both in Unix and Windows systems, and
> protection is immediate with any PHP web application running in the
> protected server.
>
> CORE GRASP works by enhancing the PHP execution engine (VM) to permit
> byte-level taint tracking and analysis for all the user-controlled or
> otherwise untrustable variables of the web application. Tainted bytes
> are then tracked and their taint marks propagated throughout the web
> application's runtime. Whenever the web application tries to interact
> with an DB backend using SQL statements that contain tainted bytes,
> GRASP analyzes the statment and detects and prevents attacks or abnormal
> actions.
>
> CORE GRASP was developed by CoreLabs, the research unit of Core Security
> Technologies. At CoreLabs, we plan to improve the tool and include new
> protections shortly. However, the invitation to collaborate with the
> project is open. If you would like to collaborate, please go to the
> GRASP website and subscribe to our mailing list.
>
> Project home: http://grasp.coresecurity.com/
> Documentation, presentation and papers:
> http://grasp.coresecurity.com/index.php?m=doc
> Download: http://grasp.coresecurity.com/index.php?m=dld
>
>   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Announcement: Releasing CORE GRASP for PHP. An open source, dynamic web application protection system.

2007-08-22 Thread Ezequiel Gutesman
CORE GRASP for PHP is a web-application protection software aimed at
detecting and blocking injection vulnerabilities and privacy violations.
As mentioned during its presentation at Black Hat USA 2007, GRASP is
being released as open source under the Apache 2.0 license and can be
obtained from http://gasp.coresecurity.com/.

The present implementation protects PHP 5.2.3 against SQL-injection
attacks for the MySQL engine, it can be installed with almost the same
effort as the PHP engine, both in Unix and Windows systems, and
protection is immediate with any PHP web application running in the
protected server.

CORE GRASP works by enhancing the PHP execution engine (VM) to permit
byte-level taint tracking and analysis for all the user-controlled or
otherwise untrustable variables of the web application. Tainted bytes
are then tracked and their taint marks propagated throughout the web
application's runtime. Whenever the web application tries to interact
with an DB backend using SQL statements that contain tainted bytes,
GRASP analyzes the statment and detects and prevents attacks or abnormal
actions.

CORE GRASP was developed by CoreLabs, the research unit of Core Security
Technologies. At CoreLabs, we plan to improve the tool and include new
protections shortly. However, the invitation to collaborate with the
project is open. If you would like to collaborate, please go to the
GRASP website and subscribe to our mailing list.

Project home: http://grasp.coresecurity.com/
Documentation, presentation and papers:
http://grasp.coresecurity.com/index.php?m=doc
Download: http://grasp.coresecurity.com/index.php?m=dld

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php