### Connection String Examples Source: https://context7.com/skelsec/aardwolf/llms.txt Various URL formats for RDP and VNC connections, including authentication methods and proxy configurations. ```text # RDP with Kerberos: rdp+kerberos-password://DOMAIN\user:pass@host/?dc=10.10.10.2 # RDP Pass-the-Hash: rdp+ntlm-nt://DOMAIN\user:NTHASH@host # VNC with password: vnc+plain-password://password@host:5900 # RDP no auth: rdp://host (when NLA disabled) ``` ```python # URL Format: # protocol+auth-secret://[domain\]user:password@host:port/?options # RDP Connection Examples: # Basic RDP (no NLA, plain authentication) url = 'rdp://Administrator:Password@10.10.10.100' url = 'rdp+plain://Administrator:Password@10.10.10.100:3389' # NTLM authentication (CredSSP/NLA) url = 'rdp+ntlm-password://DOMAIN\Administrator:Passw0rd!1@10.10.10.100' # NTLM Pass-the-Hash (restricted admin mode) url = 'rdp+ntlm-nt://DOMAIN\Administrator:aabbccdd11223344aabbccdd11223344@10.10.10.100' # Kerberos authentication url = 'rdp+kerberos-password://DOMAIN\Administrator:Passw0rd@dc01.domain.local/?dc=10.10.10.2' # Kerberos with AES key url = 'rdp+kerberos-aes://DOMAIN\Administrator:HEX_AES_KEY@dc01.domain.local/?dc=10.10.10.2' # SSPI (Windows integrated auth - current user) url = 'rdp+sspi-ntlm://target.domain.local' url = 'rdp+sspi-kerberos://target.domain.local/?dc=10.10.10.2' # With SOCKS5 proxy url = 'rdp+ntlm-password://DOMAIN\user:pass@internal.host/?proxytype=socks5&proxyhost=127.0.0.1&proxyport=1080' # With HTTP proxy url = 'rdp+ntlm-password://DOMAIN\user:pass@target/?proxytype=http&proxyhost=proxy.corp&proxyport=8080' # With authenticated proxy url = 'rdp+ntlm-password://DOMAIN\user:pass@target/?proxytype=socks5&proxyhost=127.0.0.1&proxyport=1080&proxyuser=admin&proxypass=secret' # VNC Connection Examples: # VNC no authentication url = 'vnc://10.10.10.100:5900' # VNC with password url = 'vnc+plain-password://mypassword@10.10.10.100:5900' # VNC password containing colon (prepend with :) url = 'vnc+plain-password://:pass:word@10.10.10.100' # Query Parameters: # dc=IP - Domain controller for Kerberos # proxytype= - socks4, socks5, socks5-ssl, http # proxyhost= - Proxy server hostname/IP # proxyport= - Proxy server port # proxyuser= - Proxy authentication username # proxypass= - Proxy authentication password # timeout= - Connection timeout in seconds # dns= - Custom DNS server ``` -------------------------------- ### ardpscan CLI Examples Source: https://context7.com/skelsec/aardwolf/llms.txt Demonstrates various uses of the ardpscan CLI tool for RDP/VNC scanning, including login validation, screenshot capture, and capability enumeration. Supports scanning multiple targets, custom settings, and proxy configurations. ```bash # Basic login scanner - check if credentials work ardpscan -s login 'rdp+ntlm-password://DOMAIN\user:pass@' targets.txt ``` ```bash # Screenshot scanner - capture remote desktop images ardpscan -s screen -o screenshots/ 'rdp+ntlm-password://DOMAIN\user:pass@' 192.168.1.0/24 ``` ```bash # Capabilities scanner - enumerate RDP settings ardpscan -s caps 'rdp://192.168.1.100' targets.txt ``` ```bash # Run all scanners with custom settings ardpscan -s all -w 50 -t 30 -o results.txt 'rdp+ntlm-password://DOMAIN\user:pass@' \ 192.168.1.100 192.168.1.101 192.168.1.102 ``` ```bash # VNC login scanner ardpscan -s login 'vnc+plain-password://password@' vnc_targets.txt ``` ```bash # Scan with SOCKS proxy ardpscan -s login \ 'rdp+ntlm-password://DOMAIN\user:pass@?proxytype=socks5&proxyhost=127.0.0.1&proxyport=1080' \ internal_targets.txt ``` ```bash # Example URL formats: # RDP with NTLM: rdp+ntlm-password://DOMAIN\user:pass@host ``` -------------------------------- ### Establish a VNC Session Source: https://context7.com/skelsec/aardwolf/llms.txt Demonstrates connecting to a VNC server using a URL-based factory and processing incoming frame data. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata.constants import VIDEO_FORMAT async def connect_vnc(): iosettings = RDPIOSettings() iosettings.video_out_format = VIDEO_FORMAT.RAW iosettings.vnc_fps = 10 # Frame refresh rate iosettings.vnc_encodings = [2, 1, 0] # RRE, Copy Rectangle, RAW # VNC connection with password authentication # Note: VNC password can be in username field if password contains ':' url = 'vnc+plain-password://mypassword@192.168.1.100:5900' factory = RDPConnectionFactory.from_url(url, iosettings) connection = factory.get_connection(iosettings) success, err = await connection.connect() if err: print(f"VNC connection failed: {err}") return print(f"Connected to VNC server: {connection.server_name}") print(f"Screen size: {connection.width}x{connection.height}") # Keep connection alive and process frames try: while not connection.disconnected_evt.is_set(): data = await asyncio.wait_for( connection.ext_out_queue.get(), timeout=5.0 ) if data is None: break print(f"Frame update at ({data.x}, {data.y})") finally: await connection.terminate() asyncio.run(connect_vnc()) ``` -------------------------------- ### Create RDP Connections using RDPConnectionFactory Source: https://context7.com/skelsec/aardwolf/llms.txt Demonstrates initializing a connection using a URL string and custom I/O settings. The factory pattern simplifies managing connection parameters and authentication. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings async def connect_rdp(): # Configure I/O settings iosettings = RDPIOSettings() iosettings.video_width = 1024 iosettings.video_height = 768 # Create connection factory from URL # Format: protocol+auth-secret://[domain\]user:password@host:port/?options url = 'rdp+ntlm-password://DOMAIN\\Administrator:Passw0rd!1@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) # Get connection object connection = factory.get_connection(iosettings) # Connect to the server success, err = await connection.connect() if err is not None: print(f"Connection failed: {err}") return print("Connected successfully!") await connection.terminate() asyncio.run(connect_rdp()) ``` -------------------------------- ### Establish RDP Sessions with Proxy and Kerberos Source: https://context7.com/skelsec/aardwolf/llms.txt Shows how to initiate an RDP session using Kerberos authentication and a SOCKS5 proxy. Once connected, the session utilizes asynchronous queues for data exchange. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings async def establish_rdp_session(): iosettings = RDPIOSettings() # RDP with Kerberos authentication through SOCKS proxy url = 'rdp+kerberos-password://TEST\\Administrator:Passw0rd!1@win2019ad.test.corp/?dc=10.10.10.2&proxytype=socks5&proxyhost=127.0.0.1&proxyport=1080' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err # Connection is now established # ext_out_queue yields: video, clipboard, bell data # ext_in_queue expects: keyboard, mouse, clipboard data print(f"Session active, waiting for data...") # Process incoming data from server while True: data = await conn.ext_out_queue.get() if data is None: break # Connection terminated print(f"Received data type: {data.type}") asyncio.run(establish_rdp_session()) ``` -------------------------------- ### Configure Connection Parameters Source: https://context7.com/skelsec/aardwolf/llms.txt Configures video, keyboard, performance, and channel settings for RDP and VNC connections via RDPIOSettings. ```python from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata.constants import VIDEO_FORMAT from aardwolf.protocol.T125.extendedinfopacket import PERF from aardwolf.extensions.RDPECLIP.channel import RDPECLIPChannel from aardwolf.extensions.RDPEDYC.channel import RDPEDYCChannel # Create settings with custom configuration iosettings = RDPIOSettings() # Video settings iosettings.video_width = 1920 iosettings.video_height = 1080 iosettings.video_bpp_min = 16 iosettings.video_bpp_max = 32 iosettings.video_bpp_supported = [15, 16, 24, 32] iosettings.video_out_format = VIDEO_FORMAT.PNG # PIL, RAW, or PNG # Keyboard settings iosettings.keyboard_layout = 1033 # US English iosettings.keyboard_type = 4 # Enhanced 101/102-key iosettings.keyboard_subtype = 0 iosettings.keyboard_functionkey = 12 iosettings.client_keyboard = 'enus' # For VNC keyboard emulation # Performance flags (reduce bandwidth) iosettings.performance_flags = ( PERF.DISABLE_WALLPAPER | PERF.DISABLE_THEMING | PERF.DISABLE_CURSORSETTINGS | PERF.DISABLE_MENUANIMATIONS | PERF.DISABLE_FULLWINDOWDRAG ) # Channel settings iosettings.channels = [RDPECLIPChannel, RDPEDYCChannel] # Enable clipboard and dynamic channels # Clipboard settings iosettings.clipboard_use_pyperclip = True # Sync with system clipboard iosettings.clipboard_store_data = '/tmp/clipboard_log.txt' # Log clipboard data # VNC-specific settings iosettings.vnc_fps = 15 iosettings.vnc_encodings = [2, 1, 0] # Preferred encodings ``` -------------------------------- ### Capture Desktop Screenshots Source: https://context7.com/skelsec/aardwolf/llms.txt Captures screenshots of the remote desktop in PIL Image, PNG, or raw byte formats. Requires setting video dimensions and output format before establishing a connection. Ensure sufficient delay after connection for full screen render. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata.constants import VIDEO_FORMAT async def capture_screenshot(): iosettings = RDPIOSettings() iosettings.video_width = 1920 iosettings.video_height = 1080 iosettings.video_out_format = VIDEO_FORMAT.PIL url = 'rdp+ntlm-password://DOMAIN\user:pass@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err # Wait for screen data to arrive print("Waiting for desktop data...") while not conn.desktop_buffer_has_data: await asyncio.sleep(0.5) # Additional wait for full screen render await asyncio.sleep(3) # Get screenshot as PIL Image pil_image = conn.get_desktop_buffer(VIDEO_FORMAT.PIL) pil_image.save('screenshot_pil.png') # Get screenshot as PNG bytes png_bytes = conn.get_desktop_buffer(VIDEO_FORMAT.PNG) with open('screenshot.png', 'wb') as f: f.write(png_bytes) # Get screenshot as raw RGBA bytes raw_bytes = conn.get_desktop_buffer(VIDEO_FORMAT.RAW) print(f"Raw buffer size: {len(raw_bytes)} bytes") print("Screenshots saved!") asyncio.run(capture_screenshot()) ``` -------------------------------- ### Send Keyboard Input via Aardwolf Source: https://context7.com/skelsec/aardwolf/llms.txt Demonstrates sending Unicode characters, virtual keys, and raw scan codes to an RDP session. Requires an established connection and a short delay to allow for session initialization. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings async def send_keyboard_input(): iosettings = RDPIOSettings() url = 'rdp+ntlm-password://DOMAIN\\user:pass@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err # Wait for session to initialize await asyncio.sleep(2) # Type "Hello" using Unicode characters text = "Hello World!" for char in text: # Press key await conn.send_key_char(ord(char), is_pressed=True) await asyncio.sleep(0.05) # Release key await conn.send_key_char(ord(char), is_pressed=False) await asyncio.sleep(0.05) # Send Enter key using virtual key await conn.send_key_virtualkey('VK_RETURN', is_pressed=True, is_extended=False) await conn.send_key_virtualkey('VK_RETURN', is_pressed=False, is_extended=False) # Send Ctrl+A (select all) using scan codes # Scan code 29 = Left Ctrl, Scan code 30 = 'A' await conn.send_key_scancode(29, is_pressed=True, is_extended=False) # Ctrl down await conn.send_key_scancode(30, is_pressed=True, is_extended=False) # A down await conn.send_key_scancode(30, is_pressed=False, is_extended=False) # A up await conn.send_key_scancode(29, is_pressed=False, is_extended=False) # Ctrl up asyncio.run(send_keyboard_input()) ``` -------------------------------- ### Process Video Stream Updates Source: https://context7.com/skelsec/aardwolf/llms.txt Asynchronously process video frames and system events from the ext_out_queue. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata import RDPDATATYPE from aardwolf.commons.queuedata.constants import VIDEO_FORMAT async def process_video_stream(): iosettings = RDPIOSettings() iosettings.video_out_format = VIDEO_FORMAT.PIL url = 'rdp+ntlm-password://DOMAIN\user:pass@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err frame_count = 0 while True: # Get next event from server data = await conn.ext_out_queue.get() if data is None: print("Connection closed") break if data.type == RDPDATATYPE.VIDEO: # Video frame update frame_count += 1 print(f"Frame {frame_count}: pos=({data.x},{data.y}) " f"size={data.width}x{data.height} " f"bpp={data.bitsPerPixel}") # data.data contains the image in configured format # For PIL format, it's a PIL.Image object if hasattr(data, 'data') and data.data: # Save every 100th frame if frame_count % 100 == 0: if iosettings.video_out_format == VIDEO_FORMAT.PIL: data.data.save(f'frame_{frame_count}.png') elif data.type == RDPDATATYPE.CLIPBOARD_READY: print("Clipboard channel ready") elif data.type == RDPDATATYPE.CLIPBOARD_NEW_DATA_AVAILABLE: print("New clipboard data available on server") elif data.type == RDPDATATYPE.CLIPBOARD_DATA_TXT: print(f"Clipboard text: {data.data[:50]}...") elif data.type == RDPDATATYPE.BEEP: print("Server sent bell/beep signal") asyncio.run(process_video_stream()) ``` -------------------------------- ### Send Mouse Input via Aardwolf Source: https://context7.com/skelsec/aardwolf/llms.txt Demonstrates mouse movement, button clicks, double-clicks, and scroll wheel actions. Uses the MOUSEBUTTON constant for specifying button types. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata.constants import MOUSEBUTTON async def send_mouse_input(): iosettings = RDPIOSettings() url = 'rdp+ntlm-password://DOMAIN\\user:pass@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err await asyncio.sleep(2) # Move mouse to coordinates (500, 300) await conn.send_mouse( button=MOUSEBUTTON.MOUSEBUTTON_HOVER, xPos=500, yPos=300, is_pressed=False ) await asyncio.sleep(0.1) # Left click at current position await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_LEFT, 500, 300, is_pressed=True) await asyncio.sleep(0.05) await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_LEFT, 500, 300, is_pressed=False) # Double-click for _ in range(2): await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_LEFT, 500, 300, is_pressed=True) await asyncio.sleep(0.05) await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_LEFT, 500, 300, is_pressed=False) await asyncio.sleep(0.1) # Right click for context menu await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_RIGHT, 600, 400, is_pressed=True) await conn.send_mouse(MOUSEBUTTON.MOUSEBUTTON_RIGHT, 600, 400, is_pressed=False) # Scroll wheel (steps parameter controls scroll amount) await conn.send_mouse( button=MOUSEBUTTON.MOUSEBUTTON_WHEEL_DOWN, xPos=500, yPos=300, is_pressed=True, steps=3 ) asyncio.run(send_mouse_input()) ``` -------------------------------- ### Clipboard Operations Source: https://context7.com/skelsec/aardwolf/llms.txt Performs clipboard operations including setting text and simulating paste actions, then reads the remote clipboard content. Clipboard synchronization requires `clipboard_use_pyperclip` to be set to True. Monitor clipboard changes using the `ext_out_queue`. ```python import asyncio from aardwolf.commons.factory import RDPConnectionFactory from aardwolf.commons.iosettings import RDPIOSettings from aardwolf.commons.queuedata import RDP_CLIPBOARD_DATA_TXT, RDPDATATYPE async def clipboard_operations(): iosettings = RDPIOSettings() iosettings.clipboard_use_pyperclip = True url = 'rdp+ntlm-password://DOMAIN\user:pass@192.168.1.100' factory = RDPConnectionFactory.from_url(url, iosettings) async with factory.get_connection(iosettings) as conn: success, err = await conn.connect() if err: raise err await asyncio.sleep(2) # Set clipboard text on remote machine await conn.set_current_clipboard_text("Text copied from Python script!") # Paste using Ctrl+V await conn.send_key_scancode(29, is_pressed=True, is_extended=False) # Ctrl await conn.send_key_scancode(47, is_pressed=True, is_extended=False) # V await conn.send_key_scancode(47, is_pressed=False, is_extended=False) await conn.send_key_scancode(29, is_pressed=False, is_extended=False) await asyncio.sleep(1) # Get current clipboard text from remote clipboard_text = await conn.get_current_clipboard_text() print(f"Remote clipboard contains: {clipboard_text}") # Monitor clipboard changes via queue async def monitor_clipboard(): while True: data = await conn.ext_out_queue.get() if data is None: break if data.type == RDPDATATYPE.CLIPBOARD_DATA_TXT: print(f"Clipboard updated: {data.data}") asyncio.run(clipboard_operations()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.