Python lesson please
Peter Otten
__peter__ at web.de
Mon Nov 7 04:00:02 EST 2011
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
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 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
On Ubuntu (and probably any other Debian-based distro) you'll find a version
of that in
/usr/share/doc/python2.6/examples/Tools/scripts/reindent.py
or similar once you've installed the python-examples package.
More information about the Python-list
mailing list