Search the web
Sign In
New User? Sign Up
frink
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Embedding Frink?   Message List  
Reply | Forward Message #221 of 257 |
Re: [Frink] Embedding Frink?

Ryan Voots wrote:
> I've been wanting to use frink for doing calculations internally in a
> program and I'm wondering if there is a supported way to do this? (its
> for an IRC bot).

Yes, there is a way to embed Frink into a Java program. The section
of the documentation entitled "Embedding Frink" is a good place to start:

http://futureboy.us/frinkdocs/#EmbeddingFrink

By the way, I've already built my own Frink IRC bot; it listens for
calculation requests and returns the answers. It's built around the
PIRCbot framework, which is excellent, but I haven't bothered to add a
lot of features to it. If you're interested in the code, let me know
and I'll clean it up a bit and make it available.

One thing you should consider when making a Frink bot is that Frink
is a Turing-complete programming language. A Frink interpreter normally
has the ability to read your filesystem, call arbitrary Java code,
execute infinite loops, allocate infinite amounts of memory, write
programs that cause your bot to produce lots of output and get itself
banned from IRC channels for "flooding", and do other things which may
compromise your security. (By the way, this is not a problem unique to
Frink; even your web browser has these issues. It's trivial to write
JavaScript that performs infinite loops, allocates more memory than you
have, opens tons of windows, etc.) That's why Frink has its own
security manager framework, which prevents insecure operations from
being performed on your system, but you have to enable that security
manager, which is not well-documented. I'll have to improve that.

Think about: what if someone executes:
read["file:///etc/passwd"]

Having a good security manager is the reason that I can allow people
to type in arbitrary Frink programs in my web interface and execute them
on my computer.

I'll write more about this later if there's interest.

--
Alan Eliasen | "Furious activity is no substitute
eliasen@... | for understanding."
http://futureboy.us/ | --H.H. Williams



Sat Sep 6, 2008 6:04 pm

aeliasen
Offline Offline
Send Email Send Email

Forward
Message #221 of 257 |
Expand Messages Author Sort by Date

I've been wanting to use frink for doing calculations internally in a program and I'm wondering if there is a supported way to do this? (its for an IRC bot)....
Ryan Voots
simcop2387
Offline Send Email
Sep 6, 2008
8:49 am

... Yes, there is a way to embed Frink into a Java program. The section of the documentation entitled "Embedding Frink" is a good place to start: ...
Alan Eliasen
aeliasen
Offline Send Email
Sep 6, 2008
6:04 pm

... section ... I don't know how i've overlooked that all of last night. ... people ... them ... I would certainly be interested in any documentation on this,...
Ryan Voots
simcop2387
Offline Send Email
Sep 7, 2008
7:36 am

... I've added a single convenience method to easily enable the most restrictive security measures on a Frink interpreter. This should be called before...
Alan Eliasen
aeliasen
Offline Send Email
Sep 8, 2008
4:59 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help