Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88010

Re: Basic Python V3 Search Tool using RE module

Date 2015-03-25 21:20 -0400
From Dave Angel <davea@davea.name>
Subject Re: Basic Python V3 Search Tool using RE module
References <b8b86122-0653-42eb-b9d9-2ba0f45f30f9@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.174.1427332859.10327.python-list@python.org> (permalink)

Show all headers | View raw


On 03/25/2015 03:43 PM, Gregg Dotoli wrote:
>
> This basic script will help to find
> evidence of CryptoWall on a slave drive. Although it is
> just a string, more complex regex patterns can be
> replaced with the string. It is incredible how fast Python is and
> how easy it has helped in quickly assessing a pool of slave drives.
> I'm improving it as we speak.
>
>
> Thanks for your help and patience. I'm new with Python.
>
>
> import os
> import re
> # From the Root
> topdir = "."
>
> # Regex Pattern
> pattern="DECRYPT_I"
> regexp=re.compile(pattern)
> for dirpath,dirnames, files in os.walk(topdir):
>      for name in files:
>              result=regexp.search(name)
>              print(os.path.join(dirpath,name))
>              print (result)

Any reason you started a new thread?

And I thought (from the other thread) that you were trying to search the 
contents of the files.  Right now you're just looking for a file name 
containing the pattern.

That could explain why it's so fast.

-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Basic Python V3  Search Tool using RE module Gregg Dotoli <gdotoli@gmail.com> - 2015-03-25 12:43 -0700
  Re: Basic Python V3  Search Tool using RE module Dave Angel <davea@davea.name> - 2015-03-25 21:20 -0400
  Re: Basic Python V3  Search Tool using RE module Tim Chase <python.list@tim.thechases.com> - 2015-03-25 20:29 -0500
  Re: Basic Python V3  Search Tool using RE module CHIN Dihedral <dihedral88888@gmail.com> - 2015-03-26 06:01 -0700
  Re: Basic Python V3  Search Tool using RE module Gregg Dotoli <gdotoli@gmail.com> - 2015-03-26 10:11 -0700
    Re: Basic Python V3  Search Tool using RE module Dave Angel <davea@davea.name> - 2015-03-26 13:23 -0400
    Re: Basic Python V3  Search Tool using RE module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-27 10:01 +1100

csiph-web