Python lesson please

gene heskett gheskett at wdtv.com
Mon Nov 7 06:22:39 EST 2011


On Monday, November 07, 2011 05:35:15 AM Peter Otten did opine:

> gene heskett wrote:
> > Greetings experts:
> > 
> > I just dl'd the duqu driver finder script from a link to NSS on /.,
> > and fixed enough of the tabs in it to make it run error-free.  At
> > least python isn't having a litter of cows over the indentation now.
> > 
> > But it also runs instantly on linux.
> > 
> > This line looks suspect to me:
> >  rootdir = sys.argv[1]
> > 
> > And I have a suspicion it is null on a linux box.
> > 
> > How can I fix that best?
> 
> Are you talking about this one?
> 
> https://github.com/halsten/Duqu-detectors/blob/master/DuquDriverPatterns
> .py
 
Yes.  My save as renamed it, still has about 30k of tabs in it.  But I 
pulled it again, using the 'raw' link, saved it, no extra tabs.

But it still doesn't work for linux.  My python is 2.6.6

> With a current checkout I don't get any tab-related (nor other) errors,
> so I would prefer to run the script as-is. Also, the  README clearly
> states that you have to invoke it with
> 
> python DuquDriverPatterns.py ./directoryOfMalware
> 
> and the line you are quoting then puts the value "./directoryOfMalware"
> into the rootdir variable.

If only it would...  Using this version, the failure is silent and instant.  
Besides, the malware could be anyplace on the system.  But it needs to skip 
/dev since it hangs on the midi tree, /mnt and /media because they are not 
part of the running system even if disks are mounted there.
 
> If you want to normalize the code to 4-space indents I recomment that
> you use
> 
> http://hg.python.org/cpython/file/bbc929bc2224/Tools/scripts/reindent.py
 
Got it, where does it normally live? I apparently have a python-2.6.6 
install.

> On Ubuntu (and probably any other Debian-based distro) you'll find a
> version of that in
> 
PCLos is rpm based, lots of mandriva stuff in it.

> /usr/share/doc/python2.6/examples/Tools/scripts/reindent.py
>
Path does not exist.  Ends at /usr/share/doc
from there I have:
gene at coyote doc]$ ls|grep python
gimp-python-2.6.11/
gnome-python-gconf-2.28.1/
gnome-python-gnomeprint-2.32.0/
gnome-python-gtksourceview-2.32.0/
libxml2-python-2.7.8/
python-2.6.6/
python3-3.2.1/
python3-docs-3.2.1/
python-cairo-1.10.0/
python-configobj-4.7.2/
python-decorator-3.3.1/
python-docs-2.6.6/
python-enchant-1.5.3/
python-gobject-2.28.6/
python-gpgme-0.1/
python-gtksourceview-2.10.0/
python-libxml2dom-0.4.7/
python-lxml-2.2.8/
python-markupsafe-0.9.3/
python-notify-0.1.1/
python-paramiko-1.7.6/
python-paste-1.7.4/
python-pkg-resources-0.6c11/
python-psyco-1.6/
python-pybluez-0.18/
python-pycrypto-2.3/
python-pygments-1.3.1/
python-pytools-2011.3/
python-pyxml-0.8.4/
python-rhpl-0.212/
python-sexy-0.1.9/
python-simpletal-4.2/
python-sympy-0.6.7/
python-utmp-0.8/

The python-2.6.6 and 3.2.1 directories only contain a README.mdv

> or similar once you've installed the python-examples package.

On PCLos it doesn't even exist in the repo's.

Good links, thank you.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene>
"Elvis is my copilot."
-- Cal Keegan



More information about the Python-list mailing list