You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-analyzer/w3af/files/use_simplejson_instead_of_j...

106 lines
3.5 KiB

--- ./core/controllers/misc/dependencyCheck.py.old 2010-10-19 09:58:19.000000000 +0200
+++ ./core/controllers/misc/dependencyCheck.py 2010-10-19 09:58:32.000000000 +0200
@@ -95,15 +95,6 @@
except:
print 'You have to install pyPdf lib. Debian based distributions: apt-get install python-pypdf'
sys.exit( 1 )
-
- try:
- from extlib.jsonpy import json as json
- except:
- try:
- import json
- except:
- print 'You have to install python-json lib. Debian based distributions: apt-get install python-json'
- sys.exit( 1 )
try:
from OpenSSL import SSL
--- core/data/fuzzer/fuzzer.py.old 2010-10-19 10:00:59.000000000 +0200
+++ core/data/fuzzer/fuzzer.py 2010-10-19 10:02:14.000000000 +0200
@@ -38,9 +38,9 @@
from core.data.dc.cookie import cookie as cookie
from core.data.dc.dataContainer import dataContainer as dc
try:
- from extlib.jsonpy import json as json
+ import extlib.simplejson as json
except:
- import json
+ import simplejson as json
from core.data.request.httpPostDataRequest import httpPostDataRequest
from core.data.request.httpQsRequest import httpQsRequest
@@ -210,7 +210,7 @@
# Now, fuzz the parsed JSON data...
postdata = freq.getData()
- jsonPostData = json.read( postdata )
+ jsonPostData = json.loads( postdata )
return _makeMutants( freq, mutantClass, mutant_str_list, fuzzableParamList , append, jsonPostData )
def isJSON( freq ):
@@ -222,7 +222,7 @@
# We have something that's not URL encoded in the postdata, it could be something
# like JSON, XML, or multipart encoding. Let's try with JSON
try:
- jsonPostData = json.read( postdata )
+ jsonPostData = json.loads( postdata )
except:
# It's not json, maybe XML or multipart, I don't really care ( at least not in this section of the code )
return False
--- core/data/request/frFactory.py.old 2010-10-19 10:03:50.000000000 +0200
+++ core/data/request/frFactory.py 2010-10-19 10:04:38.000000000 +0200
@@ -37,9 +37,9 @@
# for json
try:
- from extlib.jsonpy import json as json
+ import extlib.simplejson as json
except:
- import json
+ import simplejson as json
from core.controllers.w3afException import w3afException
import core.controllers.outputManager as om
@@ -200,7 +200,7 @@
# Case #2, JSON request
#
try:
- dc = json.read( postData )
+ dc = json.loads( postData )
except:
pass
else:
--- core/data/request/jsonPostDataRequest.py.old 2010-10-19 10:12:22.000000000 +0200
+++ core/data/request/jsonPostDataRequest.py 2010-10-19 10:15:05.000000000 +0200
@@ -25,9 +25,9 @@
from core.data.request.httpPostDataRequest import httpPostDataRequest
import core.data.dc.dataContainer as dc
try:
- from extlib.jsonpy import json as json
+ import extlib.simplejson as json
except:
- import json
+ import simplejson
class jsonPostDataRequest(httpPostDataRequest):
'''
@@ -43,7 +43,7 @@
'''
@return: A string that represents the JSON data saved in the dc.
'''
- res = json.write(self._dc)
+ res = json.dumps(self._dc)
return res
def __str__( self ):
@@ -54,7 +54,7 @@
strRes += self._url
strRes += ' | Method: ' + self._method
strRes += ' | JSON: ('
- strRes += json.write(self._dc)
+ strRes += json.dumps(self._dc)
strRes += ')'
return strRes