Skip to content

Commit ca3d35a

Browse files
committed
Some PEP8 related style cleaning
1 parent 6cfa9cb commit ca3d35a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+176
-172
lines changed

extra/shutils/pylint.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def check(module):
1818
if module[-3:] == ".py":
1919

2020
print "CHECKING ", module
21-
pout = os.popen('pylint --rcfile=/dev/null %s'% module, 'r')
21+
pout = os.popen("pylint --rcfile=/dev/null %s" % module, 'r')
2222
for line in pout:
2323
if re.match("E....:.", line):
2424
print line
2525
if __RATING__ and "Your code has been rated at" in line:
26-
print line
27-
score = re.findall("\d.\d\d", line)[0]
28-
total += float(score)
29-
count += 1
26+
print line
27+
score = re.findall("\d.\d\d", line)[0]
28+
total += float(score)
29+
count += 1
3030

3131
if __name__ == "__main__":
3232
try:
@@ -46,5 +46,5 @@ def check(module):
4646

4747
if __RATING__:
4848
print "==" * 50
49-
print "%d modules found"% count
50-
print "AVERAGE SCORE = %.02f"% (total / count)
49+
print "%d modules found" % count
50+
print "AVERAGE SCORE = %.02f" % (total / count)

extra/sqlharvest/sqlharvest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
TABLES_FILE = 'tables.txt'
2121
USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; AskTB5.3)'
2222
SEARCH_URL = 'http://www.google.com/m?source=mobileproducts&dc=gorganic'
23-
MAX_FILE_SIZE = 2 * 1024 * 1024 # if a result (.sql) file for downloading is more than 2MB in size just skip it
23+
MAX_FILE_SIZE = 2 * 1024 * 1024 # if a result (.sql) file for downloading is more than 2MB in size just skip it
2424
QUERY = 'CREATE TABLE ext:sql'
2525
REGEX_URLS = r';u=([^"]+?)&q='
2626
REGEX_RESULT = r'(?i)CREATE TABLE\s*(/\*.*\*/)?\s*(IF NOT EXISTS)?\s*(?P<result>[^\(;]+)'
@@ -33,7 +33,7 @@ def main():
3333
opener.addheaders = [("User-Agent", USER_AGENT)]
3434

3535
conn = opener.open(SEARCH_URL)
36-
page = conn.read() #set initial cookie values
36+
page = conn.read() # set initial cookie values
3737

3838
config = ConfigParser.ConfigParser()
3939
config.read(CONFIG_FILE)
@@ -82,7 +82,7 @@ def main():
8282
break
8383

8484
sys.stdout.write("\n---------------\n")
85-
sys.stdout.write("Result page #%d\n" % (i+1))
85+
sys.stdout.write("Result page #%d\n" % (i + 1))
8686
sys.stdout.write("---------------\n")
8787

8888
for sqlfile in files:

lib/controller/controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def start():
319319
elif conf.method == HTTPMETHOD.GET:
320320
if targetUrl.find("?") > -1:
321321
firstPart = targetUrl[:targetUrl.find("?")]
322-
secondPart = targetUrl[targetUrl.find("?")+1:]
322+
secondPart = targetUrl[targetUrl.find("?") + 1:]
323323
message = "Edit GET data [default: %s]: " % secondPart
324324
test = readInput(message, default=secondPart)
325325
test = _randomFillBlankFields(test)
@@ -603,7 +603,7 @@ def start():
603603
showHttpErrorCodes()
604604

605605
if kb.maxConnectionsFlag:
606-
warnMsg = "it appears that the target "
606+
warnMsg = "it appears that the target "
607607
warnMsg += "has a maximum connections "
608608
warnMsg += "constraint"
609609
logger.warn(warnMsg)
@@ -612,8 +612,9 @@ def start():
612612
logger.info("fetched data logged to text files under '%s'" % conf.outputPath)
613613

614614
if conf.multipleTargets and conf.resultsFilename:
615-
infoMsg = "you can find results of scanning in multiple targets "
615+
infoMsg = "you can find results of scanning in multiple targets "
616616
infoMsg += "mode inside the CSV file '%s'" % conf.resultsFilename
617617
logger.info(infoMsg)
618618

619619
return True
620+

lib/core/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,15 +758,15 @@ def limitQuery(self, num, query, field=None, uniqueField=None):
758758
limitStr = queries[Backend.getIdentifiedDbms()].limit.query
759759
fromIndex = limitedQuery.index(" FROM ")
760760
untilFrom = limitedQuery[:fromIndex]
761-
fromFrom = limitedQuery[fromIndex+1:]
761+
fromFrom = limitedQuery[fromIndex + 1:]
762762
orderBy = False
763763

