Hi maintainer,

as your package is the only one which uses python-json and we want to remove
python-json from Debian to stop the confusion resulting from the fact that json
from Python2.6 and python-json is not API compatible, please apply the attached
patch. Although the patch was not tested yet, I think it is fine.

Thanks,

Bernd

-- 
 Bernd Zeimetz                            Debian GNU/Linux Developer
 http://bzed.de                                http://www.debian.org
 GPG Fingerprints: 06C8 C9A2 EAAD E37E 5B2C BE93 067A AD04 C93B FF79
                   ECA1 E3F2 8E11 2432 D485 DD95 EB36 171A 6FF9 435F
>From 8008c5a45240a7ffcee753e5751b58c5be767fbc Mon Sep 17 00:00:00 2001
From: Bernd Zeimetz <[email protected]>
Date: Fri, 7 May 2010 15:43:01 +0200
Subject: [PATCH] Replace python-json by python-simplejson.

---
 core/controllers/misc/dependencyCheck.py |    6 +++---
 core/data/fuzzer/fuzzer.py               |    8 ++++----
 core/data/request/frFactory.py           |    6 +++---
 core/data/request/jsonPostDataRequest.py |    8 ++++----
 debian/changelog                         |    7 +++++++
 debian/control                           |    2 +-
 6 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/core/controllers/misc/dependencyCheck.py b/core/controllers/misc/dependencyCheck.py
index 001392e..2c0efc6 100644
--- a/core/controllers/misc/dependencyCheck.py
+++ b/core/controllers/misc/dependencyCheck.py
@@ -97,10 +97,10 @@ def dependencyCheck():
             sys.exit( 1 )
     
     try:
-        from extlib.jsonpy import json as json
-    except:
+        import json
+    except ImportError:
         try:
-            import json
+            import simplejson as json
         except:
             print 'You have to install python-json lib. Debian based distributions: apt-get install python-json'
             sys.exit( 1 )
diff --git a/core/data/fuzzer/fuzzer.py b/core/data/fuzzer/fuzzer.py
index 9a74005..5714d2c 100644
--- a/core/data/fuzzer/fuzzer.py
+++ b/core/data/fuzzer/fuzzer.py
@@ -38,9 +38,9 @@ from core.controllers.w3afException import w3afException
 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
-except:
     import json
+except ImportError:
+    import simplejson as json
 from core.data.request.httpPostDataRequest import httpPostDataRequest
 from core.data.request.httpQsRequest import httpQsRequest
 
@@ -210,7 +210,7 @@ def _createJSONMutants( freq, mutantClass, mutant_str_list, fuzzableParamList ,
     
     # 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 @@ def isJSON( freq ):
         # 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
diff --git a/core/data/request/frFactory.py b/core/data/request/frFactory.py
index 29c8a94..8f5b910 100644
--- a/core/data/request/frFactory.py
+++ b/core/data/request/frFactory.py
@@ -37,9 +37,9 @@ import cgi
 
 # for json
 try:
-    from extlib.jsonpy import json as json
-except:
     import json
+except importError:
+    import simplejson as json
 
 from core.controllers.w3afException import w3afException
 import core.controllers.outputManager as om
@@ -200,7 +200,7 @@ def createFuzzableRequestRaw( method, url, postData, headers ):
         #   Case #2, JSON request
         #
         try:
-            dc = json.read( postData )
+            dc = json.loads( postData )
         except:
             pass
         else:
diff --git a/core/data/request/jsonPostDataRequest.py b/core/data/request/jsonPostDataRequest.py
index ae55204..85e63a7 100644
--- a/core/data/request/jsonPostDataRequest.py
+++ b/core/data/request/jsonPostDataRequest.py
@@ -25,9 +25,9 @@ import core.controllers.outputManager as om
 from core.data.request.httpPostDataRequest import httpPostDataRequest
 import core.data.dc.dataContainer as dc
 try:
-    from extlib.jsonpy import json as json
-except:
     import json
+except ImportError:
+    import simplejson as json
 
 class jsonPostDataRequest(httpPostDataRequest):
     '''
@@ -43,7 +43,7 @@ class jsonPostDataRequest(httpPostDataRequest):
         '''
         @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 @@ class jsonPostDataRequest(httpPostDataRequest):
         strRes += self._url
         strRes += ' | Method: ' + self._method
         strRes += ' | JSON: ('
-        strRes += json.write(self._dc)
+        strRes += json.dumps(self._dc)
         strRes += ')'
         return strRes
     
diff --git a/debian/changelog b/debian/changelog
index 9692340..f8eaf9d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+w3af (1.0~rc2svn3429-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Replace python-json by python-simplejson. 
+
+ -- Bernd Zeimetz <[email protected]>  Fri, 07 May 2010 15:44:17 +0200
+
 w3af (1.0~rc2svn3429-1) unstable; urgency=low
   * Now, only for python2.5.
 
diff --git a/debian/control b/debian/control
index b53234a..5bddb4d 100644
--- a/debian/control
+++ b/debian/control
@@ -29,7 +29,7 @@ Description: framework to find and exploit web application vulnerabilities
 Package: w3af-console
 Architecture: all
 XB-Python-Version: ${python:Versions}
-Depends: ${python:Depends}, ${misc:Depends}, python-json, python-beautifulsoup, python-soappy, python-pypdf, python-openssl, python-pysqlite2
+Depends: ${python:Depends}, ${misc:Depends}, python (>= 2.6) | python-simplejson, python-beautifulsoup, python-soappy, python-pypdf, python-openssl, python-pysqlite2
 Description: framework to find and exploit web application vulnerabilities (CLI only)
  w3af is a Web Application Attack and Audit Framework which aims
  to identify and exploit all web application vulnerabilities.
-- 
1.7.1

Reply via email to