(self, keyword)
| 306 | |
| 307 | """ search() and display() use the shell-storm API """ |
| 308 | def search(self, keyword): |
| 309 | if keyword is None: |
| 310 | return None |
| 311 | try: |
| 312 | msg("Connecting to shell-storm.org...") |
| 313 | s = six.moves.http_client.HTTPConnection("shell-storm.org") |
| 314 | |
| 315 | s.request("GET", "/api/?s="+str(keyword)) |
| 316 | res = s.getresponse() |
| 317 | read_result = res.read().decode('utf-8') |
| 318 | data_l = [x for x in read_result.split('\n') if x] # remove empty results |
| 319 | except Exception as e: |
| 320 | if config.Option.get("debug") == "on": |
| 321 | msg("Exception: %s" %e) |
| 322 | traceback.print_exc() |
| 323 | error_msg("Cannot connect to shell-storm.org") |
| 324 | return None |
| 325 | |
| 326 | data_dl = [] |
| 327 | for data in data_l: |
| 328 | try: |
| 329 | desc = data.split("::::") |
| 330 | dico = { |
| 331 | 'ScAuthor': desc[0], |
| 332 | 'ScArch': desc[1], |
| 333 | 'ScTitle': desc[2], |
| 334 | 'ScId': desc[3], |
| 335 | 'ScUrl': desc[4] |
| 336 | } |
| 337 | data_dl.append(dico) |
| 338 | except Exception as e: |
| 339 | if config.Option.get("debug") == "on": |
| 340 | msg("Exception: %s" %e) |
| 341 | traceback.print_exc() |
| 342 | |
| 343 | return data_dl |
| 344 | |
| 345 | def display(self, shellcodeId): |
| 346 | if shellcodeId is None: |
no test coverage detected