Skip to main content

AIO Ident

Simple ident protocol (RFC 1413) parser for Python AsyncIO.

Install

It's just as simple as

pip install aioident

Doesn't require anything external as it only relies on standard modules.

Usage

It can connect to a host running an ident daemon.

import asyncio
import aioident

async def main():
    res = await aioident.connect("someone.sometld.com", 5912, 6667) # Assumes you are running at port 6667, and the remote host originates from port 5912 ( don't ask me, it's just some TCP sorcery ;) )
    # res = await aioident.connect("someone.sometld.com", 5912, 6667, 1113) # You can also use a different ident port if needed
    if res.ok and res.type == "UNIX":
        print(f"It works! Username: {res.username}")
    else:
        print(f"It doesn't work. Response: {res.type}")

asyncio.run(main())
# It works! Username: swee

It can also parse an ident response that has been already made.

import aioident

def test(text):
    try:
        res = aioident.parse(text)
        if res.ok:
            print(f"Is an ident response. Username is {res.username}")
        else:
            print(f"Is an ident response, but it failed. Error is {res.type}")
    except:
        print("That isn't an ident response.")

test("5912, 6667 : USERID : UNIX : swee") # Spaces are optional (not used in some identd software)
# Is an ident response. Username is swee

test("5912, 6667 : ERROR : NO-USER")
# Is an ident response, but it failed. Error is NO-USER

test("foo bar baz")
# That isn't an ident response.

Ident class

A simple class for parsing specific parts of the ident response (like checking statuses in requests)

This class is always returned with both aioident.connect and aioident.parse however it can also be built manually.

myident = aioident.Ident(5912, 6667, "USERID", "UNIX : swee") # straightforward building

myident.serverport # 5912

myident.clientport # 6667

# ^ It's easy to be confused with those two, but the "server" in this case is the identd listener.

myident.status # "USERID"

myident.data # "UNIX : swee"

# ^ Those four are the values already put in when building

myident.data_split # ["UNIX", "swee"], just splits the colons and automatically strips the spaces for each

myident.ok # True, Returns False if the status is ERROR and not USERID

myident.type # "UNIX", The type of username (usually UNIX) or the reason for error

myident.username # "swee", The username if successful and the type is UNIX. if both aren't true, then it will return None

myident.stringify # "5912, 6667 : USERID : UNIX : swee", Turns that class back into a string for a regular ident response

Example 2, with an error

myident = aioident.Ident(5912, 6667, "ERROR", "NO-USER") # still straightforward

myident.serverport # 5912

myident.clientport # 6667

myident.status # "ERROR"

myident.data # "NO-USER"

myident.data_split # ["NO-USER"]

myident.ok # False

myident.type # "NO-USER"

myident.username # None

myident.stringify # "5912, 6667 : ERROR : NO-USER"

Metadata

Release files for aioident 2.0.0

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

Source distribution (sdist)

Source distribution for aioident 2.0.0
File Size Uploaded
aioident-2.0.0.tar.gz 3.9 kB Details

Built distribution (wheel)

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

Total release size: 8.5 kB

Release files / aioident-2.0.0.tar.gz

Download URL aioident-2.0.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2642bfe13e880f112daf5c0e31d890db0b7b05bb27b3d4019f7d623b62601771
BLAKE2b-256 checksum
How to use checksums
2187022b38ad8d8766e65ec7379973d46786440a5f9736614afede9ba5cec96e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release files / aioident-2.0.0-py3-none-any.whl

Download URL aioident-2.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70894996a4dfb5793ff5d5a699976b63d8ef9f6a8854939e479653887dd1e6b6
BLAKE2b-256 checksum
How to use checksums
1574206d3f2328d22367d3c4ce6edabd7042e3b74ea06d9d5b11fc38fe69102a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

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