Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/extra/shutils/newlines.py
2992 views
1
#! /usr/bin/env python
2
3
from __future__ import print_function
4
5
import os
6
import sys
7
8
def check(filepath):
9
if filepath.endswith(".py"):
10
content = open(filepath, "rb").read()
11
pattern = "\n\n\n".encode("ascii")
12
13
if pattern in content:
14
index = content.find(pattern)
15
print(filepath, repr(content[index - 30:index + 30]))
16
17
if __name__ == "__main__":
18
try:
19
BASE_DIRECTORY = sys.argv[1]
20
except IndexError:
21
print("no directory specified, defaulting to current working directory")
22
BASE_DIRECTORY = os.getcwd()
23
24
print("looking for *.py scripts in subdirectories of '%s'" % BASE_DIRECTORY)
25
for root, dirs, files in os.walk(BASE_DIRECTORY):
26
if any(_ in root for _ in ("extra", "thirdparty")):
27
continue
28
for name in files:
29
filepath = os.path.join(root, name)
30
check(filepath)
31
32