MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / fileContentEncode

Method fileContentEncode

plugins/generic/filesystem.py:137–169  ·  view source on GitHub ↗
(self, content, encoding, single, chunkSize=256)

Source from the content-addressed store, hash-verified

135 return self.fileContentEncode(content, encoding, single, chunkSize)
136
137 def fileContentEncode(self, content, encoding, single, chunkSize=256):
138 retVal = []
139
140 if encoding == "hex":
141 content = encodeHex(content)
142 elif encoding == "base64":
143 content = encodeBase64(content)
144 else:
145 content = codecs.encode(content, encoding)
146
147 content = getText(content).replace("\n", "")
148
149 if not single:
150 if len(content) > chunkSize:
151 for i in xrange(0, len(content), chunkSize):
152 _ = content[i:i + chunkSize]
153
154 if encoding == "hex":
155 _ = "0x%s" % _
156 elif encoding == "base64":
157 _ = "'%s'" % _
158
159 retVal.append(_)
160
161 if not retVal:
162 if encoding == "hex":
163 content = "0x%s" % content
164 elif encoding == "base64":
165 content = "'%s'" % content
166
167 retVal = [content]
168
169 return retVal
170
171 def askCheckWrittenFile(self, localFile, remoteFile, forceCheck=False):
172 choice = None

Callers 2

fileEncodeMethod · 0.95
stackedWriteFileMethod · 0.95

Calls 6

encodeHexFunction · 0.90
encodeBase64Function · 0.90
getTextFunction · 0.90
xrangeClass · 0.85
replaceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected