| 6816 | return |
| 6817 | |
| 6818 | def get_shellcode(self, sid: int) -> None: |
| 6819 | info(f"Downloading shellcode id={sid}") |
| 6820 | res = http_get(self.get_url.format(sid)) |
| 6821 | if res is None: |
| 6822 | err(f"Failed to fetch shellcode #{sid}") |
| 6823 | return |
| 6824 | |
| 6825 | ok("Downloaded, written to disk...") |
| 6826 | with tempfile.NamedTemporaryFile(prefix="sc-", suffix=".txt", mode='w+b', delete=False, dir=gef.config["gef.tempdir"]) as fd: |
| 6827 | shellcode = res.split(b"<pre>")[1].split(b"</pre>")[0] |
| 6828 | shellcode = shellcode.replace(b""", b'"') |
| 6829 | fd.write(shellcode) |
| 6830 | ok(f"Shellcode written to '{fd.name}'") |
| 6831 | return |
| 6832 | |
| 6833 | |
| 6834 | @register |