Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authntication issue #11

Open
HassanRehman11 opened this issue Nov 11, 2024 · 4 comments
Open

Authntication issue #11

HassanRehman11 opened this issue Nov 11, 2024 · 4 comments

Comments

@HassanRehman11
Copy link

Hello,
I am working on python implementation. Some of Dahua are working but some are not. If I give credentials than none of the camera works. Can you tell me what setting it is looking that it some time works without credentials and auth function is not working?

@khoanguyen-3fc
Copy link
Owner

As you can see in this snippet, there are two types of devices: the older one (dtype == 0) doesn't require authentication during the handshake, while the newer one (dtype > 0) does:

dh-p2p/main.py

Lines 66 to 78 in f6478bf

if dtype > 0:
key = get_key(username, password)
nonce = get_nonce()
laddr = get_enc(key, nonce, laddr)
ipaddr = f"<IpEncrptV2>true</IpEncrptV2><LocalAddr>{laddr}</LocalAddr>"
auth = "" if dtype == 0 else get_auth(username, key, nonce, laddr)
res = device_remote.request(
f"/device/{serial}/p2p-channel",
f"<body>{auth}<Identify>{' '.join(f'{b:x}' for b in aid)}</Identify>{ipaddr}<version>5.0.0</version></body>",
should_read=False,
)

@HassanRehman11
Copy link
Author

HassanRehman11 commented Nov 13, 2024

Thanks for replying but I am accessing newer devices of Dahua and login system not working .On data.recv() it get timeout

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 14, 2024
@khoanguyen-3fc
Copy link
Owner

Have you been able to figure it out? Or could you share some logs? It might help me understand more about the issue.

@github-actions github-actions bot removed the stale label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants