Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can wrap encode plain text?

5 views
Skip to first unread message

Yong Huang

unread,
May 23, 2002, 5:29:20 PM5/23/02
to
I want to hide plain text in my PL/SQL code. If it's in
dbms_out.put[_line] or htp.print, the text won't be "wrapped"; instead
there's just a "1" in front of the line. The following test is done on
9i and 8.1.7.2:

$ cat q.sql
create or replace procedure p
is
begin
dbms_output.put('This is trade secret!');
end;
/

$ wrap iname=q.sql

PL/SQL Wrapper: Release 9.0.1.0.0- Production on Thu May 23 16:20:55
2002

Copyright (c) Oracle Corporation 1993, 2001. All Rights Reserved.

Processing q.sql to q.plb
$ grep "trade secret" q.plb
1This is trade secret!:

Is there a way to encode that text?

Yong Huang

Daniel Morgan

unread,
May 23, 2002, 5:55:25 PM5/23/02
to
Yong Huang wrote:

a := 'a';
w := 'secret';
x := 'This ';
y := 'is ';
z := 'trade ';

dbms_output.put_line(x||y||a||'z||w);

Though I can't imagine why you would have DBMS_OUTPUT in any production
code.

Daniel Morgan

Andrew Hardy

unread,
May 24, 2002, 3:54:34 AM5/24/02
to
But even that leaves all the text in clear view.

It is quite annoying, all variable names and types remain visible, many
assignments are easy to read, cursor declarations are visible, etc.

If you write a piece of PL/SQL whose contents are proprietary, it's
difficult to hide how they function without making it unintelligible e.g.
using meaningless variables, etc.

Andy

"Daniel Morgan" <dmo...@exesolutions.com> wrote in message
news:3CED654C...@exesolutions.com...

Daniel Morgan

unread,
May 24, 2002, 11:54:00 AM5/24/02
to
Andrew Hardy wrote:

What I teach my students is to put text into procedures they are going to wrap
that is intended to mislead or obfuscate the real text. So, for example, you
might define 26 separate words (rather than the 5 I did above) and just choose
to not use 21 of them. With very little effort you can obscure anything as you
will clearly see if you run the SELECT statement below"

SELECT TRANSLATE ('zhks ks a sfcrfz', 'abcdefghijklmnopqrstuvwxyz',
'abcdfeghkjilmnopqrszuvwxyt ')
from dual;

Daniel Morgan

Andrew Hardy

unread,
May 24, 2002, 12:23:36 PM5/24/02
to
Daniel,

"Daniel Morgan" <dmo...@exesolutions.com> wrote in message

news:3CEE6216...@exesolutions.com...


> Andrew Hardy wrote:
>
> > But even that leaves all the text in clear view.
> >

> What I teach my students is to put text into procedures they are going to
wrap
> that is intended to mislead or obfuscate the real text. So, for example,
you
> might define 26 separate words (rather than the 5 I did above) and just
choose
> to not use 21 of them. With very little effort you can obscure anything as
you
> will clearly see if you run the SELECT statement below"
>
> SELECT TRANSLATE ('zhks ks a sfcrfz', 'abcdefghijklmnopqrstuvwxyz',
> 'abcdfeghkjilmnopqrszuvwxyt ')
> from dual;

True, it's just a pity that you need to think about how to hide code when
you should be thinking about writing it clearly!

Andy
>
> Daniel Morgan
>


Connor McDonald

unread,
May 24, 2002, 4:52:59 PM5/24/02
to Yong Huang

Crude but effective for small pieces of text

x := chr(123) || chr(65) || ...

hth
connor
--
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."

Yong Huang

unread,
May 26, 2002, 10:06:26 AM5/26/02
to
No, Connor. That still leaves strings like chr, put_line in the
wrapped file.

I can file a feature enhancement request on Metalink. It's only going
to take the wrap developer one or two more hours to achieve the goal.
Just a little obfuscation on their side is enough.

Yong

Connor McDonald <connor_...@yahoo.com> wrote in message news:<3CEEA8...@yahoo.com>...

Daniel Morgan

unread,
May 27, 2002, 12:04:00 PM5/27/02
to
Yong Huang wrote:

As a side note ... what is DBMS_OUTPUT.PUT_LINE doing in wrapped code?

Daniel Morgan

Yong Huang

unread,
May 28, 2002, 10:03:00 AM5/28/02
to
Hi, Daniel,

That's just an example. In our real code, we have a lot of htp.p
calls. This is Oracle9i Application Server. htp.p or htp.print is used
to output HTML code. I used dbms_output.put_line as an example since
it does the same thing and people are less familiar with the htp
package.

Regards,

Yong Huang

Daniel Morgan <dmo...@exesolutions.com> wrote in message news:<3CF258EA...@exesolutions.com>...

Daniel Morgan

unread,
May 28, 2002, 11:35:41 AM5/28/02
to
Yong Huang wrote:

Thanks.

I use the htp and htf packages too and understand what you were trying to communicate.

The reason I asked is that it is not uncommon to find put_line in production code and it makes me quake in
fear.

Daniel Morgan

0 new messages