pydeclient


Namepydeclient JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryA package for requesting decompilebench service
upload_time2024-05-28 07:34:37
maintainerNone
docs_urlNone
authorhustcw
requires_pythonNone
licenseMIT
keywords decompiler binary reverse engineering
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Decompilebench Client (declient)

## Asynchronous Request 
```python
from pathlib import Path
import asyncio
from declient import DecompilerClient

binary_path = Path(__file__).parent / "testcases" / "test.bin.strip"
address_list = ["0x1a00", "0x1b00"]  # Example address list
base_url = "http://localhost:8000"  # Example base URL
output = "my_task_queue.json"
async def main():
    client = DecompilerClient(
        max_concurrent_requests=50,
        persistent_file_path=output,
        target_url=base_url,
    )
    
    DECOMPILERS = await client.get_decompilers_async()
    
    tasks = [
        asyncio.create_task(client.decompile_async(binary_path, address_list, decompiler_name))
        for decompiler_name in DECOMPILERS
    ]
    for task in tasks:
        print(await task)
        
    # query and wait for tasks to be completed
    await client.process_task_queue()
    
    # get results
    tasks = client.get_completed_tasks()
    for task in tasks:
        print(f"Task {task['uuid']} completed with result: {task['result']}")

asyncio.run(main())
```

## Asynchronous Resume
```python
import asyncio
from declient import DecompilerClient

base_url = "http://localhost:8000"  # Example base URL
output = "my_task_queue.json"
async def main():
    client = DecompilerClient(
        max_concurrent_requests=50,
        persistent_file_path=output,
        target_url=base_url,
    )
    
    # resume quering tasks
    await client.process_task_queue()
    
    # get results
    tasks = client.get_completed_tasks()
    for task in tasks:
        print(f"Task {task['uuid']} completed with result: {task['result']}")

asyncio.run(main())
```

## Synchronous Request
```python
from pathlib import Path
from declient import get_decompilers, decompile

binary_path = Path(__file__).parent / "testcases" / "test.bin.strip"
address_list = ["0x1a00", "0x1b00"]  
base_url = "http://localhost:8000"  
decompilers = get_decompilers(base_url)
for decompiler in decompilers:
    print(decompiler, decompile(binary_path, address_list, decompiler, base_url))

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pydeclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "decompiler, binary, reverse engineering",
    "author": "hustcw",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/01/9a/b2a993cd037e37c22991a3dbc2fc1ba087dbb31e3f46b55b7912fa4d04ff/pydeclient-1.1.0.tar.gz",
    "platform": null,
    "description": "# Decompilebench Client (declient)\n\n## Asynchronous Request \n```python\nfrom pathlib import Path\nimport asyncio\nfrom declient import DecompilerClient\n\nbinary_path = Path(__file__).parent / \"testcases\" / \"test.bin.strip\"\naddress_list = [\"0x1a00\", \"0x1b00\"]  # Example address list\nbase_url = \"http://localhost:8000\"  # Example base URL\noutput = \"my_task_queue.json\"\nasync def main():\n    client = DecompilerClient(\n        max_concurrent_requests=50,\n        persistent_file_path=output,\n        target_url=base_url,\n    )\n    \n    DECOMPILERS = await client.get_decompilers_async()\n    \n    tasks = [\n        asyncio.create_task(client.decompile_async(binary_path, address_list, decompiler_name))\n        for decompiler_name in DECOMPILERS\n    ]\n    for task in tasks:\n        print(await task)\n        \n    # query and wait for tasks to be completed\n    await client.process_task_queue()\n    \n    # get results\n    tasks = client.get_completed_tasks()\n    for task in tasks:\n        print(f\"Task {task['uuid']} completed with result: {task['result']}\")\n\nasyncio.run(main())\n```\n\n## Asynchronous Resume\n```python\nimport asyncio\nfrom declient import DecompilerClient\n\nbase_url = \"http://localhost:8000\"  # Example base URL\noutput = \"my_task_queue.json\"\nasync def main():\n    client = DecompilerClient(\n        max_concurrent_requests=50,\n        persistent_file_path=output,\n        target_url=base_url,\n    )\n    \n    # resume quering tasks\n    await client.process_task_queue()\n    \n    # get results\n    tasks = client.get_completed_tasks()\n    for task in tasks:\n        print(f\"Task {task['uuid']} completed with result: {task['result']}\")\n\nasyncio.run(main())\n```\n\n## Synchronous Request\n```python\nfrom pathlib import Path\nfrom declient import get_decompilers, decompile\n\nbinary_path = Path(__file__).parent / \"testcases\" / \"test.bin.strip\"\naddress_list = [\"0x1a00\", \"0x1b00\"]  \nbase_url = \"http://localhost:8000\"  \ndecompilers = get_decompilers(base_url)\nfor decompiler in decompilers:\n    print(decompiler, decompile(binary_path, address_list, decompiler, base_url))\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package for requesting decompilebench service",
    "version": "1.1.0",
    "project_urls": null,
    "split_keywords": [
        "decompiler",
        " binary",
        " reverse engineering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f8ffa339273048ca85b2c2c3b429cb2a96fe366f9269ebc618205f836371e10d",
                "md5": "bfbaaf80e383887434a98e71ac099d6e",
                "sha256": "cd0ccb0f62d9e03e3f310b45f99c8dbdbff7caeb9bf81ec4fd73eb04a5af2729"
            },
            "downloads": -1,
            "filename": "pydeclient-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bfbaaf80e383887434a98e71ac099d6e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5018,
            "upload_time": "2024-05-28T07:34:35",
            "upload_time_iso_8601": "2024-05-28T07:34:35.738860Z",
            "url": "https://files.pythonhosted.org/packages/f8/ff/a339273048ca85b2c2c3b429cb2a96fe366f9269ebc618205f836371e10d/pydeclient-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "019ab2a993cd037e37c22991a3dbc2fc1ba087dbb31e3f46b55b7912fa4d04ff",
                "md5": "c2826428554dbf0a4ba7955d4009499b",
                "sha256": "ffd8bd1e05242197793b782ce29c7ce69c228b8a0ce54d543d2b0e42cae5c81a"
            },
            "downloads": -1,
            "filename": "pydeclient-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c2826428554dbf0a4ba7955d4009499b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4050,
            "upload_time": "2024-05-28T07:34:37",
            "upload_time_iso_8601": "2024-05-28T07:34:37.255532Z",
            "url": "https://files.pythonhosted.org/packages/01/9a/b2a993cd037e37c22991a3dbc2fc1ba087dbb31e3f46b55b7912fa4d04ff/pydeclient-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-28 07:34:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pydeclient"
}
        
Elapsed time: 0.64289s