Skip to main content

Pwn4Sage's Guide

截屏2024-03-23 02 26 11

还有bug, 不建议在比赛中使用

There are also bugs, not recommended for use in matches

As we all know, we cannot use pwntools directly in SageMath.

In order to solve this problem, you can use Linux.

However, I realized that Cryptor does not need all the complex functions in Pwntools.

In fact, we always use some functions in Pwntools, such as recvline(), sendline() and other functions related to receiving and sending data.

Finally, when I found that socket can be used normally in SageMath, I decided to write a Simplified pwntools.

Pwn4Sage contains the following functions (if you don't know the specific use and details, you can check in the relevant documents of pwntools):

  • send(msg)
  • sendline(msg)
  • recv(num)
  • recvuntil(msg)
  • recvline()
  • recvline_contains(key_words)
  • sendafter(delim, data, timeout)
  • interactive()
  • close()

Installation

This simple python script is available on PyPI and can be installed via pip.

  • pip install Pwn4Sage

In the notebook of SageMath, you can use %pip install Pwn4Sage to install.

Usage

from Pwn4Sage.pwn import *
s = remote('39.105.144.62', 2022)
# print(s.sendafter(b'[+] Plz tell me XXXX:', b'1234\n'))
# print(s.recvline())

# s.sendafter(b'[+] Plz tell me XXXX:', b'1234\n'))
# print(s.recvline_contains(b'XXXX'))
s.interactive()

Metadata

Release files for Pwn4Sage 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Pwn4Sage 1.4.1
File Size Uploaded
Pwn4Sage-1.4.1.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Pwn4Sage 1.4.1
File Interpreter ABI Platform
Pwn4Sage-1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / Pwn4Sage-1.4.1.tar.gz

Download URL Pwn4Sage-1.4.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
367d80e43cfdac8c505cdf3f254d2967253c5ea9e98c5e4f796ffc7082b173f3
BLAKE2b-256 checksum
How to use checksums
0fd6cb4982951ccf00352d62e2f4284b920c043bfec232998593552791bc952e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / Pwn4Sage-1.4.1-py3-none-any.whl

Download URL Pwn4Sage-1.4.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eafd656667f9ea492932f48305cff84bdcba4e97ff8e2e58d622d920d78e8b78
BLAKE2b-256 checksum
How to use checksums
d7ec85ff33a70a8f3d4315dbcaef90133ae3363c07b8f3bd684ee5c0d634ae96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.4.1 This release

2 release files

1.3.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page