summaryrefslogtreecommitdiff
blob: 306c24a59f8a617fd9fe8f17c9c704dcd4d14fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--- ./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