473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

python/cgi/html bug

Hi.

I've written a cgi messageboard script in python, for an irc chan I happen
to frequent.

Bear with me, it's hard for me to describe what the bug is. So I've
divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE
BUG IS.

HOW MY SCRIPT WORKS

Basically, it's divided into two executable scripts......

One is the thread viewer, ppthread.py, which views threads. When someone
posts a new topic, for instance called "Generic new topic", it creates
a file called "Generic new topic.thread". It stores the post, and any
subsequent posts under in the thread in that file. Nice and simple I
figured.

The other executable script is the topic viewer, pptopic.py. All that does
is display the topics, by doing a "tops = os.popen('ls -c *.thread')" The
"ls -c" part reads the threads in the order in which they've been
modified, so the first item in the list is always the thread most recently
posted in.

It then creates an html link to each of the threads ... on the page the
html looks like....

<a href = ppthread.py?subject=foo>foo</a><br>

WHAT THE BUG IS ....

The problem is when someone posts a new topic, and that topic happens to
have "" double quotes, or any other strange character, some strange
glitches occur.

Best way to describe is to demonstrate it is go to the forum and try
it yourself. Try entering a topic with straight, ordindary characters, not
that you can re enter the thread any time you want and make new posts
under it. Then try entering a thread with new or whacky characters and see
how far you get.

http://funkmunch.net/~pirch/cgi-bin/...rum/pptopic.py

BTW, if you want to download the script, here it is in gzipped form
http://funkmunch.net/~pirch/pepperpot.tgz

Jul 18 '05 #1
6 1640

Dfenestr8 wrote:
Hi.

I've written a cgi messageboard script in python, for an irc chan I happen to frequent.

Bear with me, it's hard for me to describe what the bug is. So I've
divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE BUG IS.
...
The problem is when someone posts a new topic, and that topic happens to have "" double quotes, or any other strange character, some strange
glitches occur.


Use cgi.escape(topic, True) to convert HTML special characters to the
equivalent ampersand escape sequences.

Jul 18 '05 #2
On Tue, 18 Jan 2005 21:50:58 -0800, Dan Bishop wrote:

Dfenestr8 wrote:
Hi.

I've written a cgi messageboard script in python, for an irc chan I

happen
to frequent.

Bear with me, it's hard for me to describe what the bug is. So I've
divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT

THE
BUG IS.
...
The problem is when someone posts a new topic, and that topic happens

to
have "" double quotes, or any other strange character, some strange
glitches occur.


Use cgi.escape(topic, True) to convert HTML special characters to the
equivalent ampersand escape sequences.


Thanx.

Seems to work now. :)

Jul 18 '05 #3

Dfenestr8 wrote:
Hi.

I've written a cgi messageboard script in python, for an irc chan I happen to frequent.

This looks very good.
I've been looking for a python messageboard CGI for a long time.

If you wanted to add user accounts/login/admin etc. you could use
'Login Tools'. This is a python module built especially to do that. It
also provides a convenient way of saving user preferences etc.

http://www.voidspace.org.uk/python/logintools.html

If you want any help using it then feel free to ask.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml
Bear with me, it's hard for me to describe what the bug is. So I've
divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE BUG IS.

HOW MY SCRIPT WORKS

Basically, it's divided into two executable scripts......

One is the thread viewer, ppthread.py, which views threads. When someone posts a new topic, for instance called "Generic new topic", it creates a file called "Generic new topic.thread". It stores the post, and any
subsequent posts under in the thread in that file. Nice and simple I
figured.

The other executable script is the topic viewer, pptopic.py. All that does is display the topics, by doing a "tops = os.popen('ls -c *.thread')" The "ls -c" part reads the threads in the order in which they've been
modified, so the first item in the list is always the thread most recently posted in.

It then creates an html link to each of the threads ... on the page the html looks like....

<a href = ppthread.py?subject=foo>foo</a><br>

WHAT THE BUG IS ....

The problem is when someone posts a new topic, and that topic happens to have "" double quotes, or any other strange character, some strange
glitches occur.

Best way to describe is to demonstrate it is go to the forum and try
it yourself. Try entering a topic with straight, ordindary characters, not that you can re enter the thread any time you want and make new posts
under it. Then try entering a thread with new or whacky characters and see how far you get.

http://funkmunch.net/~pirch/cgi-bin/...rum/pptopic.py

BTW, if you want to download the script, here it is in gzipped form
http://funkmunch.net/~pirch/pepperpot.tgz


Jul 18 '05 #4
On Wed, 19 Jan 2005 04:32:04 -0800, Fuzzyman wrote:
This looks very good.
I've been looking for a python messageboard CGI for a long time.

Thanx!

No glaring security holes that you noticed? Other than being able to hide
things in html tags?
If you wanted to add user accounts/login/admin etc. you could use 'Login
Tools'. This is a python module built especially to do that. It also
provides a convenient way of saving user preferences etc.

http://www.voidspace.org.uk/python/logintools.html

If you want any help using it then feel free to ask.

Regards,


Jul 18 '05 #5
Dfenestr8 <ch**************@yahoo.com.au> writes:
No glaring security holes that you noticed? Other than being able to hide
things in html tags?


Looks like you can also embed arbitrary javascript (I just tried it).
I haven't looked at the script itself yet.
Jul 18 '05 #6
On Wed, 19 Jan 2005 12:15:18 -0800, Paul Rubin wrote:
Dfenestr8 <ch**************@yahoo.com.au> writes:
No glaring security holes that you noticed? Other than being able to
hide things in html tags?


Looks like you can also embed arbitrary javascript (I just tried it). I
haven't looked at the script itself yet.


fixed that.
try doing it now......

http://funkmunch.net/~pirch/cgi-bin/...rum/pptopic.py

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.