100 |
101 |
101 def checkServiceKeyValidity(self, key, protocol=""): |
102 def checkServiceKeyValidity(self, key, protocol=""): |
102 """ |
103 """ |
103 Public method to check the validity of the given service key. |
104 Public method to check the validity of the given service key. |
104 |
105 |
105 @param key service key (string) |
106 @param key service key |
106 @param protocol protocol used to access VirusTotal (string) |
107 @type str |
|
108 @param protocol protocol used to access VirusTotal |
|
109 @type str |
107 """ |
110 """ |
108 urlStr = ( |
111 urlStr = ( |
109 self.GetFileReportUrl |
112 self.GetFileReportUrl |
110 if protocol == "" |
113 if protocol == "" |
111 else self.GetFileReportPattern.format(protocol) |
114 else self.GetFileReportPattern.format(protocol) |
149 |
152 |
150 def submitUrl(self, url): |
153 def submitUrl(self, url): |
151 """ |
154 """ |
152 Public method to submit an URL to be scanned. |
155 Public method to submit an URL to be scanned. |
153 |
156 |
154 @param url url to be scanned (QUrl) |
157 @param url url to be scanned |
|
158 @type QUrl |
155 """ |
159 """ |
156 request = QNetworkRequest(QUrl(self.ScanUrlUrl)) |
160 request = QNetworkRequest(QUrl(self.ScanUrlUrl)) |
157 request.setHeader( |
161 request.setHeader( |
158 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
162 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
159 "application/x-www-form-urlencoded", |
163 "application/x-www-form-urlencoded", |
197 |
201 |
198 def __getUrlScanReportUrl(self, scanId): |
202 def __getUrlScanReportUrl(self, scanId): |
199 """ |
203 """ |
200 Private method to get the report URL for a URL scan. |
204 Private method to get the report URL for a URL scan. |
201 |
205 |
202 @param scanId ID of the scan to get the report URL for (string) |
206 @param scanId ID of the scan to get the report URL for |
|
207 @type str |
203 """ |
208 """ |
204 request = QNetworkRequest(QUrl(self.GetUrlReportUrl)) |
209 request = QNetworkRequest(QUrl(self.GetUrlReportUrl)) |
205 request.setHeader( |
210 request.setHeader( |
206 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
211 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
207 "application/x-www-form-urlencoded", |
212 "application/x-www-form-urlencoded", |
234 |
239 |
235 def __getFileScanReportUrl(self, scanId): |
240 def __getFileScanReportUrl(self, scanId): |
236 """ |
241 """ |
237 Private method to get the report URL for a file scan. |
242 Private method to get the report URL for a file scan. |
238 |
243 |
239 @param scanId ID of the scan to get the report URL for (string) |
244 @param scanId ID of the scan to get the report URL for |
|
245 @type str |
240 """ |
246 """ |
241 request = QNetworkRequest(QUrl(self.GetFileReportUrl)) |
247 request = QNetworkRequest(QUrl(self.GetFileReportUrl)) |
242 request.setHeader( |
248 request.setHeader( |
243 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
249 QNetworkRequest.KnownHeaders.ContentTypeHeader, |
244 "application/x-www-form-urlencoded", |
250 "application/x-www-form-urlencoded", |