764764
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.SQLITE):
765765
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num, 1)
766766
limitedQuery += " %s" % limitStr
767767

768768
elif Backend.isDbms(DBMS.FIREBIRD):
769-
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num+1, num+1)
769+
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num + 1, num + 1)
770770
limitedQuery += " %s" % limitStr
771771

772772
elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):

lib/core/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def paramToDict(place, parameters=None):
560560
elif len(conf.testParameter) != len(testableParameters.keys()):
561561
for parameter in conf.testParameter:
562562
if parameter not in testableParameters:
563-
warnMsg = "provided parameter '%s' " % parameter
563+
warnMsg = "provided parameter '%s' " % parameter
564564
warnMsg += "is not inside the %s" % place
565565
logger.warn(warnMsg)
566566

@@ -1489,7 +1489,7 @@ def getConsoleWidth(default=80):
14891489
if os.getenv("COLUMNS", "").isdigit():
14901490
width = int(os.getenv("COLUMNS"))
14911491
else:
1492-
output=execute('stty size', shell=True, stdout=PIPE, stderr=PIPE).stdout.read()
1492+
output = execute("stty size", shell=True, stdout=PIPE, stderr=PIPE).stdout.read()
14931493
items = output.split()
14941494

14951495
if len(items) == 2 and items[1].isdigit():

lib/core/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def md5hash(value):
5454
return md5.new(value).hexdigest()
5555

5656
def orddecode(value):
57-
packedString = struct.pack("!"+"I" * len(value), *value)
58-
return "".join(chr(char) for char in struct.unpack("!"+"I"*(len(packedString)/4), packedString))
57+
packedString = struct.pack("!" + "I" * len(value), *value)
58+
return "".join(chr(char) for char in struct.unpack("!" + "I" * (len(packedString) / 4), packedString))
5959

6060
def ordencode(value):
6161
return tuple(ord(char) for char in value)

lib/core/defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from lib.core.datatype import AttribDict
99

10-
_defaults = {
10+
_defaults = {
1111
"csvDel": ",",
1212
"timeSec": 5,
1313
"googlePage": 1,
@@ -23,6 +23,6 @@
2323
"dumpFormat": "CSV",
2424
"tech": "BEUSTQ",
2525
"torType": "HTTP"
26-
}
26+
}
2727

2828
defaults = AttribDict(_defaults)

lib/core/dicts.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,38 +69,38 @@
6969
}
7070

7171
MYSQL_PRIVS = {
72-
1:"select_priv",
73-
2:"insert_priv",
74-
3:"update_priv",
75-
4:"delete_priv",
76-
5:"create_priv",
77-
6:"drop_priv",
78-
7:"reload_priv",
79-
8:"shutdown_priv",
80-
9:"process_priv",
81-
10:"file_priv",
82-
11:"grant_priv",
83-
12:"references_priv",
84-
13:"index_priv",
85-
14:"alter_priv",
86-
15:"show_db_priv",
87-
16:"super_priv",
88-
17:"create_tmp_table_priv",
89-
18:"lock_tables_priv",
90-
19:"execute_priv",
91-
20:"repl_slave_priv",
92-
21:"repl_client_priv",
93-
22:"create_view_priv",
94-
23:"show_view_priv",
95-
24:"create_routine_priv",
96-
25:"alter_routine_priv",
97-
26:"create_user_priv",
72+
1: "select_priv",
73+
2: "insert_priv",
74+
3: "update_priv",
75+
4: "delete_priv",
76+
5: "create_priv",
77+
6: "drop_priv",
78+
7: "reload_priv",
79+
8: "shutdown_priv",
80+
9: "process_priv",
81+
10: "file_priv",
82+
11: "grant_priv",
83+
12: "references_priv",
84+
13: "index_priv",
85+
14: "alter_priv",
86+
15: "show_db_priv",
87+
16: "super_priv",
88+
17: "create_tmp_table_priv",
89+
18: "lock_tables_priv",
90+
19: "execute_priv",
91+
20: "repl_slave_priv",
92+
21: "repl_client_priv",
93+
22: "create_view_priv",
94+
23: "show_view_priv",
95+
24: "create_routine_priv",
96+
25: "alter_routine_priv",
97+
26: "create_user_priv",
9898
}
9999

100100
PGSQL_PRIVS = {
101-
1:"createdb",
102-
2:"super",
103-
3:"catupd",
101+
1: "createdb",
102+
2: "super",
103+
3: "catupd",
104104
}
105105

106106
FIREBIRD_PRIVS = {

lib/core/dump.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,27 +117,27 @@ def lister(self, header, elements, sort=True):
117117
if elements:
118118
self._write("")
119119

120-
def banner(self,data):
120+
def banner(self, data):
121121
self.string("banner", data)
122122

123-
def currentUser(self,data):
123+
def currentUser(self, data):
124124
self.string("current user", data)
125125

126-
def currentDb(self,data):
126+
def currentDb(self, data):
127127
if Backend.isDbms(DBMS.MAXDB):
128128
self.string("current database (no practical usage on %s)" % Backend.getIdentifiedDbms(), data)
129129
elif Backend.isDbms(DBMS.ORACLE):
130130
self.string("current schema (equivalent to database on %s)" % Backend.getIdentifiedDbms(), data)
131131
else:
132132
self.string("current database", data)
133133

134-
def hostname(self,data):
134+
def hostname(self, data):
135135
self.string("hostname", data)
136136

137-
def dba(self,data):
137+
def dba(self, data):
138138
self.string("current user is DBA", data)
139139

140-
def users(self,users):
140+
def users(self, users):
141141
self.lister("database management system users", users)
142142

143143
def userSettings(self, header, userSettings, subHeader):
@@ -174,7 +174,7 @@ def userSettings(self, header, userSettings, subHeader):
174174

175175
self.singleString("")
176176

177-
def dbs(self,dbs):
177+
def dbs(self, dbs):
178178
self.lister("available databases", dbs)
179179

180180
def dbTables(self, dbTables):

lib/core/option.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _parseBurpLog(content):
272272
index = 5
273273

274274
url = line[index:line.index(" HTTP/")]
275-
method = line[:index-1]
275+
method = line[:index - 1]
276276

277277
if "?" in line and "=" in line:
278278
params = True
@@ -587,7 +587,7 @@ def _findPageForms():
587587
for i in xrange(len(targets)):
588588
try:
589589
target = targets[i]
590-
page, _, _= Request.getPage(url=target.strip(), crawling=True, raise404=False)
590+
page, _, _ = Request.getPage(url=target.strip(), crawling=True, raise404=False)
591591
findPageForms(page, target, False, True)
592592

593593
if conf.verbose in (1, 2):
@@ -942,7 +942,7 @@ def _setHTTPProxy():
942942
try:
943943
port = int(hostnamePort[1])
944944
except:
945-
pass #drops into the next check block
945+
pass # drops into the next check block
946946

947947
if not all((scheme, hasattr(PROXY_TYPE, scheme), hostname, port)):
948948
errMsg = "proxy value must be in format '(%s)://url:port'" % "|".join(_[0].lower() for _ in getPublicTypeMembers(PROXY_TYPE))
@@ -1373,8 +1373,9 @@ def _cleanupOptions():
13731373
conf.data = re.sub(INJECT_HERE_MARK.replace(" ", r"[^A-Za-z]*"), CUSTOM_INJECTION_MARK_CHAR, conf.data, re.I)
13741374

13751375
if re.search(r'%[0-9a-f]{2}', conf.data, re.I):
1376+
class _(unicode):
1377+
pass
13761378
original = conf.data
1377-
class _(unicode): pass
13781379
conf.data = _(urldecode(conf.data))
13791380
setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
13801381
else:
@@ -1409,7 +1410,7 @@ class _(unicode): pass
14091410
conf.code = int(conf.code)
14101411

14111412
if conf.csvDel:
1412-
conf.csvDel = conf.csvDel.decode("string_escape") # e.g. '\\t' -> '\t'
1413+
conf.csvDel = conf.csvDel.decode("string_escape") # e.g. '\\t' -> '\t'
14131414

14141415
if conf.torPort and conf.torPort.isdigit():
14151416
conf.torPort = int(conf.torPort)
@@ -1504,7 +1505,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
15041505
kb.authHeader = None
15051506
kb.bannerFp = AttribDict()
15061507

1507-
kb.brute = AttribDict({"tables":[], "columns":[]})
1508+
kb.brute = AttribDict({"tables": [], "columns": []})
15081509
kb.bruteMode = False
15091510

15101511
kb.cache = AttribDict()
@@ -1592,7 +1593,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
15921593
kb.redirectChoice = None
15931594
kb.redirectSetCookie = None
15941595
kb.reflectiveMechanism = True
1595-
kb.reflectiveCounters = {REFLECTIVE_COUNTER.MISS:0, REFLECTIVE_COUNTER.HIT:0}
1596+
kb.reflectiveCounters = {REFLECTIVE_COUNTER.MISS: 0, REFLECTIVE_COUNTER.HIT: 0}
15961597
kb.responseTimes = []
15971598
kb.resumeValues = True
15981599
kb.safeCharEncode = False

0 commit comments

Comments
 (0)