473,770 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

win32: structured storage

hello,

In honor of the chm exploit that I got hit by last week, I trying
to code some ActivePython to list the directory inside a CHM.

CHM is supposed to be structured storage (ITSF). If a given CHM
file is infected it most likely has an embedded EXE file -- mine
had one called [Open.exe].

The following code works for Excell sheets, XLS, but fails for
CHM files.

# begin python
from win32com import storagecon as sc
import os, win32api
import pythoncom as pyc
from pywintypes import IID

its_clsid = IID('{5d02926a-212e-11d0-9df9-00a0c922e6ec}')
its_iid= IID('{88cc31de-27ab-11d0-9df9-00a0c922e6ec}')
#
pyc.CoInitializ e()

# commented out after failing on my Win2k box
#pyc.CoCreateIn stance( its_clsid,None, pyc.CLSCTX_INPR OC_SERVER, its_iid)
m = sc.STGM_READ | sc.STGM_SHARE_E XCLUSIVE

# quarantined CHM virus
fname = "e:/batch/junkx.chm"
#fname = "C:/Documents and Settings/Administrator/My Documents/02_taxes.xls"
pss = pyc.StgOpenStor ageEx( fname, m, sc.STGFMT_STORA GE,0, pyc.IID_IStorag e)

ele = pss.EnumElement s( 0, None,0)
obj = ele.next()
print obj[0]
obj = ele.next()
print obj[0]
# end python

with the XLS file, I get the names of the two sheets.
Is there another way to parse the central directory out of
a CHM file?

tia,
tlviewer
Jul 19 '05 #1
5 2630
tlviewer wrote:
hello,

In honor of the chm exploit that I got hit by last week, I trying
to code some ActivePython to list the directory inside a CHM.
Welcome to the world of the "drive-by download". Now you know why people
are recommending migrating away from IE.
CHM is supposed to be structured storage (ITSF). If a given CHM
file is infected it most likely has an embedded EXE file -- mine
had one called [Open.exe].

Ironic, really, since Microsoft insist that the browser must be
fully-integrated with the operating system I suppose that measn we had
better all start using Linux.

regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/

Jul 19 '05 #2
tlviewer wrote:
Is there another way to parse the central directory out of
a CHM file?


google("chmlib python")

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Jul 19 '05 #3
Steve Holden wrote:
tlviewer wrote:
> CHM is supposed to be structured storage (ITSF). If a given CHM
> file is infected it most likely has an embedded EXE file -- mine
> had one called [Open.exe].
>

Ironic, really, since Microsoft insist that the browser must be
fully-integrated with the operating system I suppose that measn we had
better all start using Linux.


Even more ironically, it would seem that in effort to kill Netscape they
are killing Windows.
Jul 19 '05 #4
Dave Benjamin wrote:
Steve Holden wrote:
tlviewer wrote:
> CHM is supposed to be structured storage (ITSF). If a given CHM
> file is infected it most likely has an embedded EXE file -- mine
> had one called [Open.exe].
>

Ironic, really, since Microsoft insist that the browser must be
fully-integrated with the operating system I suppose that measn we had
better all start using Linux.


Even more ironically, it would seem that in effort to kill Netscape they
are killing Windows.


Or perhaps I'm just restating your point. ;)
Jul 19 '05 #5

"Robert Kern" <rk***@ucsd.edu > wrote in message news:ma******** *************** **************@ python.org...
tlviewer wrote:
Is there another way to parse the central directory out of
a CHM file?


google("chmlib python")


Anyone know the calling syntax for the functions?

PythonWin 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond
(mh******@skipp inet.com.au) - see 'Help/About PythonWin' for further copyright information.
import os, sys
import pychm._chmlib as chm
obj=chm.chm_ope n('e:/batch/AdvCrypto')
obj
chm.chm_open('e :/batch/AdvCrypto')
chm <module 'pychm._chmlib' from 'E:\Python23\Li b\site-packages\pychm\ _chmlib.pyd'> enm=chm.chm_enu merate() Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
TypeError: chm_enumerate() takes exactly 4 arguments (0 given) chm.chm_enumera te(obj)


I doubt if the build is good ...

regards,
tlviewer

Jul 19 '05 #6

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

Similar topics

3
457
by: Edmond Neo | last post by:
I use structured storage to store large amounts of data in various streams. I realize that I can call structured storage through a wrapper in .NET, but I'm concerned that there is a performance issue if large amounts of data are passed through the wrapper Does anyone know what is the peformance penalty of writing streams via a wrapper to the Structured Storage COM object? Does .NET intend to support Structured Storage natively instead of...
1
5462
by: Intaek LIM | last post by:
hi guys. i just got a library for generating packets. but, i can't compile the example source because of bad include path. ------------------------------------------------------------------------ D:\libnet\sample>gcc tcp1.c In file included from tcp1.c:36: libnet_test.h:12:31: ../include/libnet.h: No such file or directory In file included from tcp1.c:36: libnet_test.h:24: parse error before "enet_src"
4
7315
by: David Groves | last post by:
Are there any plans to incorporate a native C# facility to deal with the OLE Structured Storage concept? It's clumsy at best to have to construct a C++ interface to the .doc files (or any such files by any suffix), when Microsoft uses the concept in most, if not all, of their other products. "Just how hard could it be?" he asks, knowing that 'hard' is a relative concept. -- David Groves Thermo Finnigan--AID
10
5654
by: Dave | last post by:
Has anyone out there managed to create a structured storage file using pure VB.Net? Specifically; with the API function StgCreateStorageEx? If so, could you post a working example here please. One that can be pasted into a VB.Net project and run. Thanks Dave
1
1377
by: Gerald Hernandez | last post by:
The .NET Framework is huge, and either this isn't in there, or I'm just missing it... Are there any built-in methods to work with OLE2 Structured Storage files? Or am I stuck with using COM Interop? TIA Gerald
3
9005
by: Dwight | last post by:
I need to be able to read and create Structured Storage Files. I have not been able to find anything about this except for C++, which I do not know. currently i'm using a DOC viewer (eDoc) just to view them. But I need to do this programatically. Could anyone point me to a place where I can find info on how to achieve this? Sybari has content filter lists that are stored in DOC files and I need to be able to manage them.
2
2660
by: ERE | last post by:
I'd like to encapsulate several files -- mostly graphics files -- as a single file. Does .NET provide a convenient way to do this? COM provided structured storage -- but I definitely don't want to go there! Thanks, Dan
3
1279
by: Gregory Gadow | last post by:
Is there a way to create structured files in .NET 2.0? Essentially, I want to take a hierarchic web site and convert it to a single, navigatable file similar to the compiled help, but using my own extention and not the standard .chm. -- Gregory Gadow
0
1826
by: John Levin | last post by:
I'm trying to port Edanmo's OLE Storage class (http://www.mvps.org/emorcillo/en/code/grl/storage.shtml) to x64. After my modifications, it still works fine under x86. However, I'm getting a mysterious error when I try to call ReadMultiple on my IPropertyStorage object under x64: "No mapping for the Unicode character exists in the target multi-byte code page. (Exception from HRESULT: 0x80070459)". Here's the calling code: Dim PROP As...
0
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.