New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

osuclient

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osuclient

A simple library for programmatic interfacing with osu servers.

pipPyPI
Version
0.2.1
Maintainers
1

osuclient.py

osuclient.py aims to allow the emulation of the communication between an osu client and server through code.

It is now also available on PyPi

Note

Please make sure this is only used on servers which you have explicit permission to do so. Using this without permission may result in restrictions and bans as it is likely to break the rules there.

Uses

Having full control over what requests are being sent to a server can be extremely beneficial. It helps with:

  • Debugging and testing rare scenarios
  • Stress testing/benchmarking specific scenarios/usages
  • Creating automated testing suites

Example

A basic client using osuclient.py would look something like this:

from osuclient.client import bancho
from osuclient.packets import constants
from osuclient.packets import rw
import asyncio

loop = asyncio.get_event_loop()

osu = bancho.OsuVersion(year= 2022, month= 6, day= 29)
hwid = bancho.HWIDInfo.generate_random()
client = bancho.BanchoClient.new(
    version= osu,
    hwid= hwid,
)

# Example custom packet handler.
@client.on_packet(constants.PacketID.SRV_NOTIFICATION)
async def on_notification(packet: rw.PacketContext) -> None:
    print(f"Notification> {packet.reader.read_str()}")

async def main():
    res = await client.connect(
        username= "Username",
        password= "Password",
        server= bancho.TargetServer.from_base_url("server.example"),
    )

    if not res:
        print("Failed to connect.")
        return
    
    print("Successfully connected.")
    print(f"{client.username} ({client.user_id})")
    print(f"Connected from {client.version.version} to {client.server.bancho}"
          f" (v{client.protocol_version})")
    
    await client.run_forever()


if __name__ == "__main__":
    loop.run_until_complete(main())

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts