Using python from a browser

P

Philippe C. Martin

Hi,

I have a python script I wish to call from various browsers (IE; Mozilla,
Firefox ..) on Windows & Linux.


I read that IE had the capability to embedd Python scripts, but what about the
others ?

Regards,

Philippe



--
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************
 
D

Do Re Mi chel La Si Do

Hi !

I confirm for IE. Others, I don't know.

@-salutations

Michel Claveau
 
B

Bruno Desthuilliers

Philippe C. Martin a écrit :
Hi,

I have a python script I wish to call from various browsers (IE; Mozilla,
Firefox ..) on Windows & Linux.

What do you mean ? Is that a client-side or server-side script ?
I read that IE had the capability to embedd Python scripts,

Where ?
 
P

Philippe C. Martin

Hi,

Client side

Programming Python - O'Reilly - 2nd edition - by Mark Lutz - Paragraph
"Teaching IE about Python" - Pages 922-925

Regards,

Philippe
 
N

Neil Hodgson

Philippe:
I read that IE had the capability to embedd Python scripts, but what
about the others ?

While Python can be set up as a scripting language for IE, this is
normally disabled as it could be a security hole. The open call is
available from Python scripts so a web site could read or destroy your
files.

Neil
 
P

Philippe C. Martin

Since I need to access a local/client device from the page and that I wish
to be cross-platform; does that mean Java is my only way out ?

Regards,

Philippe
 
N

Neil Hodgson

Philippe:
Since I need to access a local/client device from the page and
that I wish to be cross-platform; does that mean Java is my only
way out ?

Java is designed to be safe and not allow access to client devices.
There is a mechanism where you can attempt to ask for permission from
Java but it looked complex to me and I doubt many browsers will
cooperate. They have often locked security down to prevent this sort of
access.

Neil
 
P

Philippe C. Martin

Neil,

Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?

Thanks

Philippe
 
J

James Carroll

I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim
 
P

Philippe C. Martin

Thanks Jim,

From all I hear, it looks like the client authentication will have tobe made
"on the side of the browser", between the server and a specific program
running on the client. Not as nice but ....

Regards,

Philippe




I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim

--
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************
 
M

Marcus Goldfish

I read that IE had the capability to embedd Python scripts, but what
While Python can be set up as a scripting language for IE, this is
normally disabled as it could be a security hole. The open call is
available from Python scripts so a web site could read or destroy your
files.

Slightly off-topic, it is possible to use browser helper objects
(bhos) with Internet Explorer:

http://starship.python.net/crew/theller/moin.cgi/CtypesLinks

Marcus
 
B

Bengt Richter

I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim
I wonder if anyone has written a safe proxy for this kind of purpose,
so that any browser would see just ordinary html at a particular url
but would then be viewing html either passed through from a particular
server or synthesized for for the local access part, which it could
do arbitrarily, depending on its user/privilege status.

[BTW, note reason why top-posts scramble things eventually. Please reconsider ;-)]
See comment above.

Regards,
Bengt Richter
 
N

Neil Hodgson

Philippe:
Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?

Not without asking for more permissions than accessing the device as
being able to execute arbitrary code is very dangerous. Think of this
from the point of view of someone trying to stop malicious code from
executing because of visiting a web page. There are various ways to
install code that can be called from web pages such as installing COM
objects or writing browser extensions but you will have to get the user
to allow these and they may not have permission to do so. Often they
won't know how to allow this so you will have to write up detailed
instructions after exploring the area thoroughly yourself.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top